小编LiS*_*uan的帖子

非常小方阵的特征线性解算器

我在C++程序上使用Eigen来求解非常小的方阵(4X4)的线性方程.

我的测试代码就像

template<template <typename MatrixType> typename EigenSolver>
Vertor3d solve(){
   //Solve Ax = b and A is a real symmetric matrix and positive semidefinite

   ... // Construct 4X4 square matrix A and 4X1 vector b

   EigenSolver<Matrix4d> solver(A);
   auto x = solver.solve(b);

   ... // Compute relative error for validating
}
Run Code Online (Sandbox Code Playgroud)

我测试了一些EigenSolver,其中包括:

  1. FullPixLU
  2. PartialPivLU
  3. HouseholderQR
  4. ColPivHouseholderQR
  5. ColPivHouseholderQR
  6. CompleteOrthogonalDecomposition
  7. 活体肝移植
  8. 直接反向

直接反转是:

template<typename MatrixType>
struct InverseSolve
{
private:
    MatrixType  inv;
public:
    InverseSolve(const MatrixType &matrix) :inv(matrix.inverse()) {
    }
    template<typename VectorType>
    auto …
Run Code Online (Sandbox Code Playgroud)

c++ linear-algebra eigen

6
推荐指数
1
解决办法
472
查看次数

标签 统计

c++ ×1

eigen ×1

linear-algebra ×1