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

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


That seems to fix it, thanks a lot. I wasn't aware of this behaviour of 'auto', sorry.

Best,
Thijs
________________________________________
From: Christian Seiler [christian@xxxxxxxx]
Sent: 16 June 2014 15:35
To: eigen@xxxxxxxxxxxxxxxxxxx
Cc: Kooi, Thijs
Subject: Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case

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

Het Radboudumc staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629.
The Radboud university medical center is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.



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