[Numpy-discussion] (newbie) How can I use NumPy to wrap my C++ class with 2-dimensional arrays?

Matthieu Brucher matthieu.brucher@gmail....
Thu Jul 30 05:57:46 CDT 2009

2009/7/30 Raymond de Vries <reedev@zonnet.nl>:
> Hi
>> Indeed, the solution is as simple as this ;) The trouble is to find
>> the information!
> Yes, there is so much information everywhere. And it's hard to make the
> first steps.
>>>>> For the std::vector<>[], I suggest you convert it to a single vector,
>>>>> as the data inside this "array" is not contiguous and it can thus be
>>>>> cumbersome to create a Numpy array from that.
> I am now ready to do this. To be certain, 'contiguous' means that the
> std::vector<>'s are not the same length, right? Would that mean that I'd
> better use a tuple of lists or so? (or list of lists or so).
> thanks for your time
> Raymond

Contiguous means that the whole data is in one big chunk. If it is
not, you have to rely on other Numpy functions (I don't know all of
them, perhaps you will find one that satisfies your need), and the
data may then be copied (not sure though).

Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher

More information about the NumPy-Discussion mailing list