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

Problems using Eigen unsupported .pow() function

Tags: None
(comma "," separated)
timsch
Registered Member
Posts
2
Karma
0
Dear all,

I am trying to use the eigen package and more specifically the unsupported matrix functions to compute the power of a matrix.
When I compile the follwoing example from here, I get the compilation error:
Eigen::Matrix4d’ has no member named ‘pow’

This is the example:

#include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
int main()
{
Eigen::Matrix4d A;
A << 0, 0, 2, 3,
0, 0, 4, 5,
0, 0, 6, 7,
0, 0, 8, 9;
std::cout << A.pow(0.37) << std::endl;
// The 1 makes eigenvalue 0 non-semisimple.
A.coeffRef(0, 1) = 1;
// This fails if EIGEN_NO_DEBUG is undefined.
std::cout << A.pow(0.37) << std::endl;
return 0;
}

It is totally weird that most of the other functions from the unsupported section work for me, like .sinh(), .cosh() and .exp(). Only the pow and the log functions don't work. Does anyone have an idea?

I have already tried to use older version of Eigen and also the latest version but the problem remains the same. I am using the compiler gcc, version 4.6 in Ubuntu 12.

Thank you very much in advance!

Greetings,

Tim
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Works for me with Eigen 3.2.4 and devel branch. I did not tried older version.
timsch
Registered Member
Posts
2
Karma
0
Hi,

thank you very much for trying!
My colleague has also tried it and for him, the function works fine as well!

In the meanwhile, I have updated my gcc version to 4.8.1 but it didn't help.
It seems that there is a porblem with the software configuration on my PC since the same code wokrs for others but not for me.

I will avoid the .pow() function now by multiplying the matrix by itself several times in a loop.

Thanks again and greetings,

Tim
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Perhaps updating Eigen will do. And make you use the updated one, and not an old version installed by the system.


Bookmarks



Who is online

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