Numba JIT giving LoweringError although code works fine otherwiseWhy do I get “python int too large to convert to C long” errors when I use matplotlib's DateFormatter to format dates on the x axis?calculate Matrix Vector multiplication with python in cudaSolve non-negative least squares problem “xA=b”Related to designing neural network in python 3.6ImportError: Building module nms.gpu_nms failedAlpha_vantage produces errorFixing a float error in my script (need help) Pythonconverting curl command to a Python3 requests.post (SOAP xml)unfolding timesteps when using MultiRNN of tensorflow0.12 gets TypeErrorSpyder debug mode not working in Anaconda root environment
Assassin's bullet with mercury
I'm flying to France today and my passport expires in less than 2 months
How can I tell someone that I want to be his or her friend?
Why is the ratio of two extensive quantities always intensive?
90's TV series where a boy goes to another dimension through portal near power lines
Facing a paradox: Earnshaw's theorem in one dimension
Python: return float 1.0 as int 1 but float 1.5 as float 1.5
Watching something be written to a file live with tail
How could indestructible materials be used in power generation?
What's the difference between 'rename' and 'mv'?
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
prove that the matrix A is diagonalizable
1960's book about a plague that kills all white people
I Accidentally Deleted a Stock Terminal Theme
Has there ever been an airliner design involving reducing generator load by installing solar panels?
How to draw the figure with four pentagons?
Can I ask the recruiters in my resume to put the reason why I am rejected?
How can saying a song's name be a copyright violation?
UK: Is there precedent for the governments e-petition site changing the direction of a government decision?
Why do I get two different answers for this counting problem?
Increase size of symbol intercal when in superscript position
Is it inappropriate for a student to attend their mentor's dissertation defense?
In Romance of the Three Kingdoms why do people still use bamboo sticks when papers are already invented?
What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?
Numba JIT giving LoweringError although code works fine otherwise
Why do I get “python int too large to convert to C long” errors when I use matplotlib's DateFormatter to format dates on the x axis?calculate Matrix Vector multiplication with python in cudaSolve non-negative least squares problem “xA=b”Related to designing neural network in python 3.6ImportError: Building module nms.gpu_nms failedAlpha_vantage produces errorFixing a float error in my script (need help) Pythonconverting curl command to a Python3 requests.post (SOAP xml)unfolding timesteps when using MultiRNN of tensorflow0.12 gets TypeErrorSpyder debug mode not working in Anaconda root environment
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have the following code in python to calculate the Mandelbrot set. It works fine, but when I try to compile it with JIT by adding @jit decorator before the function def, it doesn't work any more. Can anybody tell me why? I would appreciate if you don't criticize my Mandelbrot calculation (I am guessing it could be optimized) and just let me know why JIT doesn't work with this function. By the way, the code is indented after the def. It just didn't appear that way when I inserted it here.
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(int(iters))
return points
I get the following error report with the final line being LoweringError
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python
programs/mandelbrot') Traceback (most recent call last):
File "", line 1, in
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python programs/mandelbrot')
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 786, in runfile
execfile(filename, namespace)
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python programs/mandelbrot/mandelbrot.py", line 41, in
mandelbrot_set=mandelbrot(-2.0,1.0,-1.5,1.5,500,500,50)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 368, in _compile_for_args
raise e
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 325, in _compile_for_args
return self.compile(tuple(argtypes))
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 653, in compile
cres = self._compiler.compile(args, return_type)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 83, in compile
pipeline_class=self.pipeline_class)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
873, in compile_extra
return pipeline.compile_extra(func)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
367, in compile_extra
return self._compile_bytecode()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
804, in _compile_bytecode
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
438, in stage_objectmode_frontend
cres = self.frontend_looplift()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
428, in frontend_looplift
lifted=tuple(loops), lifted_from=None)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
887, in compile_ir
lifted_from=lifted_from)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
375, in compile_ir
return self._compile_ir()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
811, in _compile_ir
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
652, in stage_objectmode_backend
self._backend(lowerfn, objectmode=True)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
628, in _backend
lowered = lowerfn()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
601, in backend_object_mode
self.flags)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
1018, in py_lowering_stage
lower.lower()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
173, in lower
self.lower_normal_function(self.fndesc)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
214, in lower_normal_function
entry_block_tail = self.lower_function_body()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
239, in lower_function_body
self.lower_block(block)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
254, in lower_block
self.lower_inst(inst)
File "C:UsersMatthewAnaconda3libcontextlib.py", line 130, in
exit
self.gen.throw(type, value, traceback)
File "C:UsersMatthewAnaconda3libsite-packagesnumbaerrors.py",
line 585, in new_error_context
six.reraise(type(newerr), newerr, tb)
File "C:UsersMatthewAnaconda3libsite-packagesnumbasix.py",
line 659, in reraise
raise value
LoweringError: iters
File "mandelbrot.py", line 17: def
mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
for ix,re in enumerate(x):
points.append([])
^
python-3.x math jit mandelbrot
add a comment |
I have the following code in python to calculate the Mandelbrot set. It works fine, but when I try to compile it with JIT by adding @jit decorator before the function def, it doesn't work any more. Can anybody tell me why? I would appreciate if you don't criticize my Mandelbrot calculation (I am guessing it could be optimized) and just let me know why JIT doesn't work with this function. By the way, the code is indented after the def. It just didn't appear that way when I inserted it here.
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(int(iters))
return points
I get the following error report with the final line being LoweringError
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python
programs/mandelbrot') Traceback (most recent call last):
File "", line 1, in
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python programs/mandelbrot')
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 786, in runfile
execfile(filename, namespace)
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python programs/mandelbrot/mandelbrot.py", line 41, in
mandelbrot_set=mandelbrot(-2.0,1.0,-1.5,1.5,500,500,50)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 368, in _compile_for_args
raise e
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 325, in _compile_for_args
return self.compile(tuple(argtypes))
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 653, in compile
cres = self._compiler.compile(args, return_type)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 83, in compile
pipeline_class=self.pipeline_class)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
873, in compile_extra
return pipeline.compile_extra(func)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
367, in compile_extra
return self._compile_bytecode()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
804, in _compile_bytecode
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
438, in stage_objectmode_frontend
cres = self.frontend_looplift()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
428, in frontend_looplift
lifted=tuple(loops), lifted_from=None)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
887, in compile_ir
lifted_from=lifted_from)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
375, in compile_ir
return self._compile_ir()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
811, in _compile_ir
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
652, in stage_objectmode_backend
self._backend(lowerfn, objectmode=True)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
628, in _backend
lowered = lowerfn()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
601, in backend_object_mode
self.flags)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
1018, in py_lowering_stage
lower.lower()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
173, in lower
self.lower_normal_function(self.fndesc)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
214, in lower_normal_function
entry_block_tail = self.lower_function_body()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
239, in lower_function_body
self.lower_block(block)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
254, in lower_block
self.lower_inst(inst)
File "C:UsersMatthewAnaconda3libcontextlib.py", line 130, in
exit
self.gen.throw(type, value, traceback)
File "C:UsersMatthewAnaconda3libsite-packagesnumbaerrors.py",
line 585, in new_error_context
six.reraise(type(newerr), newerr, tb)
File "C:UsersMatthewAnaconda3libsite-packagesnumbasix.py",
line 659, in reraise
raise value
LoweringError: iters
File "mandelbrot.py", line 17: def
mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
for ix,re in enumerate(x):
points.append([])
^
python-3.x math jit mandelbrot
add a comment |
I have the following code in python to calculate the Mandelbrot set. It works fine, but when I try to compile it with JIT by adding @jit decorator before the function def, it doesn't work any more. Can anybody tell me why? I would appreciate if you don't criticize my Mandelbrot calculation (I am guessing it could be optimized) and just let me know why JIT doesn't work with this function. By the way, the code is indented after the def. It just didn't appear that way when I inserted it here.
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(int(iters))
return points
I get the following error report with the final line being LoweringError
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python
programs/mandelbrot') Traceback (most recent call last):
File "", line 1, in
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python programs/mandelbrot')
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 786, in runfile
execfile(filename, namespace)
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python programs/mandelbrot/mandelbrot.py", line 41, in
mandelbrot_set=mandelbrot(-2.0,1.0,-1.5,1.5,500,500,50)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 368, in _compile_for_args
raise e
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 325, in _compile_for_args
return self.compile(tuple(argtypes))
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 653, in compile
cres = self._compiler.compile(args, return_type)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 83, in compile
pipeline_class=self.pipeline_class)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
873, in compile_extra
return pipeline.compile_extra(func)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
367, in compile_extra
return self._compile_bytecode()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
804, in _compile_bytecode
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
438, in stage_objectmode_frontend
cres = self.frontend_looplift()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
428, in frontend_looplift
lifted=tuple(loops), lifted_from=None)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
887, in compile_ir
lifted_from=lifted_from)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
375, in compile_ir
return self._compile_ir()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
811, in _compile_ir
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
652, in stage_objectmode_backend
self._backend(lowerfn, objectmode=True)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
628, in _backend
lowered = lowerfn()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
601, in backend_object_mode
self.flags)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
1018, in py_lowering_stage
lower.lower()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
173, in lower
self.lower_normal_function(self.fndesc)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
214, in lower_normal_function
entry_block_tail = self.lower_function_body()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
239, in lower_function_body
self.lower_block(block)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
254, in lower_block
self.lower_inst(inst)
File "C:UsersMatthewAnaconda3libcontextlib.py", line 130, in
exit
self.gen.throw(type, value, traceback)
File "C:UsersMatthewAnaconda3libsite-packagesnumbaerrors.py",
line 585, in new_error_context
six.reraise(type(newerr), newerr, tb)
File "C:UsersMatthewAnaconda3libsite-packagesnumbasix.py",
line 659, in reraise
raise value
LoweringError: iters
File "mandelbrot.py", line 17: def
mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
for ix,re in enumerate(x):
points.append([])
^
python-3.x math jit mandelbrot
I have the following code in python to calculate the Mandelbrot set. It works fine, but when I try to compile it with JIT by adding @jit decorator before the function def, it doesn't work any more. Can anybody tell me why? I would appreciate if you don't criticize my Mandelbrot calculation (I am guessing it could be optimized) and just let me know why JIT doesn't work with this function. By the way, the code is indented after the def. It just didn't appear that way when I inserted it here.
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(int(iters))
return points
I get the following error report with the final line being LoweringError
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python
programs/mandelbrot') Traceback (most recent call last):
File "", line 1, in
runfile('D:/python programs/mandelbrot/mandelbrot.py', wdir='D:/python programs/mandelbrot')
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 786, in runfile
execfile(filename, namespace)
File
"C:UsersMatthewAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py",
line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python programs/mandelbrot/mandelbrot.py", line 41, in
mandelbrot_set=mandelbrot(-2.0,1.0,-1.5,1.5,500,500,50)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 368, in _compile_for_args
raise e
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 325, in _compile_for_args
return self.compile(tuple(argtypes))
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 653, in compile
cres = self._compiler.compile(args, return_type)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbadispatcher.py",
line 83, in compile
pipeline_class=self.pipeline_class)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
873, in compile_extra
return pipeline.compile_extra(func)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
367, in compile_extra
return self._compile_bytecode()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
804, in _compile_bytecode
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
438, in stage_objectmode_frontend
cres = self.frontend_looplift()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
428, in frontend_looplift
lifted=tuple(loops), lifted_from=None)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
887, in compile_ir
lifted_from=lifted_from)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
375, in compile_ir
return self._compile_ir()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
811, in _compile_ir
return self._compile_core()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
791, in _compile_core
res = pm.run(self.status)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
253, in run
raise patched_exception
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
245, in run
stage()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
652, in stage_objectmode_backend
self._backend(lowerfn, objectmode=True)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
628, in _backend
lowered = lowerfn()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
601, in backend_object_mode
self.flags)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbacompiler.py", line
1018, in py_lowering_stage
lower.lower()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
173, in lower
self.lower_normal_function(self.fndesc)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
214, in lower_normal_function
entry_block_tail = self.lower_function_body()
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
239, in lower_function_body
self.lower_block(block)
File
"C:UsersMatthewAnaconda3libsite-packagesnumbalowering.py", line
254, in lower_block
self.lower_inst(inst)
File "C:UsersMatthewAnaconda3libcontextlib.py", line 130, in
exit
self.gen.throw(type, value, traceback)
File "C:UsersMatthewAnaconda3libsite-packagesnumbaerrors.py",
line 585, in new_error_context
six.reraise(type(newerr), newerr, tb)
File "C:UsersMatthewAnaconda3libsite-packagesnumbasix.py",
line 659, in reraise
raise value
LoweringError: iters
File "mandelbrot.py", line 17: def
mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
for ix,re in enumerate(x):
points.append([])
^
python-3.x math jit mandelbrot
python-3.x math jit mandelbrot
edited Mar 22 at 20:34
sepp2k
300k39601617
300k39601617
asked Mar 21 at 21:53
Matthew DaviesMatthew Davies
111
111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I solved the problem. It seems I need to initialize the variable 'iters' to 0 at the start of the loop. So this works when I put @jit before it. Anybody know why?
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
iters=0
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(iters)
return points
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289822%2fnumba-jit-giving-loweringerror-although-code-works-fine-otherwise%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I solved the problem. It seems I need to initialize the variable 'iters' to 0 at the start of the loop. So this works when I put @jit before it. Anybody know why?
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
iters=0
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(iters)
return points
add a comment |
I solved the problem. It seems I need to initialize the variable 'iters' to 0 at the start of the loop. So this works when I put @jit before it. Anybody know why?
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
iters=0
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(iters)
return points
add a comment |
I solved the problem. It seems I need to initialize the variable 'iters' to 0 at the start of the loop. So this works when I put @jit before it. Anybody know why?
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
iters=0
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(iters)
return points
I solved the problem. It seems I need to initialize the variable 'iters' to 0 at the start of the loop. So this works when I put @jit before it. Anybody know why?
def mandelbrot(xmin,xmax,ymin,ymax,width,height,maxiter):
points=[]
x=np.linspace(xmin,xmax,width)
y=np.linspace(ymin,ymax,height)
for ix,re in enumerate(x):
points.append([])
for iy,im in enumerate(y):
iters=0
cx=re
cy=im
zx=0
zy=0
for n in range(maxiter):
if zx*zx+zy*zy>4.0:
iters=n
break
else:
oldzx=zx
oldzy=zy
zy = 2*oldzx*oldzy+cy
zx = oldzx*oldzx-oldzy*oldzy+cx
iters=n
points[ix].append(iters)
return points
answered Mar 22 at 7:30
Matthew DaviesMatthew Davies
111
111
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289822%2fnumba-jit-giving-loweringerror-although-code-works-fine-otherwise%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown