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

selfadjointView scalar multiplication

Tags: None
(comma "," separated)
User avatar
sapien2
Registered Member
Posts
4
Karma
0
OS
Trying to compile following code using VC 2010:
Code: Select all
#include <iostream>
#include <Eigen/Core>

int main()
{
   Eigen::Matrix3d m1;
   double s1 = 2.0;

   Eigen::Matrix3d m2 = s1 * m1.selfadjointView<Eigen::Upper>();

   std::cout << m2 << std::endl;

   return 0;
}

And getting an error about no operator found
Code: Select all
d:\myprogram\exp\eigen\eigenexp.cpp(9): error C2679: binary '*' : no operator found which takes a right-hand operand of type 'Eigen::SelfAdjointView<MatrixType,UpLo>' (or there is no acceptable conversion)

What is going wrong? Is selfadjointView supports scalar multiplication? According to http://eigen.tuxfamily.org/dox/QuickRefPage.html it is.

Last edited by sapien2 on Thu Nov 29, 2012 3:15 pm, edited 1 time in total.
User avatar
sapien2
Registered Member
Posts
4
Karma
0
OS
Same error with gcc 4.7.2 from http://nuwen.net/mingw.html
Code: Select all
eigenExp.cpp:9:61: error: no match for 'operator*' in 's1 * ((Eigen::MatrixBase<Eigen::Matrix<double, 3, 3> >*)(& m1))->Eigen::MatrixBase<Derived>::selfadjointView<2u>()'
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This is not supported, instead do:

Eigen::Matrix3d m2 = (s1 * m1).selfadjointView<Eigen::Upper>();
User avatar
sapien2
Registered Member
Posts
4
Karma
0
OS

Thu Nov 29, 2012 3:45 pm
ggael, thank you for your answers.


Bookmarks



Who is online

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