[SciPy-dev] Which matrix library in C++ for scipy

David Cournapeau david at ar.media.kyoto-u.ac.jp
Thu Apr 26 09:07:13 EDT 2007


Neal Becker wrote:
> David Cournapeau wrote:
>
>>> y, but if there is already something
>>> in scipy, no use to do it again ;)
>> I don't think there is anything like that in scipy. Something which
>> could be useful would be to have a C++ class which reflects a numpy
>> array, for seamless integration between eg boost.python and numpy. But
>> that would be quite a challenge to get it right, I think.
>>
>> David
>
> There is numerical interface in boost::python.
>
> I don't use this approach myself.  Here's why.  I write all basic algorithms
> in c++.  I try to use modern, generic programming when writing them.
Well, I myself try to avoid C++ like the plague :) What I meant was to 
have a C++ class which reflect the numpy array, in a sensible manner. 
For example, "automatic" memory management (at least as automatic as it 
can get in C++), having the member functions of the C class reflected in 
C++. The C api of numpy already defines a class, reflected in python. 
The job would be to do the same in C++. Eg:

dtype  d("float")
narray A((5, 4), d), B((4, 5), d(
narray C()

C = dot(A, B)

Of course, to do it right is difficult and would require someone who 
know both numpy and C++ very well.

David



More information about the SciPy-Dev mailing list