小工具知识网

当前位置: 首页 > 行业知识 > Eigen库:(二)密集线性问题和分解

行业知识

Eigen库:(二)密集线性问题和分解

2026-10-30 17:28:48 来源:互联网转载

1. 线性代数和分解

1.1 线性方程组求解

���解线性方程组Ax=b,b可以是向量,也可以是矩阵。

#include #include  using namespace std;using namespace Eigen; int main(){   Matrix3f A;   Vector3f b;   A    MatrixXd A = MatrixXd::Random(100,100);   MatrixXd b = MatrixXd::Random(100,50);   MatrixXd x = A.fullPivLu().solve(b);   double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm   cout    Matrix2f A;   A    MatrixXf A = MatrixXf::Random(3, 2);   cout    Matrix2f A, b;   LLT   Matrix3f A;   A    MatrixXf A = MatrixXf::Random(3, 2);   cout 

上一篇:神秘词语sshi探秘,揭秘背后的故事!

下一篇:Android MediaCodec 简明教程(五):使用 MediaCodec 编码 ByteBuffer 数据,并保存为 MP4 文件