[Numpy-discussion] Best way to expose std::vector to be used with numpy
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
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.
On Tue, Oct 14, 2014 at 8:59 AM, Toby St Clere Smithe <mail at tsmithe.net>
> 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
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
Christopher Barker, Ph.D.
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...
More information about the NumPy-Discussion