Registered Member
|
Hi,
I have a piece of code which looks like this:
MatrixXf Y(n2, 3); for(int i=0; i<n2; i++) { res = meanValue + k_invQ.at(i).transpose() * correction; Y(i,0) = res(0,0); Y(i,1) = res(0,1); Y(i,2) = res(0,2); } where meanValue is a matrix of size (1, 3), k_invQ is a c std vector containing n2 eigen vectors of dynamic size (give by a variable n1) and correction is a matrix of dynamic size (n1, 3). I would like to accelerate this piece of code. For this, I have substituted the above code by:
VectorXf xx = VectorXf::Ones(n2); Y = xx * meanValue + k_invQ_Matrix * correction; where k_invQ_Matrix is a matrix of dynamic size (n2, n1) containing the same information as the one in k_invQ, but in the form of an eigen library matrix. When I run the latter code, the execution time is much larger. Could you please help me with this? Cheers, Ricardo |
Moderator
|
The following should give you the best performance, but make sure you compiled with optimizations enabled (e.g., -O2 with gcc).
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]