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

Raymond de Vries reedev at zonnet.nl
Fri Jul 31 07:51:44 EDT 2009


Hi Matthieu,

Thanks for the explanation. After having looked at the documentation, I 
decided to do my own plain Python c-api implementation.

Thanks for your time
Raymond


Matthieu Brucher wrote:
> 2009/7/30 Raymond de Vries <reedev at 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).
>
> Matthieu
>   




More information about the NumPy-Discussion mailing list