module Dls:`sig`

..`end`

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

`include Sundials_LinearSolver.Direct`

type`'m`

jac_fn =`(Sundials.RealArray.t Cvode.triple, Sundials.RealArray.t) Cvode.jacobian_arg ->`

'm -> unit

Callback functions that compute approximations to a Jacobian
matrix. In the call `jac arg jm`

, `arg`

is a `Cvode.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.

Neither the elements of

`arg`

nor the matrix `jm`

should
be accessed after the function has returned.- See Sundials: CVLsJacFn

type`'m`

linsys_fn =`(Sundials.RealArray.t Cvode.triple, Sundials.RealArray.t) Cvode.jacobian_arg ->`

'm -> bool -> float -> bool

Function to compute the linear system matrix $M = I - \gamma J$ or an approximation of it. 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, and`gamma`

, 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.

Neither the Jacobian argument elements nor the matrix

`m`

should be accessed after the function has returned.**Since**5.0.0- See Sundials: CVLsLinSysFn

`val solver : ``?jac:'m jac_fn ->`

?linsys:'m linsys_fn ->

('m, Sundials.RealArray.t, [> Nvector_serial.kind ] as 'a, [> `Dls ])

Sundials.LinearSolver.t -> 'a Cvode.serial_linear_solver

Create a Cvode-specific linear solver from a Jacobian approximation function and 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$ . This feature is only
available in Sundials >= 5.0.0.

- See Sundials: CVodeSetLinearSolver
- See Sundials: CVodeSetJacFn
- See Sundials: CVodeSetLinSysFn

`val get_work_space : ``[> Nvector_serial.kind ] Cvode.serial_session -> int * int`

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

**Returns**(`real_size`

,`integer_size`

)- See Sundials: CVodeGetLinWorkSpace

`val get_num_jac_evals : ``[> Nvector_serial.kind ] Cvode.serial_session -> int`

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

- See Sundials: CVodeGetNumJacEvals

`val get_num_lin_rhs_evals : ``[> Nvector_serial.kind ] Cvode.serial_session -> int`

Returns the number of calls to the right-hand side callback due to the finite difference Jacobian approximation.

- See Sundials: CVodeGetNumLinRhsEvals