gtsam
3rdparty
Eigen
doc
snippets
EigenSolver_EigenSolver_MatrixType.cpp
Go to the documentation of this file.
1
MatrixXd
A
= MatrixXd::Random(6,6);
2
cout <<
"Here is a random 6x6 matrix, A:"
<< endl <<
A
<< endl << endl;
3
4
EigenSolver<MatrixXd>
es
(
A
);
5
cout <<
"The eigenvalues of A are:"
<< endl <<
es
.eigenvalues() << endl;
6
cout <<
"The matrix of eigenvectors, V, is:"
<< endl <<
es
.eigenvectors() << endl << endl;
7
8
complex<double>
lambda
=
es
.eigenvalues()[0];
9
cout <<
"Consider the first eigenvalue, lambda = "
<<
lambda
<< endl;
10
VectorXcd
v
=
es
.eigenvectors().col(0);
11
cout <<
"If v is the corresponding eigenvector, then lambda * v = "
<< endl <<
lambda
*
v
<< endl;
12
cout <<
"... and A * v = "
<< endl <<
A
.cast<
complex<double>
>() *
v
<< endl << endl;
13
14
MatrixXcd
D
=
es
.eigenvalues().asDiagonal();
15
MatrixXcd
V
=
es
.eigenvectors();
16
cout <<
"Finally, V * D * V^(-1) = "
<< endl <<
V
*
D
*
V
.inverse() << endl;
D
MatrixXcd D
Definition:
EigenSolver_EigenSolver_MatrixType.cpp:14
A
Definition:
test_numpy_dtypes.cpp:298
es
cout<< "Here is a random 6x6 matrix, A:"<< endl<< A<< endl<< endl;EigenSolver< MatrixXd > es(A)
lambda
cout<< "The eigenvalues of A are:"<< endl<< es.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< es.eigenvectors()<< endl<< endl;complex< double > lambda
Definition:
EigenSolver_EigenSolver_MatrixType.cpp:8
v
Array< int, Dynamic, 1 > v
Definition:
Array_initializer_list_vector_cxx11.cpp:1
V
MatrixXcd V
Definition:
EigenSolver_EigenSolver_MatrixType.cpp:15
complex
Definition:
datatypes.h:12
gtsam
Author(s):
autogenerated on Thu Jun 13 2024 03:02:17