[C++-sig] Status of Numpy support in boost python - II

Jim Bosch talljimbo at gmail.com
Tue Jan 4 00:12:43 CET 2011

On 01/03/2011 01:44 PM, Ralf W. Grosse-Kunstleve wrote:
> ----- Original Message ----
>> From: Neal Becker<ndbecker2 at gmail.com>
>> To: cplusplus-sig at python.org
>> Sent: Mon, January 3, 2011 12:31:36 PM
>> Subject: [C++-sig] Status of Numpy support in boost python - II
>> I was just re-reading these posts: Status of Numpy support in boost  python
>> http://web.archiveorange.com/archive/v/YJlerznoeRShLhlurQzC
>> I  wonder if there are any updates?

My low-level numpy library (basically a Boost.Python wrapper for the 
Numpy C-API) has received slow but steady updates.  This is similar to 
the built-in Boost.Python numpy support, with a few extra features:
  - Raw-pointer access to Numpy arrays.
  - Constructing Numpy arrays from raw C++ pointers.
  - A C++ dtype object.
  - Tools to wrap C++ functors to behave like broadcasting numpy 
universal functions.

This can be found in the boost sandbox:


I have also built Boost.Python converters for my own ndarray library 
(see below) and Eigen 2.  Right now the build system (scons-based) is 
tailored to my own needs, but it should be pretty easy for others to 
tweak as needed.  Feel free to email me if you need help.

I've included all of those in the ndarray package, though it should be 
possible to separate out the eigen bits and not use ndarray if you'd 
like.  All that's here:


>> Is ndarray working with current (1.45.0)  boost?

Probably.  I haven't tested 1.45, I compiled recently on 1.44.  I have 
been doing most of my work using 1.40, but I don't think anything has 
changed in Boost.Python since then that would affect ndarray.

> Boost.Python's existing numpy array support has been working all the time. It
> sounds like you are expecting new functionality. Could you be more specific?

<what Stefan Seefeld said>

I think the low-level API I have in the sandbox fits this need, or at 
least provides some of the basics.  I'd love to see that morph into 
something that we can all use to connect numpy to the C++ template 
library of our choice, since we'll all never agreed on those.


More information about the Cplusplus-sig mailing list