Hi everyone!
I had been following this example for extending scipy.linalg
functions to accept complex-valued inputs. It was working great for some time, but recently stopped.
The problem seems to be this line: A.view(np.float64).ctypes
, which used to work but now results in the following error:
Stack Trace
ValueError Traceback (most recent call last)
Cell In[822], line 128
124 a = np.array([[5.4, 4, 7.7],[3.5, -0.7, 2.8],[-3.2, 5.1, 0.8]],
125 dtype=np.complex128, order='F') # NOTE F order
127 assert a.flags['F_CONTIGUOUS']
--> 128 A, VS = numba_zgees(np.copy(a)) # input is written to so copy on way in
129 print(A.real)
130 print(VS.real)
File ~/mambaforge/envs/cge-dev/lib/python3.11/site-packages/numba/np/arrayobj.py:2684, in impl()
2681 if (p1 and p2 and p3):
2682 msg2 = ("To change to a dtype of a different size, the last "
2683 "axis must be contiguous")
-> 2684 raise ValueError(msg2)
2686 if dtype_size < a.itemsize:
2687 if dtype_size == 0 or a.itemsize % dtype_size != 0:
ValueError: To change to a dtype of a different size, the last axis must be contiguous
I tried every sort of np.asx
function, and checked that all inputs had the correct flags (assert A.flags['F_CONTIGUOUS']
passes on the way into the function, for example), but I’m stumped on how to proceed.
Is there a simple way to get this working again that I’m missing?