[Numpy-discussion] python numpy code many times slower than c++

Neal Becker ndbecker2 at gmail.com
Wed Jan 21 07:27:04 EST 2009


T J wrote:

> On Tue, Jan 20, 2009 at 6:57 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
>> It seems the big chunks of time are used in data conversion between numpy
>> and my own vectors classes.  Mine are wrappers around boost::ublas.  The
>> conversion must be falling back on a very inefficient method since there
>> is no special code to handle numpy vectors.
>>
>> Not sure what is the best solution.  It would be _great_ if I could make
>> boost::python objects that export a buffer interface, but I have
>> absolutely no idea how to do this (and so far noone else has volunteered
>> any info on this).
>>
> 
> I'm not sure if I've understood everything here, but I think that
> pyublas provides exactly what you need.
> 
> http://tiker.net/doc/pyublas/

It might if I had used this for all of my c++ code, but I have a big library 
of c++ wrapped code that doesn't use pyublas.  Pyublas takes numpy objects 
from python and allows the use of c++ ublas on it (without conversion).

Most of my code doesn't use numpy, it uses plain ublas to represent vectors, 
and ublas handles storage.  I can only interface to/from numpy with 
conversion.

I'm interested in pyublas, but devel seems very quiet for a while.





More information about the NumPy-Discussion mailing list