STK++ 0.9.13
tutoSymEigen.cpp
Go to the documentation of this file.
1#include <STKpp.h>
2using namespace STK;
4int main(int argc, char** argv)
5{
6 CSquareX a(5);
7 a << 0, 1, 2, 3, 4,
8 2, 3, 4, 5, 6,
9 2, 1, 6, 7, 8,
10 0, 3,-1, 2, 3,
11 3,-1, 1, 1, 0;
12 stk_cout << "STK++ Eigen decomposition:\n";
13 stk_cout << "--------------------------\n";
15 stk_cout << "D matrix:\n";
16 stk_cout << s.eigenValues();
18 stk_cout << "QDQ^T matrix:\n";
19 stk_cout << QDQt;
20 stk_cout << "\nlapack Eigen decomposition:\n";
21 stk_cout << "--------------------------\n";
23 stk_cout << "D matrix:\n";
24 stk_cout << ls.eigenValues();
25 QDQt = ls.eigenVectors() * ls.eigenValues().diagonalize() * ls.eigenVectors().transpose();
26 stk_cout << "QDQ^T matrix:\n";
27 stk_cout << QDQt;
28 return 0;
29}
#define stk_cout
Standard stk output stream.
This file include all the header files of the STK++ project.
TransposeOperator< Derived > const transpose() const
DiagonalizeOperator< Derived > const diagonalize() const
UpperSymmetrizeOperator< Derived > const upperSymmetrize() const
CArraySquare< Type, size_ > const & eigenVectors() const
CArrayVector< Type, size_ > const & eigenValues() const
virtual bool run()
Find the eigenvalues and eigenvectors of the matrix.
The class SymEigen compute the eigenvalue Decomposition of a symmetric ArrayXX.
The namespace STK is the main domain space of the Statistical ToolKit project.
int main(int argc, char **argv)