Re: [eigen] cast ArrayXd* to ArrayXXd*

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi, i eventually choose to use parameter by reference instead of
allocating myself. Besides that this is (marginally) faster than return
values and it matches on overloading. Also guess it's kinda state of the
art in C++.

Python:
I will not direct access the methods but copy into a NumPy-Array such
that the values are owned by Python. However that wasn't clear at the
beginning. Cause of that I avoided "call by reference" guessing to have
to create the array previously at Python.

Thanks Holger


On 10/02/2012 11:35 PM, Christoph Hertzberg wrote:
> On 26.09.2012 18:48, Holger Herrlich wrote:
>>
>>
>> I finally needed it to run this: (and can avoid casting)
>> a1_2D->colwise() = *a1_1D;
>> *a2_2D = a2_2D->binaryExpr( *a1_2D, ptr_fun<double,double,double>(fn));
>>
>> Well, I choose to use "new" because I don't know the array size at
>> calling the function. Also avoided the call by reference parameter while
>> it was not that clear how the interface to python looks like later on.
> 
> There is a resize(rows, cols) method and instead of returning a pointer,
> you can return an ArrayXd by value and hope for good-enough RVO (return
> value optimization).
> If you need the pointer interface, because of Python, I'm afraid I can't
> help much ...
> 
> 
> 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/