Module Idas.Adjoint.Dls

module Dls: sig .. end

Direct Linear Solvers operating on dense, banded, and sparse matrices.


include Sundials_LinearSolver.Direct
type 'm jac_fn_no_sens = (Sundials.RealArray.t Idas.Adjoint.triple, Sundials.RealArray.t)
Idas.Adjoint.jacobian_arg -> 'm -> unit

Callback functions that compute dense approximations to a Jacobian matrix without forward sensitivities. In the call jac arg jm, arg is a Idas.Adjoint.jacobian_arg with three work vectors and the computed Jacobian must be stored in jm.

The callback should load the (i,j)th entry of jm with $\frac{\partial F_i}{\partial y_j} + c_j\frac{\partial F_i}{\partial\dot{y}_j}$, i.e., the partial derivative of the ith equation with respect to the jth variable, evaluated at the values of t, y, and y' obtained from arg. Only nonzero elements need be loaded into jm.

Raising Sundials.RecoverableFailure indicates a recoverable error. Any other exception is treated as an unrecoverable error.

Neither the elements of arg nor the matrix jm should be accessed after the function has returned.

type 'm jac_fn_with_sens = (Sundials.RealArray.t Idas.Adjoint.triple, Sundials.RealArray.t)
Idas.Adjoint.jacobian_arg ->
Sundials.RealArray.t array -> Sundials.RealArray.t array -> 'm -> unit

Callback functions that compute dense approximations to a Jacobian matrix with forward sensitivities. In the call jac arg ys yps jm, arg is a Idas.Adjoint.jacobian_arg with three work vectors, ys contains the sensitivities of the forward solution, yps contains the derivatives of the forward solution sensitivities, and the computed Jacobian must be stored in jm.

The callback should load the (i,j)th entry of jm with $\frac{\partial F_i}{\partial y_j} + c_j\frac{\partial F_i}{\partial\dot{y}_j}$, i.e., the partial derivative of the ith equation with respect to the jth variable, evaluated at the values of t, y, and y' obtained from arg. Only nonzero elements need be loaded into jm.

Raising Sundials.RecoverableFailure indicates a recoverable error. Any other exception is treated as an unrecoverable error.

Neither the elements of arg nor the matrix jm should be accessed after the function has returned.

type 'm jac_fn = 
| NoSens of 'm jac_fn_no_sens (*

Does not depend on forward sensitivities.

*)
| WithSens of 'm jac_fn_with_sens (*

Depends on forward sensitivities.

*)

Callback functions that compute dense approximations to a Jacobian matrix.

val solver : ?jac:'m jac_fn ->
('m, Sundials.RealArray.t, [> Nvector_serial.kind ] as 'a, 't)
Sundials.LinearSolver.t -> 'a Idas.Adjoint.serial_linear_solver

Create an Idas-specific linear solver from a Jacobian approximation function and a generic direct linear solver. The Jacobian approximation function is optional for dense and banded solvers (if not given an internal difference quotient approximation is used), but must be provided for other solvers (or Invalid_argument is raised).

Solver statistics

val get_work_space : [> Nvector_serial.kind ] Idas.Adjoint.serial_bsession -> int * int

Returns the sizes of the real and integer workspaces used by a direct linear solver.

val get_num_jac_evals : [> Nvector_serial.kind ] Idas.Adjoint.serial_bsession -> int

Returns the number of calls made by a direct linear solver to the Jacobian approximation function.

val get_num_lin_res_evals : [> Nvector_serial.kind ] Idas.Adjoint.serial_bsession -> int

Returns the number of calls to the residual callback due to the finite difference Jacobian approximation.