Base Solver Classes

Base Linear Solver

template<class MatType, class VecType, typename NumType>
class BaseSolver

Base class for Linear Solvers.

Template Parameters
  • MatType: Matrix type (HostMatrix<NumType> and DeviceMatrix<NumTyper> currently supported).
  • VecType: Vector type (HostVector<NumType> and DeviceVector<NumTyper> currently supported).
  • NumType: Number type (double and float currently supported).

Subclassed by BaseDirectSolver< MatType, VecType, NumType >, BaseIterativeSolver< MatType, VecType, NumType >

Public Functions

BaseSolver()

Default constructor.

virtual ~BaseSolver()

Destructor.

virtual void clear() = 0

Clear memory.

virtual void solve(const MatType &mat, const VecType &rhs, VecType *soln) = 0

Solves for soln in mat * soln = rhs.

Parameters
  • mat: The matrix in the above equation.
  • rhs: The vector in the above equation.
  • soln: The vector in the above equation.

Base Iterative Linear Solver

template<class MatType, class VecType, typename NumType>
class BaseIterativeSolver : public BaseSolver<MatType, VecType, NumType>

Base class for Iterative Linear Solvers.

Template Parameters
  • MatType: Matrix type (HostMatrix<NumType> and DeviceMatrix<NumTyper> currently supported).
  • VecType: Vector type (HostVector<NumType> and DeviceVector<NumTyper> currently supported).
  • NumType: Number type (double and float currently supported). Manages tasks and information related to convergence.

Subclassed by CG< MatType, VecType, NumType >, CGS< MatType, VecType, NumType >, GMRES< MatType, VecType, NumType >

Public Functions

void set_abs_tolerance(double abs_tol)

See
is_converged_.
Parameters
  • abs_tol: The absolute tolerance threshold for convergence (default is 1E-12).

void set_rel_tolerance(double rel_tol)

See
is_converged_.
Parameters
  • rel_tol: The relative tolerance threshold for convergence (default is 1E-12).

void set_abs_rel_tolerances(double abs_tol, double rel_tol)

See
is_converged_.
Parameters
  • abs_tol: The absolute tolerance threshold for convergence (default is 1E-12).
  • rel_tol: The relative tolerance threshold for convergence (default is 1E-12).

void set_max_iterations(int max_it)

Parameters
  • max_it: The maximum number of iterations before. stopping, if the solution has not yet converged (default is 1000).

void set_preconditioner(BasePreconditioner<MatType, VecType, NumType> &precond)

Parameters
  • precond: The preconditioner to be used by the solver.