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

A little question of Martix and Vector

Tags: None
(comma "," separated)
burnessduan
Registered Member
Posts
3
Karma
0
Suppose I have a Matrix
[[1,2,3],
[2,3,4]]

a vector = [2,3]

Anyone could help me to use the eigen get the result
[[1*2,2*2,3*2],
[2*3, 3*3, 4*3]]

?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You can either use broadcasting:

mat.array().colwise() * vec.array()

or (better) observe that all you want is a scaling:

vec.asDiagonal() * mat


Bookmarks



Who is online

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