On 01/01/15 19:30, Sturla Molden wrote:
> You can pretend double** is an array of dtype np.intp. This is because
> on all modern systems, double** has the size of void*, and np.intp is an
> integer with the size of void* (np.intp maps to Py_intptr_t).
Well, it also requires that the user space is the lower half of the
address space, which is usually true.
But to be safe against this you should use np.uintp instead of np.intp:
xpp = (x.__array_interface__['data'][0]
+ np.arange(x.shape[0])*x.strides[0]).astype(np.uintp)
doublepp = np.ctypeslib.ndpointer(dtype=np.uintp)
Sturla
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion