[Numpy-discussion] swig numpy2carray converters

Matthieu Brucher matthieu.brucher@gmail....
Tue Nov 20 09:05:13 CST 2007


>
> > If what you want is to provide a view  from your C++ matrix, this is
> > different. You must either :
> > - propose the array interface
> > - use a Python object inside your C++ matrix (this is to be done, I've a
> > basic example in my blog)
>

Of course : http://matt.eifelle.com/item/5
It's a basic version of the wrapper I use in my lab (pay attention to the
constructor for instance), I hope you will be able to do something alike for
your library. If it's not the case, you will have to fall back to the numpy
way : allocating a new array, giving a pointer to the array, using it and
stop using it after the function call is finished (with the wrapper I
propose, you have the array for the life-time of your matrix instead).

Matthieu
-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071120/46267c30/attachment.html 


More information about the Numpy-discussion mailing list