Registered Member
|
Hi,
I'm migrating Eigen2 code to Eigen3. I have an eigen2 based code as this: Matrix4d coeff; Vector4d extents = coeff.cwise().abs() * Vector4d(0.0, 1.0, 1.0, 1.0); I want to translate the above code to Eigen3: Matrix4d coeff; Vector4d extents = ((coeff.array().abs()).matrix()) * (Vector4d(0.0, 1.0, 1.0, 1.0).array().matrix()); Am I did correctly? Jo |
Registered Member
|
This should give the correct result, but it is more complicated than necessary. For the first factor, you can use the .cwiseAbs() function, which also works for matrices. For the second factor, you take a Vector4d, turn it into an array and then back into a matrix; this just give you the matrix you started with. So instead you can write (not tested):
|
Registered Member
|
Thanks, jitseniesen. The removal of cwise() in Eigen3 from Eigen2 has been tricky for non-mathematical programming analysits (like me). If the Eigen2-based code
can be upgraded to Eigen3 code:
I would assume that Eigen2's code like:
can be upgraded to Eigen3's code
jo |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]