[C++-sig] datastructure to numpy and back

Matthieu Brucher matthieu.brucher at gmail.com
Tue Oct 16 17:55:00 CEST 2007


Hi,

I've written a swig wrapper around a structure that could be used for
wrapping anything that needs to expose the __array_struct__ property (didn't
had the time to try Boost with Albert's wrappers). It is not available on
the net, but it is based on some mails that were sent here and on the Pyrex
example for the array interface.

Matthieu

2007/10/16, Georg Holzmann <grh at mur.at>:
>
> Hallo again !
>
> I still did not get it working with boost (after quite some reading and
> searching) ... aren't there any examples out there how to do that ?
>
> Or maybe is it better to use SWIG or directly the NumPy C-API for that ?
>
> Thanks,
> LG
> Georg
>
> Georg Holzmann schrieb:
> > Hallo!
> >
> > I know this was discussed quite some times, but I did find that many
> > workarounds and not really a common way how to do that with Boost.Python
> > ... so I am a little bit confused ...
> >
> > My problem: I have a class with some (big) custom C++ matrix types and I
> > want to write some getters/setters for them to/from numpy arrays, where
> > I want to avoid copies of the data.
> >
> > So is there a common way to do this ?
> > (e.g. num_util from
> >
> http://www.eos.ubc.ca/research/clouds/software/pythonlibs/num_util/num_util_release2/Readme.html
> > ?)
> >
> > Or can maybe someone link me to some docu or examples which already did
> > this ? (it must be quite common ...)
> >
> > Many thanks for any hint,
> > LG
> > Georg
> > _______________________________________________
> > C++-sig mailing list
> > C++-sig at python.org
> > http://mail.python.org/mailman/listinfo/c++-sig
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20071016/1402f28a/attachment.htm>


More information about the Cplusplus-sig mailing list