[Numpy-discussion] Overloading sqrt(5.5)*myvector

Charles R Harris charlesr.harris@gmail....
Wed Dec 26 13:16:58 CST 2007

On Dec 26, 2007 3:49 AM, Gary Ruben <gruben@bigpond.net.au> wrote:

> Sorry this isn't an answer, just noise, but for those here who don't
> know, Bruce is the chief maintainer of the vpython project. I have found
> vpython aka the visual module to be a highly attractive and useful
> module for teaching physics. It would be great if someone with Boost
> experience would try to help him out. I wouldn't want him to get falsely
> disillusioned with this list as I for one have been looking forward to a
> fully numpy-compatible version of vpython.

I think the problem is that few of us are that familiar with boost/python. I
have used it myself, but only for interfacing  C++ classes or accessing
Numpy arrays through their buffer interface. I always avoided the Numeric
machinery because it looked clumsy and inefficient to me, I didn't want an
embedded version of Numeric (Numarray, Numpy), I wanted speed. Anyway, I
think numpy.float64 hides a normal C double, so the slowdown probably comes
from the boost/python machinery. I don't think boost/python was ever updated
to use Numpy in particular and the Numpy data type may be throwing it
through an interpretive loop. The speed of double vs float arithmetic on
Intel hardware is pretty much a wash, so should not show much difference
otherwise. You can get a float32 result from sqrt

In [2]: type(sqrt(float32(5.5)))
Out[2]: <type 'numpy.float32'>

But I suspect it will make little difference, probably what is needed is the
corresponding C/Python data type. I think that information is available
somewhere, but am not sure of the details. Someone else can probably help
you there (Travis?)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071226/8475f2ac/attachment.html 

More information about the Numpy-discussion mailing list