Thanks David, The clarification on apply is actually a important one!
C. On 7/31/12 1:04 PM, "David Froger" <david.fro...@gmail.com> wrote: >Hi, > >> I'm looking at SWIG/numpy tutorials >They are these tutorials: >http://docs.scipy.org/doc/numpy/reference/swig.interface-file.html >http://www.scipy.org/Cookbook/SWIG_NumPy_examples > >Reading numpy.i is also very instructive. > >> 1- How do use "apply" for class functions %apply (bla) myobject::foo ? >%apply is specified on function/method arguments names and types > only, >never on function names. So if for example you use: >%apply (int* ARGOUT_ARRAY1, int DIM1) {(int* rangevec, int n)} >it will apply on every functions that have arguments "int* ARGOUT_ARRAY1, >int DIM1" > >> 2-that's ok if your C++ deals with arrays but what if I actually want >>to receive the Numpy object so that I can manipulate it directly (or if >>for example the array isn't contiguous in memory) >> >> An"dummy"example of foo function I'd like to wrap: >> >> void FOO::fooNumpy(PyArrayObject *nparray) { >> >> int j; >> for(j=0;j<nparray->nd;j++) { >> printf("Ok array dim %i has length: %i\n",j,nparray->dimensions[j]); >> } >> } >I never do it with Swig, will try to make this example works! > >David >_______________________________________________ >NumPy-Discussion mailing list >NumPy-Discussion@scipy.org >http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion