我是靠谱客的博主 动人西装,这篇文章主要介绍Eigen求特征值与特征向量,现在分享给大家,希望可以做个参考。

这里列举三种方式求矩阵的特征值与特征向量

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h> #include <stdlib.h> #include<Eigen/Eigen> using namespace std; using namespace Eigen; void main() { MatrixXd m(3, 3); m << 1,-2,2, -2,-2,4, 2,4,-2; cout << m << endl << endl; EigenSolver<MatrixXd> es(m); cout << "第一种:" << endl; cout << "特征值为:" << endl; cout << es.eigenvalues() << endl; cout << "特征向量为:" <<endl; cout << es.eigenvectors() << endl << endl; cout << "第二种:" << endl; Matrix3d D = es.pseudoEigenvalueMatrix(); Matrix3d V = es.pseudoEigenvectors(); cout << D << endl << endl; cout << V << endl << endl; cout << "第三种:" << endl; MatrixXd value= es.eigenvalues().real(); MatrixXd vector= es.eigenvectors().real(); cout << value<< endl << endl; cout << vector<< endl << endl; }

运行结果
在这里插入图片描述

最后

以上就是动人西装最近收集整理的关于Eigen求特征值与特征向量的全部内容,更多相关Eigen求特征值与特征向量内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部