Re: [eigen] Passing Eigen::Map types to functions that take Eigen types

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


On 01.07.2015 14:25, Martin Felis wrote:
Is there any way to avoid this to allow for thin wrappers à la do_work_ptr?

Have a look at the Ref class:
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1Ref.html

Your function should look like this then
void do_work(Eigen::Ref<Eigen::MatrixXd> mat) {
  // remaining code stays the same
}

You can then pass MatrixXd, Maps and Blocks with very minor overhead to your function.

Christoph


--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. 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/