[Numpy-discussion] Best way to expose std::vector to be used with numpy
Chris Barker
chris.barker at noaa.gov
Wed Oct 15 15:48:48 EDT 2014
Sorry about SWIG -- maybe a chance to move on ;-)
I'd go with Cython -- this is pretty straightforward, and it handles the
buffer protocol for you under the hood.
And with XDress, you can get numpy wrapped std::vector out of the box, I
think:
https://s3.amazonaws.com/xdress/index.html
if you REALLY want to stick with SWIG, take a look a the SWIG numpy
interface files -- they are designed for old-fashioned C, but you could
probably adapt them.
-Chris
On Tue, Oct 14, 2014 at 8:59 AM, Toby St Clere Smithe <mail at tsmithe.net>
wrote:
> John Zwinck <jzwinck at gmail.com> writes:
> > Some time ago I needed to do something similar. I fused the NumPy C
> > API and Boost.Python with a small bit of code which I then
> > open-sourced as part of a slightly larger library. The most relevant
> > part for you is here:
> > https://github.com/jzwinck/pccl/blob/master/NumPyArray.hpp
>
> There is also a 'Boost.NumPy', which is quite nice, though perhaps a bit
> heavy-duty:
>
> https://github.com/ndarray/Boost.NumPy/
>
> Cheers,
>
>
> Toby
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141015/c2a2da87/attachment.html>
More information about the NumPy-Discussion
mailing list