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

Scalar to Vector Multiplication

Tags: None
(comma "," separated)
Blu
Registered Member
Posts
2
Karma
0

Scalar to Vector Multiplication

Sat Jul 28, 2012 6:49 am
Hello,

I am new to Eigen and need some help regarding an operation that looks like this:

(x.transpose()*y)*z
where x, y and z are all same size vectors.

The idea is that (x.transpose()*y) will turn out to be a scalar which will be then multiplied with vector z. Apparently Eigen3 library does not allow me to do this. I assume that the library only allows multiplication of a scalar to a vector if the scalar is represented as a double/int etc and not as a size 1 VectorXd.

I do know that mapping (x.transpose()*y) to a double will solve this but I believe there would be simpler and neater solutions that I don't know of.

Can anyone tell me of a good approach to this problem?

Thanks in advance
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Scalar to Vector Multiplication

Sat Jul 28, 2012 10:52 am
x.transpose()*y has to be a 1x1 matrix. You do either:

double(x.transpose()*y) * z

(x.transpose()*y)(0) * z

x.dot(y) * z


Bookmarks



Who is online

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