[Numpy-discussion] Global Numpy vector with Swig
Andrea Tomadin
tom.and@tiscalinet...
Thu Feb 15 02:18:48 CST 2007
Hi,
I need to pass a Numpy array to a C code wrapped by Swig.
The array in the C code is a global variable declared as
double *vec
and I would like to set it in the calling Python module foo using e.g.
foo.cvar.vec = numpy.zeros(10)
so that the array is manipulated in place.
I found out the examples in the numpy/doc/swig dir and adapted them
to my code, so now I can pass a Numpy array to a function. But in the
examples
I was not able to recognize any suggestion (any typedef?) to
translate an array into a
variable. I'm just writing an intermediate function that does the job,
but I feel like writing a wrapping function that will be wrapped
again by Swig...
Any practical example is highly appreciated!
Regards,
Andrea
More information about the Numpy-discussion
mailing list