Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-15 Thread V. Armando Sole
On 15.10.2014 21:48, Chris Barker wrote: > 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. > +1 All the standard containers are automatically wrapped and C++ exceptions can

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-15 Thread Chris Barker
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 RE

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread Toby St Clere Smithe
John Zwinck 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/NumP

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread Daniele Nicolodi
On 14/10/14 14:11, Daniele Nicolodi wrote: > On 14/10/14 13:39, Nathaniel Smith wrote: >> If the goal is to have something that works kind of like the new buffer >> protocol but with a wider variety of python versions, then you might >> find the old array interface useful: >> http://docs.scipy.org/

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread John Zwinck
On Tue, Oct 14, 2014 at 6:19 PM, Daniele Nicolodi wrote: >> On Mo, 2014-10-13 at 13:35 +0200, Daniele Nicolodi wrote: >> > I have a C++ application that collects float, int or complex data in a >> > possibly quite large std::vector. The application has some SWIG >> > generated pyth

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread Daniele Nicolodi
On 14/10/14 13:39, Nathaniel Smith wrote: > If the goal is to have something that works kind of like the new buffer > protocol but with a wider variety of python versions, then you might > find the old array interface useful: > http://docs.scipy.org/doc/numpy/reference/arrays.interface.html > > I

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread Nathaniel Smith
If the goal is to have something that works kind of like the new buffer protocol but with a wider variety of python versions, then you might find the old array interface useful: http://docs.scipy.org/doc/numpy/reference/arrays.interface.html I always get confused by the history here but I believe

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread Daniele Nicolodi
On 14/10/14 04:39, Charles R Harris wrote: > On Mon, Oct 13, 2014 at 12:54 PM, Sebastian Berg > mailto:sebast...@sipsolutions.net>> wrote: > > On Mo, 2014-10-13 at 13:35 +0200, Daniele Nicolodi wrote: > > Hello, > > > > I have a C++ application that collects float, int or complex d

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-14 Thread Stefan Seefeld
On Oct 14, 2014 4:40 AM, "Charles R Harris" wrote: > > > > On Mon, Oct 13, 2014 at 12:54 PM, Sebastian Berg < sebast...@sipsolutions.net> wrote: >> >> On Mo, 2014-10-13 at 13:35 +0200, Daniele Nicolodi wrote: >> > Hello, >> > >> > I have a C++ application that collects float, int or complex data i

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-13 Thread Ian Henriksen
On Mon, Oct 13, 2014 at 8:39 PM, Charles R Harris wrote: > > > On Mon, Oct 13, 2014 at 12:54 PM, Sebastian Berg < > sebast...@sipsolutions.net> wrote: > >> On Mo, 2014-10-13 at 13:35 +0200, Daniele Nicolodi wrote: >> > Hello, >> > >> > I have a C++ application that collects float, int or complex

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-13 Thread Charles R Harris
On Mon, Oct 13, 2014 at 12:54 PM, Sebastian Berg wrote: > On Mo, 2014-10-13 at 13:35 +0200, Daniele Nicolodi wrote: > > Hello, > > > > I have a C++ application that collects float, int or complex data in a > > possibly quite large std::vector. The application has some SWIG > > generated python wr

Re: [Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-13 Thread Sebastian Berg
On Mo, 2014-10-13 at 13:35 +0200, Daniele Nicolodi wrote: > Hello, > > I have a C++ application that collects float, int or complex data in a > possibly quite large std::vector. The application has some SWIG > generated python wrappers that expose this vector to python. However, > the standard way

[Numpy-discussion] Best way to expose std::vector to be used with numpy

2014-10-13 Thread Daniele Nicolodi
Hello, I have a C++ application that collects float, int or complex data in a possibly quite large std::vector. The application has some SWIG generated python wrappers that expose this vector to python. However, the standard way in which SWIG exposes the data is to create a touple and pass this to