[C++-sig] numpy.int32 -> double?

Ger van Diepen diepen at astron.nl
Sun May 3 16:36:28 CEST 2009

We also had problems with passing numpy scalars to C++ using Boost (1.35 and before). Sometimes it succeeded, sometimes it failed depending on the data type and if your are on a 32-bit or 64-bit system.
AFAIK Boost does not handle numpy scalar data types, so you have to do the conversion yourself. We've written such conversion functions (see pyrap.googlecode.com).

Ger van Diepen

>>> Bruce Sherwood <bruce.sherwood at gmail.com> 04/28/09 7:52 PM >>>
I'm not sure this is the right forum for my question; it's quite possible
that this is a numpy question.

VPython (vpython.org) is the name of Python plus the 3D Visual module, which
is mostly written in C++ and connected to Python using the Boost libraries.
Visual imports numpy.

When I build Visual for Python 2.6 and numpy 1.3.0, I get a failure on
something that works on Python 2.5 with numpy 1.2.1. There is a
vector(double,double,double) class in Visual which now fails if handed
numpy.int32 arguments (works fine with numpy.float64 arguments). I was using
Boost 1.35 with Python 2.5 and am using Boost 1.38 with Python 2.6.

Any ideas or suggestions? Thanks.

Bruce Sherwood

More information about the Cplusplus-sig mailing list