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

Eigein::Matrix modulus fails

Tags: None
(comma "," separated)
sylvainrousseau
Registered Member
Posts
7
Karma
0

Eigein::Matrix modulus fails

Wed Nov 20, 2019 12:25 pm
HI !

I implemented the modulus of a matrix as this, but it fails to compile :

Code: Select all
const double dPI = std::acos( double(-1.) );
using baseSpaceVd = Matrix<double, 4, 1>;
baseSpaceVd  M(0,1,2,3);

M = M.unaryExpr( []( const baseSpaceVd::Scalar x ) { return x%(2*dPI); } );


Compilation error message is :

Code: Select all
../src/COpdCtrl.cpp: In lambda function:
../src/COpdCtrl.cpp:187:85: error: invalid operands of types ‘const Scalar {aka const double}’ and ‘double’ to binary ‘operator%’
   curGDerr = curGDerr.unaryExpr( []( const baseSpaceVd::Scalar x ) { return x%(2*dPI); } );


This fix works but I'am afraid it degrades the perfs :
Code: Select all
M = M.unaryExpr( []( const baseSpaceVd::Scalar x ) { return fmod( x, (2*dPI); } );


Thanks for your help.

Sylvain


Bookmarks



Who is online

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