Adding numpy support to boost::python

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding numpy support to boost::python

Neal Becker
Has anyone tried yet adding numpy support to boost::python?  Is the only
requirement to add "numpy" to load function, or are there more extensive
API changes from numarray to numpy?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding numpy support to boost::python

Phil Austin
Neal Becker writes:
 > Has anyone tried yet adding numpy support to boost::python?  Is the only
 > requirement to add "numpy" to load function, or are there more extensive
 > API changes from numarray to numpy?

The only real problem I've encountered is handling the new type
object. e.g.:

    >>> check(y.typecode());

in boost_1_33_1/libs/python/test/numpy.py will fail  because
the character id returned by
y.typecode() has been replaced by a new dtype object:

In [19]:import numpy as np

In [20]:npArray=np.zeros(5)

In [21]:print npArray.typecode()
---------------------------------------------------------------------------
exceptions.AttributeError                            Traceback (most recent call last)

/nfs/kite/users/phil/<ipython console>

AttributeError: 'numpy.ndarray' object has no attribute 'typecode'

In [22]:print npArray.dtype
'<i4'

In [23]:print npArray.dtype.name
int32

In [24]:print npArray.dtype.num
7








_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding numpy support to boost::python

David Abrahams
In reply to this post by Neal Becker
Neal Becker <[hidden email]> writes:

> Has anyone tried yet adding numpy support to boost::python?  Is the only
> requirement to add "numpy" to load function, or are there more extensive
> API changes from numarray to numpy?

I don't know what you mean.  NumPy is already supported, such as it
is.

--
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding numpy support to boost::python

Phil Austin
David Abrahams writes:
 > Neal Becker <[hidden email]> writes:
 >
 > > Has anyone tried yet adding numpy support to boost::python?  Is the only
 > > requirement to add "numpy" to load function, or are there more extensive
 > > API changes from numarray to numpy?
 >
 > I don't know what you mean.  NumPy is already supported, such as it
 > is.

He's referring to http://numeric.scipy.org, the merged replacement for
Numeric and numarray, which is the new core for http://www.scipy.org.
The current version is 0.9.5, it's a couple months away from version 1.0.

best, Phil

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost