Hello,
I am trying to work with the matrix classes of ROOT
and i am looking at a simple example:
I have a 3x3 matrix A:
1 2 0
0 3 0
2 -4 2
and I am searching for the eigenvector matrix P which should look like (by hand):
1 0 1
1 0 0
-2 1 -2
Below are the operation I have done with CINT:
root [0] TMatrixD A(3,3)
Error: Can't call @@ ex autload entry remove by typedef declaration @@TMatrixD::@@ ex autload entry remove by typedef declaration @@TMatrixD(3,3) in current scope (tmpfile):1:
Possible candidates are...
*** Interpreter error recovered ***
root [1] TMatrixD A(3,3)
root [2] A[0][0]=1
(const int)1
root [3] A[2][0]=2
(const int)2
root [4] A[0][1]=2
(const int)2
root [5] A[1][1]=3
(const int)3
root [6] A[2][1]=-4
(const int)(-4)
root [7] A[2][2]=2
(const int)2
root [8] TMatrixDEigen M(A)
root [9] TMatrixD P(3,3)
root [10] P=M.GetEigenVectors()
(class TMatrixT<double>)158895384
root [11] for(int i=0;i<3;i++) {for(int j=0;j<3;j++) cout<<P[i][j]<<" "; cout<<endl;}
1 4.44089e-16 -0.447214
1 0 0
-2 -2.23607 0.894427
First I get an error that i don t understand.
And my second problem is the output of the second column of the matrix P.
Instead of 0 i get 4.44089e-16. Ok it is still a small number which probably comes from the numerical method. But is there a way to improve this and have directly 0?
thank you for your help