Class NewtonSolver
Defined in File newton_solver.h
Inheritance Relationships
Derived Types
public amici::NewtonSolverDense
(Class NewtonSolverDense)public amici::NewtonSolverSparse
(Class NewtonSolverSparse)
Class Documentation
-
class amici::NewtonSolver
The NewtonSolver class sets up the linear solver for the Newton method.
Subclassed by amici::NewtonSolverDense, amici::NewtonSolverSparse
Public Functions
-
explicit NewtonSolver(const Model &model)
Initializes solver according to the dimensions in the provided model.
- Parameters
model – pointer to the model object
-
void getStep(AmiVector &delta, Model &model, const SimulationState &state)
Computes the solution of one Newton iteration.
- Parameters
delta – containing the RHS of the linear system, will be overwritten by solution to the linear system
model – pointer to the model instance
state – current simulation state
-
void computeNewtonSensis(AmiVectorArray &sx, Model &model, const SimulationState &state)
Computes steady state sensitivities.
- Parameters
sx – pointer to state variable sensitivities
model – pointer to the model instance
state – current simulation state
-
virtual void prepareLinearSystem(Model &model, const SimulationState &state) = 0
Writes the Jacobian for the Newton iteration and passes it to the linear solver.
- Parameters
model – pointer to the model instance
state – current simulation state
-
virtual void prepareLinearSystemB(Model &model, const SimulationState &state) = 0
Writes the Jacobian (JB) for the Newton iteration and passes it to the linear solver
- Parameters
model – pointer to the model instance
state – current simulation state
-
virtual void solveLinearSystem(AmiVector &rhs) = 0
Solves the linear system for the Newton step.
- Parameters
rhs – containing the RHS of the linear system, will be overwritten by solution to the linear system
-
virtual void reinitialize() = 0
Reinitialize the linear solver.
-
virtual bool is_singular(Model &model, const SimulationState &state) const = 0
Checks whether linear system is singular.
- Parameters
model – pointer to the model instance
state – current simulation state
- Returns
boolean indicating whether the linear system is singular (condition number < 1/machine precision)
-
virtual ~NewtonSolver() = default
Public Static Functions
-
static std::unique_ptr<NewtonSolver> getSolver(const Solver &simulationSolver, const Model &model)
Factory method to create a NewtonSolver based on linsolType.
- Parameters
simulationSolver – solver with settings
model – pointer to the model instance
- Returns
solver NewtonSolver according to the specified linsolType
Protected Attributes
-
explicit NewtonSolver(const Model &model)