[SciPy-user] numpy array in ctype struct
Paul Kienzle
pkienzle at nist.gov
Tue Jan 15 07:07:26 EST 2008
Hi,
We are trying to create the following struct in ctypes:
struct {
int n,k;
double A[4][4], B[4][4];
} ;
Easy enough:
class embedded_array(Structure):
_fields_ = [("n",c_int),("k",c_int),("A",c_double*16),("B",c_double*16)]
instance = embedded_array()
Question:
Is there a way to map the data in A/B into a numpy array, so that we
can use it directly?
Alternatively, is there a way to quickly copy data from a numpy array
into/out of the ctypes structure?
Thanks in advance,
- Paul
More information about the SciPy-User
mailing list