Registered Member
|
Hello,
i have big matrix operations. the matrices are size of ~400x400. I create the matrices with the constructor:
all used matrices are stored in objects like:
the expressions are like:
The size of mx (res, vectorx...) changes sometimes. But not often. How can i speed up the matrix operations? Is this expression optimal? Should i "preallocate" some matrices for the provisional results? Thanks for your help! PS: EIGEN_MAKE_ALIGNED_OPERATOR_NEW results in an error: "Return has value in function returning void". What can id do? |
Registered Member
|
Eigen normally evaluates each matrix product in a temporary in chained matrix products, so you shouldn't have to do much yourself here. if you want to tweak things yourself, the .eval() method allows you to force evaluation at a certain point in the expression.
About EIGEN_MAKE_ALIGNED_OPERATOR_NEW, that doesn't make much sense, where did you put it?
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Moderator
|
you can use parenthesis to change the default priority in chained matrix product. For I see in your expression something like:
A*B*v where v is a vector. It is much faster to write: A*(B*v) Then you can also split the summations over multiple expression, e.g.: res.noalias() = A*B + C*D - s*E*F; becomes: res.noalias() = A*B; res.noalias() += C*D; res.noalias() -= s*E*F; This avoids some temporaries, but don't expect significant speed gain. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]