|
ITK
5.2.0
Insight Toolkit
|
Go to the documentation of this file.
18 #ifndef __VNLIterativeSparseSolverTraits_h
19 #define __VNLIterativeSparseSolverTraits_h
21 #include "vnl/vnl_vector.h"
22 #include "vnl/vnl_sparse_matrix.h"
23 #include "vnl/vnl_sparse_matrix_linear_system.h"
24 #include "vnl/algo/vnl_lsqr.h"
42 template <
typename T =
double>
97 using SparseLinearSystemType = vnl_sparse_matrix_linear_system<ValueType>;
98 SparseLinearSystemType system(iA, iB);
101 return solver.minimize(oX);
115 bool result1 =
Solve(iA, iBx, 100000, oX);
116 bool result2 =
Solve(iA, iBy, 100000, oY);
117 bool result3 =
Solve(iA, iBz, 100000, oZ);
119 return (result1 && result2 && result3);
126 bool result1 =
Solve(iA, iBx, oX);
127 bool result2 =
Solve(iA, iBy, oY);
129 return (result1 && result2);
136 using SparseLinearSystemType = vnl_sparse_matrix_linear_system<ValueType>;
137 SparseLinearSystemType system(iA, iB);
140 solver.set_max_iterations(iNbIter);
141 return solver.minimize(oX);
static MatrixType InitializeSparseMatrix(const unsigned int &iRow, const unsigned int &iCol)
initialize a sparse matrix of size iRow x iCol
static VectorType InitializeVector(const unsigned int &iN)
initialize a vector of size iN
static bool Solve(const MatrixType &iA, const VectorType &iB, VectorType &oX)
Solve the linear system .
static void AddToMatrix(MatrixType &iA, const unsigned int &iR, const unsigned int &iC, const ValueType &iV)
iA[iR][iC] += iV
Generic interface for iterative sparse linear solver.
static void FillMatrix(MatrixType &iA, const unsigned int &iR, const unsigned int &iC, const ValueType &iV)
iA[iR][iC] = iV
static bool Solve(const MatrixType &iA, const VectorType &iB, const long &iNbIter, VectorType &oX)
Solve the linear systems: in N iterations.
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 &iBx, const VectorType &iBy, const VectorType &iBz, VectorType &oX, VectorType &oY, VectorType &oZ)
Solve the linear systems: , , .
static bool Solve(const MatrixType &iA, const VectorType &iBx, const VectorType &iBy, VectorType &oX, VectorType &oY)
Solve the linear systems: , .
vnl_sparse_matrix< ValueType > MatrixType
static bool IsDirectSolver()
vnl_vector< ValueType > VectorType