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 Cvodes.Adjoint.triple, Sundials.RealArray.t)
Cvodes.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 Cvodes.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
$\partial y_i/\partial y_j$, i.e., the partial derivative of
the i
th equation with respect to the j
th variable, evaluated
at the values of t
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.
arg
nor the matrix jm
should
be accessed after the function has returned.type'm
jac_fn_with_sens =(Sundials.RealArray.t Cvodes.Adjoint.triple, Sundials.RealArray.t)
Cvodes.Adjoint.jacobian_arg -> Sundials.RealArray.t array -> 'm -> unit
Callback functions that compute dense approximations to a Jacobian
matrix with forward sensitivities. In the call jac arg s jm
,
arg
is a Cvodes.Adjoint.jacobian_arg
with three work vectors, s
is an
array of forward sensitivity vectors, and the computed Jacobian
must be stored in jm
.
The callback should load the (i,j)
th entry of jm
with
$\partial y_i/\partial y_j$, i.e., the partial derivative of
the i
th equation with respect to the j
th variable, evaluated
at the values of t
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.
arg
, s
nor the matrix jm
should be accessed after the function has returned.type 'm
jac_fn =
| |
NoSens of |
(* | Does not depend on forward sensitivities. | *) |
| |
WithSens of |
(* | Depends on forward sensitivities. | *) |
Callback functions that compute dense approximations to a Jacobian matrix.
type'm
linsys_fn_no_sens =(Sundials.RealArray.t Cvodes.Adjoint.triple, Sundials.RealArray.t)
Cvodes.Adjoint.jacobian_arg -> 'm -> bool -> float -> bool
Function to compute the linear system matrix or an approximation to it
without forward sensitivities. See Cvodes.Adjoint.Dls.linsys_fn
for details.
type'm
linsys_fn_with_sens =(Sundials.RealArray.t Cvodes.Adjoint.triple, Sundials.RealArray.t)
Cvodes.Adjoint.jacobian_arg ->
Sundials.RealArray.t array -> 'm -> bool -> float -> bool
Function to compute the linear system matrix or an approximation to it
with forward sensitivities. See Cvodes.Adjoint.Dls.linsys_fn
for details.
type 'm
linsys_fn =
| |
LNoSens of |
(* | Does not depend on forward sensitivities. | *) |
| |
LWithSens of |
(* | Depends on forward sensitivities. | *) |
Function to compute the linear system matrix $M_B = I - \gamma_B J_B$ or an approximation of it for the backward problem. Offers an alternative to evaluating the Jacobian of the right-hand-side function.
In addition to those shared with the Jacobian function, the arguments of this function are
m
, storage for the computed linear system matrix,jok
, indicates whether the Jacobian-related data needs to be
updated, andgammab
, the scalar in the formula above.The function should return true only if the Jacobian data was recomputed.
Raising Sundials.RecoverableFailure
indicates a recoverable error.
Any other exception is treated as an unrecoverable error.
m
should be accessed after the function has returned.val solver : ?jac:'m jac_fn ->
?linsys:'m linsys_fn ->
('m, Sundials.RealArray.t, [> Nvector_serial.kind ] as 'a, 't)
Sundials.LinearSolver.t -> 'a Cvodes.Adjoint.serial_linear_solver
Create a Cvodes-specific linear solver from a 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).
The linsys
argument allows to override the standard linear system
function that calls jac
to compute $M_B$ . This feature is only
available in Sundials >= 5.0.0.
val get_work_space : [> Nvector_serial.kind ] Cvodes.Adjoint.serial_bsession -> int * int
Returns the sizes of the real and integer workspaces used by a direct linear solver.
real_size
, integer_size
)val get_num_jac_evals : [> Nvector_serial.kind ] Cvodes.Adjoint.serial_bsession -> int
Returns the number of calls made by a direct linear solver to the Jacobian approximation function.
val get_num_lin_rhs_evals : [> Nvector_serial.kind ] Cvodes.Adjoint.serial_bsession -> int
Returns the number of calls to the right-hand side callback due to the finite difference Jacobian approximation.