gtsam
3rdparty
Eigen
doc
snippets
SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp
Go to the documentation of this file.
1
MatrixXd
X
= MatrixXd::Random(5,5);
2
MatrixXd
A
=
X
+
X
.transpose();
3
cout <<
"Here is a random symmetric matrix, A:"
<< endl <<
A
<< endl;
4
X
= MatrixXd::Random(5,5);
5
MatrixXd
B
=
X
*
X
.transpose();
6
cout <<
"and a random postive-definite matrix, B:"
<< endl <<
B
<< endl << endl;
7
8
GeneralizedSelfAdjointEigenSolver<MatrixXd>
es
(
A
,
B
);
9
cout <<
"The eigenvalues of the pencil (A,B) are:"
<< endl <<
es
.eigenvalues() << endl;
10
cout <<
"The matrix of eigenvectors, V, is:"
<< endl <<
es
.eigenvectors() << endl << endl;
11
12
double
lambda
=
es
.eigenvalues()[0];
13
cout <<
"Consider the first eigenvalue, lambda = "
<<
lambda
<< endl;
14
VectorXd
v
=
es
.eigenvectors().col(0);
15
cout <<
"If v is the corresponding eigenvector, then A * v = "
<< endl <<
A
*
v
<< endl;
16
cout <<
"... and lambda * B * v = "
<< endl <<
lambda
*
B
*
v
<< endl << endl;
B
Definition:
test_numpy_dtypes.cpp:299
A
Definition:
test_numpy_dtypes.cpp:298
es
cout<< "Here is a random symmetric matrix, A:"<< endl<< A<< endl;X=MatrixXd::Random(5, 5);MatrixXd B=X *X.transpose();cout<< "and a random postive-definite matrix, B:"<< endl<< B<< endl<< endl;GeneralizedSelfAdjointEigenSolver< MatrixXd > es(A, B)
lambda
static double lambda[]
Definition:
jv.c:524
X
MatrixXd X
Definition:
SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp:1
v
Array< int, Dynamic, 1 > v
Definition:
Array_initializer_list_vector_cxx11.cpp:1
gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:03:08