[Numpy-discussion] access ndarray in C++

Ravi lists_ravi@lavabit....
Wed Dec 10 10:28:29 CST 2008

On Wednesday 23 April 2008 15:48:23 Christopher Barker wrote:
> > - Boost Python [1]. Especially if you want usable C++ integration. (ie.
> > more than basic templates, etc.)
> What's the status of the Boost array object? maintained? updated for
> recent numpy?

The boost.python array object is still maintained. However, it has a few 

1. All array operations go through python which makes it too slow for my 
purposes. Phil Austin posted an alternate class on this list which works well 
since it uses the numpy C API:

2. Only numeric & numarray are supported out of the box, but it is simple to 
support numpy; just add the following after calling import_array in your 
extension module:
  boost::python::numeric::array::set_module_and_type( "numpy", "ndarray" );

3. If you want the C++-way of dealing with numpy matrices & vectors directly 
as objects look at either of the following:
Of course, I am biased towards the first approach.


More information about the Numpy-discussion mailing list