Re: [eigen] cast ArrayXd* to ArrayXXd*

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


On 26.09.2012 14:50, Holger Herrlich wrote:

Hi, did I really have to:

Eigen::ArrayXXd* smInt;
Eigen::ArrayXd*  tmp = fn_create();
smInt = new Eigen::ArrayXXd( *(tmp) );
delete(tmp.arrayXd);

to cast from Array<double,len> to Array<double,len,1> when using pointers?

Well, there are many ways, but it would require a bit more context to find the best way in your case. Quite likely you don't need to use pointers at all (using plain pointers always bears the risk of memory leaks) and I don't know (m)any cases where ArrayXXd is accepted but ArrayXd is not (meaning I don't see why you need this cast).

Christoph



--
----------------------------------------------
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+ http://listengine.tuxfamily.org/