Eigen 라 이브 러 리 특징 값 특징 벡터
4350 단어 C++programming
Eigen 의 행렬 유형 은 보통 Matrix XXX 와 유사 하 게 표시 되 는데 이 이름 에 따라 데이터 유형 을 판단 할 수 있 습 니 다. 예 를 들 어 'd' 는 double 을 대표 하 는 것 이 정 수 를 나타 내 는 것 이 아 닙 니 다. 'f '대표 float;'i '는 정 수 를 대표 한다.'c 'complex, 즉 복수' 를 대표 한다.d '는 dynamic 을 나타 낸다. 즉, 행렬 의 일부 비 수 는 불확실 하고 동태 적 인 것 을 나타 낸다. 예 를 들 어 Matrix2cd 는 2 * 2 차원 을 나타 내 고 모든 요 소 는 복수 이 며 복수 의 실제 부분 과 허 부 는 double 유형 이다.
EigenSolver
(
const MatrixType &
matrix,
bool
computeEigenvectors =
true
)
inline
Constructor; computes eigendecomposition of given matrix.
Parameters
[in]
matrix
Square matrix whose eigendecomposition is to be computed.
[in]
computeEigenvectors
If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed.
This constructor calls compute() to compute the eigenvalues and eigenvectors.
Example:
MatrixXd A = MatrixXd::Random(6,6);
cout <<
"Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver es(A);
cout <<
"The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout <<
"The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex lambda = es.eigenvalues()[0];
cout <<
"Consider the first eigenvalue, lambda = " << lambda << endl;
VectorXcd v = es.eigenvectors().col(0);
cout <<
"If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
cout <<
"... and A * v = " << endl << A.cast >() * v << endl << endl;
MatrixXcd D = es.eigenvalues().asDiagonal();
MatrixXcd V = es.eigenvectors();
cout <<
"Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl;
Output:
Here is a random 6x6 matrix, A:
0.68 -0.33 -0.27 -0.717 -0.687 0.0259
-0.211 0.536 0.0268 0.214 -0.198 0.678
0.566 -0.444 0.904 -0.967 -0.74 0.225
0.597 0.108 0.832 -0.514 -0.782 -0.408
0.823 -0.0452 0.271 -0.726 0.998 0.275
-0.605 0.258 0.435 0.608 -0.563 0.0486
The eigenvalues of A are:
(0.049,1.06)
(0.049,-1.06)
(0.967,0)
(0.353,0)
(0.618,0.129)
(0.618,-0.129)
The matrix of eigenvectors, V, is:
(-0.292,-0.454) (-0.292,0.454) (-0.0607,0) (-0.733,0) (0.59,-0.122) (0.59,0.122)
(0.134,-0.104) (0.134,0.104) (-0.799,0) (0.136,0) (0.335,0.368) (0.335,-0.368)
(-0.422,-0.18) (-0.422,0.18) (0.192,0) (0.0563,0) (-0.335,-0.143) (-0.335,0.143)
(-0.589,0.0274) (-0.589,-0.0274) (-0.0788,0) (-0.627,0) (0.322,-0.156) (0.322,0.156)
(-0.248,0.132) (-0.248,-0.132) (0.401,0) (0.218,0) (-0.335,-0.076) (-0.335,0.076)
(0.105,0.18) (0.105,-0.18) (-0.392,0) (-0.00564,0) (-0.0324,0.103) (-0.0324,-0.103)
Consider the first eigenvalue, lambda = (0.049,1.06)
If v is the corresponding eigenvector, then lambda * v =
(0.466,-0.331)
(0.117,0.137)
(0.17,-0.456)
(-0.0578,-0.622)
(-0.152,-0.256)
(-0.186,0.12)
... and A * v =
(0.466,-0.331)
(0.117,0.137)
(0.17,-0.456)
(-0.0578,-0.622)
(-0.152,-0.256)
(-0.186,0.12)
Finally, V * D * V^(-1) =
(0.68,1.9e-16) (-0.33,4.82e-17) (-0.27,-2.37e-16) (-0.717,1.6e-16) (-0.687,-2.2e-16) (0.0259,2.72e-16)
(-0.211,2.22e-16) (0.536,4.16e-17) (0.0268,-2.98e-16) (0.214,0) (-0.198,6.66e-16) (0.678,6.66e-16)
(0.566,1.22e-15) (-0.444,1.11e-16) (0.904,-4.61e-16) (-0.967,-3.61e-16) (-0.74,7.22e-16) (0.225,8.88e-16)
(0.597,1.6e-15) (0.108,1.84e-16) (0.832,-5.6e-16) (-0.514,-4.44e-16) (-0.782,1.28e-15) (-0.408,9.44e-16)
(0.823,-8.33e-16) (-0.0452,-2.71e-16) (0.271,5.53e-16) (-0.726,7.77e-16) (0.998,-2.33e-15) (0.275,-1.67e-15)
(-0.605,1.03e-15) (0.258,1.91e-16) (0.435,-4.6e-16) (0.608,-6.38e-16) (-0.563,1.69e-15) (0.0486,1.25e-15)
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Visual Studio에서 파일 폴더 구분 (포함 경로 설정)Visual Studio에서 c, cpp, h, hpp 파일을 폴더로 나누고 싶었습니까? 어쩌면 대부분의 사람들이 있다고 생각합니다. 처음에 파일이 만들어지는 장소는 프로젝트 파일 등과 같은 장소에 있기 때문에 파일...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.