Class SUNLinSolWrapper

Inheritance Relationships

Derived Types

Class Documentation

class amici::SUNLinSolWrapper

A RAII wrapper for SUNLinearSolver structs.

For details on member functions see documentation in sunlinsol/sundials_linearsolver.h.

Subclassed by amici::SUNLinSolBand, amici::SUNLinSolDense, amici::SUNLinSolKLU, amici::SUNLinSolPCG, amici::SUNLinSolSPBCGS, amici::SUNLinSolSPFGMR, amici::SUNLinSolSPGMR, amici::SUNLinSolSPTFQMR

Public Functions

SUNLinSolWrapper() = default
explicit SUNLinSolWrapper(SUNLinearSolver linsol)

Wrap existing SUNLinearSolver.

Parameters

linsol

virtual ~SUNLinSolWrapper()
SUNLinSolWrapper(const SUNLinSolWrapper &other) = delete

Copy constructor.

Parameters

other

SUNLinSolWrapper(SUNLinSolWrapper &&other) noexcept

Move constructor.

Parameters

other

SUNLinSolWrapper &operator=(const SUNLinSolWrapper &other) = delete

Copy assignment.

Parameters

other

Returns

SUNLinSolWrapper &operator=(SUNLinSolWrapper &&other) noexcept

Move assignment.

Parameters

other

Returns

SUNLinearSolver get() const

Returns the wrapped SUNLinSol.

Returns

SUNLinearSolver

SUNLinearSolver_Type getType() const

Returns an identifier for the linear solver type.

Returns

void setup(SUNMatrix A) const

Performs any linear solver setup needed, based on an updated system matrix A.

Parameters

A

void setup(const SUNMatrixWrapper &A) const

Performs any linear solver setup needed, based on an updated system matrix A.

Parameters

A

int Solve(SUNMatrix A, N_Vector x, N_Vector b, realtype tol) const

Solves a linear system A*x = b.

Parameters
  • A

  • x – A template for cloning vectors needed within the solver.

  • b

  • tol – Tolerance (weighted 2-norm), iterative solvers only

Returns

error flag

long int getLastFlag() const

Returns the last error flag encountered within the linear solver.

Returns

error flag

int space(long int *lenrwLS, long int *leniwLS) const

Returns the integer and real workspace sizes for the linear solver.

Parameters
  • lenrwLS – output argument for size of real workspace

  • leniwLS – output argument for size of integer workspace

Returns

workspace size

virtual SUNMatrix getMatrix() const

Get the matrix A (matrix solvers only).

Returns

A

Protected Functions

int initialize()

Performs linear solver initialization (assumes that all solver-specific options have been set).

Returns

error code

Protected Attributes

SUNLinearSolver solver_ = {nullptr}

Wrapped solver