Eigen3: in-place multiplication factor
1 answer
Both expressions should generate the same code (with a sensibly optimizing compiler), so this is more of a matter of taste.
If you are doing mostly rudimentary operations with a
and b
, you should declare them as Eigen::Array
(instead of Eigen::Matrix
) and just write a*=b;
. If you need access to a
or b
in matrix form later, you can still use a.matrix()
.
+1
source to share