Several numpy arrays with SWIG
Posted
by Petter
on Stack Overflow
See other posts from Stack Overflow
or by Petter
Published on 2010-04-20T09:48:46Z
Indexed on
2010/04/20
9:53 UTC
Read the original article
Hit count: 371
I am using SWIG to pass numpy arrays from Python to C++ code:
%include "numpy.i"
%init %{
import_array();
%}
%apply (float* INPLACE_ARRAY1, int DIM1) {(float* data, int n)};
class Class
{
public:
void test(float* data, int n)
{
//...
}
};
and in Python:
c = Class()
a = zeros(5)
c.test(a)
This works, but how can I pass multiple numpy arrays to the same function?
© Stack Overflow or respective owner