Registered Member
|
Hi,
I am trying to transform each element of matrix A using a function f. Is this the efficient way to do so?
When reading Eigen documentation, I am also confused by unaryExpr unaryViewExpr? (as in this page: http://eigen.tuxfamily.org/dox-devel/classEigen_1_1MatrixBase.html#a2be175e189ac4baa01736f9a4c5a9bc4) What are the difference scenarios of using them respectively? Thanks. |
Moderator
|
yes, your syntax is good. The operator f will be applied in-place. unaryViewExpr is for read/write operators, i.e., the functor must return a reference. It is used for instance to implement real() and imag().
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]