[C++-sig] more examples of automatic type conversion

Eric Jonas jonas at MIT.EDU
Wed May 2 19:31:44 CEST 2007

> I'm very interested in interfacing various c++ array containers to numpy. 
> Do you have any small examples?

I think we all are, and the existing numpy/numeric interface is getting
a bit crufty, and the new numpy type module is somewhat complex :) one
thing I'm struggling with is my poor understanding of python's internal
memory management and the like. I'll hopefully have the automatic type
conversion working in a day or two, and I'll be sure to post my results
to the list. I'm not trying to do anything fancy like the
numeric/numarray stuff currently in boost; I just want functions that
take in const boost::multi_array<T, n> & to handle the conversion for
me. I want to mostly use my python as a scripting interface on top of
some number-crunching C++ monte-carlo code. 

Interesting questions include:   What sort of containers do we use?
Boost::array? Boost::multiarray? The ublas containers? all of them? Just
std::vector< std::vector (...) How do we handle the static typing

I also can't promise that I've written anything other than an app that
leaks memory like a submarine with a screen door. C++'s notion of
"ownership" is so simple compared to python. 

More information about the Cplusplus-sig mailing list