This forum has been archived. All content is frozen. Please use KDE Discuss instead.

can I take element by element multiply by Eigen?

Tags: None
(comma "," separated)
silent_missile
Registered Member
Posts
7
Karma
0
OS
I read the tutorial, but I couldn't find element by element multiply and divide, I need a simple function just like .* or ./ in Matlab or Octave, this function means multiply two same size matrix element by element

Can any one tell me how to manipulate it?
jitseniesen
Registered Member
Posts
204
Karma
2
If mat1 and mat2 are of type Matrix, you can do either mat1.cwiseProduct(mat2) to get the component-wise product. Similarly, mat1.cwiseQuotient(mat2) gives component-wise division.

If arr1 and arr2 are of type Array, you can simply do arr1 * arr2 and arr1 / arr2.

I think "Tutorial page 3 - The Array class and coefficient-wise operations" at http://eigen.tuxfamily.org/dox-devel/Tu ... Class.html explains all this.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell