[Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Sep 20 08:01:13 CDT 2007

Alexander Schmolck wrote:
> "Charles R Harris" <charlesr.harris@gmail.com> writes:
>> The automatic handling of pointers for the default allocation type is also
>> convenient and makes it reasonable to have functions return matrices and
>> vectors.
> Hmm, I wonder whether I missed something when I read the manual. I didn't see
> anything in the docs that suggests that ublas matrices do COW, reference
> semantics or anything else to make C++'s horrible pass-by-value semantics
> bearable performancewise, so I return and pass in shared_ptr's to matrices,
> which is syntactically ugly but avoids the need to write a (reference
> semantics) wrapper class for matrix. Am I missing some easier way to
> efficiently return and pass large matrices?
If ublas is using expression template, shouldn't it alleviate somewhat 
this problem ?



More information about the Numpy-discussion mailing list