Registered Member
|
Let's say you have an (m x n) matrix M and a vector V of length n, and you want to multiply each row of M by the values in V, elementwise. With broadcasting, you would write:
Mathematically, you could also treat V as a square, diagonal matrix and right-multiply it, and this should achieve the same thing:
Is there a functional difference between these two? Do they generate the same code? Cheers Leo |
Registered Member
|
means
which is functionally equivalent to
If you want rowwise, you have to put the diagonal on the left:
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]