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

rowwise matrix multiplication?

Tags: None
(comma "," separated)
eudoxos
Registered Member
Posts
36
Karma
0

rowwise matrix multiplication?

Mon Jun 20, 2011 9:16 am
Hello,

using eigen 3.0.1, I wanted to compute eigenvectors and multiply each of them with its corresponding eigenvalue, using broadcasting:
Code: Select all
#include<Eigen/Core>
#include<Eigen/Eigenvalues>
using namespace Eigen;
int main(void){
   Matrix3d val;
   SelfAdjointEigenSolver<Matrix3d> eig(val);
   Matrix3d ev=eig.eigenvectors();
   ev.rowwise()*=eig.eigenvalues();
}

but g++ complains
Code: Select all
a.cc:8:32: error: no match for ‘operator*=’ in ‘((Eigen::DenseBase<Eigen::Matrix<double, 3, 3> >*)(& ev))->Eigen::DenseBase<Derived>::rowwise [with Derived = Eigen::Matrix<double, 3, 3>, Eigen::DenseBase<Derived>::RowwiseReturnType = Eigen::VectorwiseOp<Eigen::Matrix<double, 3, 3>, 1>]() *= eig.Eigen::SelfAdjointEigenSolver<_MatrixType>::eigenvalues [with _MatrixType = Eigen::Matrix<double, 3, 3>, Eigen::SelfAdjointEigenSolver<_MatrixType>::RealVectorType = Eigen::Matrix<double, 3, 1>]()’

Can I get some hint as to what is wrong with that code?

Cheers, edx

PS thanks to devs of Eigen, I love it.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: rowwise matrix multiplication?

Mon Jun 20, 2011 1:10 pm
hi, what you want here is a matrix * diagonal matrix product, e.g.:

ev = eig.eigenvalues().asDiagonal() * eig.eigenvectors();


Bookmarks



Who is online

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