[Numpy-discussion] creating/working NumPy-ndarrays in C++

Jim Bosch talljimbo@gmail....
Tue Apr 3 12:33:13 CDT 2012


On 04/03/2012 12:48 PM, Chris Barker wrote:
> On Tue, Apr 3, 2012 at 6:06 AM, Holger Herrlich
>
<snip>
>> I know of
>> boost.python so far.
>
> I've never used boost.python, but it's always seemed to me to be kind
> of heavy weight and not all that well maintained [1]
>
>   -- but don't take my word for it!
>
> (there are boost arrays that may be useful)
>
> -Chris
>
> [1] from what seems to be the most recent docs:
>
> http://www.boost.org/doc/libs/1_49_0/libs/python/doc/v2/numeric.html
>
> """
> Provides access to the array types of Numerical Python's Numeric and
> NumArray modules.
> """
>
> The days of Numeric an Numarray are long gone! It may only be the docs
> that are that our of date, but....
>
>

I'm a big fan of Boost.Python, and I'd strongly recommend it over SWIG 
if you have anything remotely complex in your C++ (though I don't know 
much about Cython, and it may well be better in this case).

That said, it's also very true that Boost.Python hasn't seen much in the 
way of active development aside from bug and compatibility fixes for 
years.  So the Numeric interface in the Boost.Python main library is 
indeed way out of date, and not very useful.

But there is a very nice extension library in the Boost Sandbox:

https://svn.boost.org/svn/boost/sandbox/numpy/

or (equivalently) on GitHub:

https://github.com/ndarray/Boost.NumPy

Disclosure: I'm the main author.  And while we've put a lot of effort 
into making this work well and I use it quite a bit myself, it's not 
nearly as battle-tested (especially on non-Unix platforms) as many of 
the alternatives.

Good luck!

Jim


More information about the NumPy-Discussion mailing list