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

left matrix-vector multiplication

Tags: None
(comma "," separated)
Scolohofo
Registered Member
Posts
8
Karma
0
OS

left matrix-vector multiplication

Thu May 26, 2011 8:59 pm
Hello world!

How can i get a left matrix-vector multiplication using eigen?
graphicsMan
Registered Member
Posts
16
Karma
0
OS
Do you mean M*V or V*M?

You need to obey the way that matrix multiplication works; Eigen vectors are simply matrices with one row or one column.

Matrix<float, 1, 3> V1;
Matrix<float, 3, 1> V2;
Matrix<float, 3, 3> M;

Allows you to say

float f = V1 * M * V2;
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
to complete the answer, you might also need .transpose() to transform a column vector to a row one:

Matrix<float, 3, 1> V2;
Matrix<float, 3, 3> M;

V2.transpose() * M
Scolohofo
Registered Member
Posts
8
Karma
0
OS
Thanx :)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar