18 #ifndef __VNLSparseLUSolverTraits_h 19 #define __VNLSparseLUSolverTraits_h 21 #include "vnl/vnl_vector.h" 22 #include "vnl/vnl_sparse_matrix.h" 23 #include "vnl/algo/vnl_sparse_lu.h" 41 template<
typename T =
double >
75 static void FillMatrix(MatrixType & iA,
const unsigned int & iR,
const unsigned int & iC,
const ValueType & iV)
81 static void AddToMatrix(MatrixType & iA,
const unsigned int & iR,
const unsigned int & iC,
const ValueType & iV)
87 static bool Solve(
const MatrixType & iA,
const VectorType & iB, VectorType & oX)
89 SolverType solver( iA );
90 Solve( solver, iB, oX );
96 static bool Solve(
const MatrixType & iA,
97 const VectorType & iBx,
const VectorType & iBy,
const VectorType & iBz,
98 VectorType & oX, VectorType & oY, VectorType & oZ )
100 SolverType solver( iA );
101 Solve( solver, iBx, iBy, iBz, oX, oY, oZ );
107 static bool Solve(
const MatrixType & iA,
108 const VectorType & iBx,
const VectorType & iBy,
109 VectorType & oX, VectorType & oY)
111 SolverType solver( iA );
112 Solve( solver, iBx, iBy, oX, oY );
118 static void Solve( SolverType & solver,
const VectorType & iB, VectorType & oX )
120 oX = solver.solve( iB );
124 static void Solve( SolverType & solver,
125 const VectorType & iBx,
const VectorType & iBy,
const VectorType & iBz,
126 VectorType & oX, VectorType & oY, VectorType & oZ )
128 oX = solver.solve( iBx );
129 oY = solver.solve( iBy );
130 oZ = solver.solve( iBz );
134 static void Solve( SolverType & solver,
135 const VectorType & iBx,
const VectorType & iBy,
136 VectorType & oX, VectorType & oY )
138 oX = solver.solve( iBx );
139 oY = solver.solve( iBy );
static MatrixType InitializeSparseMatrix(const unsigned int &iRow, const unsigned int &iCol)
initialize a sparse matrix of size iRow x iCol
static void Solve(SolverType &solver, const VectorType &iBx, const VectorType &iBy, const VectorType &iBz, VectorType &oX, VectorType &oY, VectorType &oZ)
Solve the linear systems: , , factoring the internal matrix if needed.
static MatrixType InitializeSparseMatrix(const unsigned int &iN)
initialize a square sparse matrix of size iN x iN
static bool Solve(const MatrixType &iA, const VectorType &iB, VectorType &oX)
Solve the linear system .
static bool IsDirectSolver()
static bool Solve(const MatrixType &iA, const VectorType &iBx, const VectorType &iBy, VectorType &oX, VectorType &oY)
Solve the linear systems: , .
vnl_vector< ValueType > VectorType
vnl_sparse_matrix< ValueType > MatrixType
static bool Solve(const MatrixType &iA, const VectorType &iBx, const VectorType &iBy, const VectorType &iBz, VectorType &oX, VectorType &oY, VectorType &oZ)
Solve the linear systems: , , .
static VectorType InitializeVector(const unsigned int &iN)
initialize a vector of size iN
Generic interface for sparse LU solver.
static void FillMatrix(MatrixType &iA, const unsigned int &iR, const unsigned int &iC, const ValueType &iV)
iA[iR][iC] = iV
static void AddToMatrix(MatrixType &iA, const unsigned int &iR, const unsigned int &iC, const ValueType &iV)
iA[iR][iC] += iV
static void Solve(SolverType &solver, const VectorType &iBx, const VectorType &iBy, VectorType &oX, VectorType &oY)
Solve the linear systems: , factoring the internal matrix if needed.
static void Solve(SolverType &solver, const VectorType &iB, VectorType &oX)
Solve the linear system factoring the internal matrix if needed.