Eigen疎行列LU分解解方程式群
1521 ワード
Eigen、構成ディレクトリのダウンロード
ここではLU分解の例を示します
ここではLU分解の例を示します
#include
#include
#include
using namespace Eigen;
//
vectorfloat >> triple;//
triple.push_back(Triplet<float>(i, j,A[i][j]));//ij A[i][j]
SparseMatrix<float> A(n, n);// n*n
A.setFromTriplets(triple.begin(), triple.end());//
SparseLUfloat>> solver
solver.compute(A);// A
if (solver.info()!=Success)
{
cout << "Compute Matrix is error" << endl;
return;
}
//
VectorXf b(n);//n
//
x = solver.solve(b);