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

Row-wise matrix product

Tags: None
(comma "," separated)
MarkoFranko
Registered Member
Posts
11
Karma
0
OS

Row-wise matrix product  Topic is solved

Tue Sep 13, 2011 4:03 pm
Hello!
How can I multiply matrizes with vectors row-wise?
for example:

Mat1=
a11, a12
a21, a12
a31, a31

Mat2=
b1, b2

Mat1*Mat2=
a11*b1, a12*b2
a21*b1, a12*b2
a31*b1, a31*b2

I know that it is possible to use the for loop, but I hope there is some oprimized eigen function/solution for such a problem.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Row-wise matrix product

Tue Sep 13, 2011 6:22 pm
Mat1 * Mat2.asDiagonal()

and yes this kind of product is optimized and vectorized.
MarkoFranko
Registered Member
Posts
11
Karma
0
OS

Re: Row-wise matrix product

Thu Sep 15, 2011 10:36 am
Thank you ggael! :)

[solved]


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]