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

C++, Help with ComplexEigenSolver of <Eigen/Eigenvalues>

Tags: eigen, c, complexeigensolver eigen, c, complexeigensolver eigen, c, complexeigensolver
(comma "," separated)
agent_smith
Registered Member
Posts
2
Karma
0
Hi all,
im quite new to programming, but got an assignment which involves diagonalizing and calculating the eigenvalues and vectors of a hermitian 8x8 matrices.
In my search I came across Eigen, as a package which should be able to do this for me. While I get the basic gist of how this package works (tried some basic arithmatic with real matrices) I have no idea how to go about my eigenvalues of the complex matrices..
So far, I set up a class for this which looks like this:


Code: Select all
#include "vect.h"
#include <vector>
#include "parameters.h"
#include <complex>
#include <math.h>
#include <Eigen/Eigenvalues>
#include <Eigen/Dense>

typedef std::complex<double> cmp;
typedef std::Eigen::Matrix<cmp, 8, 8> Mcmp;

class hamiltonian{
public:
  hamiltonian(Mcmp pMatrix);
 
  Eigen::ComplexEigenSolver<Mcmp> solver;

  Mcmp m;

  void calc(Mcmp pMatrix);
};

void hamiltonian::calc(Mcmp pMatrix) {
solver.eigenvalues(pMatrix);
}


This is an extract of my "hamiltonian" class, with the part which i dont get.
Due to numerical errors owing to the precision of "double", my matrix wont be strictly hermitian. Can I still calculate its eigenvalues and vectors, and if so, what would be the correct implementation of this ComplexEigenSolver module?
Would be great if anyone had any ideas. This http://eigen.tuxfamily.org/dox/classEig ... olver.html is what the documentation says, but this didnt really help me..

Regards.

(ps: is this the correct forum for this post?)


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]