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

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

*To*: <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case*From*: <Thijs.Kooi@xxxxxxxxxxxxx>*Date*: Mon, 16 Jun 2014 13:14:17 +0000*Accept-language*: en-GB, nl-NL, en-US*Authentication-results*: spf=pass (sender IP is 131.174.165.21) smtp.mailfrom=Thijs.Kooi@xxxxxxxxxxxxx;*Thread-index*: Ac+JZF5xyLo36AFbSvWK23ge7DaTGg==*Thread-topic*: Matrix multiplication seems to be exceptionally slow in one specific case

Hi,
I am trying to implement a whitening transform using Eigen3, but I find that one of the matrix operations is extremely slow and I can't understand why.. Below is the code: MatrixXd M = convertToEigen(data); MatrixXd mu = M.rowwise() - M.colwise().mean(); MatrixXd S = (mu.adjoint()*mu)/double(M.rows()); EigenSolver<MatrixXd> es(S, true); auto V(es.eigenvalues()); auto U(es.eigenvectors()); V = V.cwiseSqrt().asDiagonal(); MatrixXd L(S.rows(), S.cols()); for(size_t d = 0; d < L.rows(); d++) L(d, d) = 1./real(L(d, d)); MatrixXd Y(M.rows(), M.cols()); auto T = L*U.real().transpose(); for(size_t n = 0; n < M.rows(); n++) { Y.row(n) = T*(M.row(n) - mu); } Y = Y.transpose(); I clocked some of the operations and find that the T*() inside the for-loop is the bottle neck, which takes about 0.047688 seconds on a 4th generation intel i7 and about the same time as the eigenvalue decomposition, which takes 0.049989 seconds, so that can't be right. M is a 12498 x 225 matrix, so T is 225 x 225 and so is mu. I am running Kubuntu 14.04, Eigen 3.2.0-8, which is in the repositories and all optimisation flags are turned on. Does anybody know what the problem is? Best regards, Thijs Het Radboudumc staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629. |

**Follow-Ups**:**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case***From:*Christian Seiler

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

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

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] [WIP] Power iteration algorithm** - Next by Date:
**Re: [eigen] [Review] Pull request 66, Huge Tensor module improvements** - Previous by thread:
**Re: [eigen] Sparse Matrix Block Insertion** - Next by thread:
**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case**

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