[Numpy-discussion] Pass 2d ndarray into C **double using ctypes

Yuxiang Wang yw5aj at virginia.edu
Thu Jan 1 13:00:00 EST 2015


Dear all,

I am currently using a piece of C code, where one of the input
argument of a function is **double.

So, in numpy, I tried np.ctypeslib.ndpointer(ctypes.c_double), but
obviously this wouldn't work because this is only *double, not
**double.

Then I tried np.ctypeslib.ndpointer(np.ctypeslib.ndpointer(ctypes.c_double)),
but this didn't work either because it says "ArgumentError: argument
4: <class 'TypeError'>: array must have data type uint64
".

np.ctypeslib.ndpointer(ctypes.c_double, ndim=2) wound't work too,
because **double is not the same with *double[].

Could anyone please give any thoughts to help?

Thanks,

Shawn
-- 
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
yw5aj at virginia.edu
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/



More information about the NumPy-Discussion mailing list