Re: [eigen] cast ArrayXd* to ArrayXXd*

[ Thread Index | Date Index | More Archives ]

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 ...

Dipl.-Inf. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252

Mail converted by MHonArc 2.6.19+