Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case

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


Hi,

 auto T = L*U.real().transpose();

This will store Eigen's temporary expression object in T, not the
result of the calculation. This means that here:

 Y.row(n) = T*(M.row(n) - mu);

T has to be evaluated again and again.

If you evaluate it explicitly instead of using auto, like:

Eigen::MatrixXd T = L*U.real().transpose();

the code should run quite a bit faster.

There has been a proposal for 'operator auto' in C++ because of this,
but there doesn't seem to be enough traction for it. OTOH, Gael said
earlier [1] that once bug #99 is finally fully done, you will be able
to do something like

auto foo = (L*U.real().transpose()).eval();

Regards,
Christian

[1] http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2013/11/msg00047.html




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