[Numpy-discussion] swig numpy2carray converters  Bill Spotz
wfspotz@sandia.... Tue Nov 20 16:20:11 CST 2007  something like
PyObject * getMatrix() internal matrix */ };          double *
data = /* Obtain the pointer to you internal matrix
return PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE, (void*)
For your function, use the INPLACE_ARRAY2 typemap:  matrix, int
rows, int cols)}; parameter, ...);  And then in python you can
do this:       m = getMatrix()      myFunction(m, 3.14, ...)
However myFunction() alters your internal matrix, it will be
reflected in the array m.  What I don't understand is if double*
matrix is *internal*, why is it   in the argument list?  Does
myFunction() actually allocate the   matrix?  If so, then
getMatrix() won't be able to get access to the   matrix, but
myFunction() is really a factory function or   constructor.  If
this is true, then writing a simple function like   getMatrix()
as a SUBSTITUTE wrapper for myFunction() (i.e., that   calls
myFunction()) is