Module Kinsol.Dls

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 Kinsol.double, Sundials.RealArray.t)
Kinsol.jacobian_arg -> 'm -> unit

Callback functions that compute dense approximations to a Jacobian matrix. In the call jac arg jm, arg is a Kinsol.jacobian_arg with two 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 ith equation with respect to the jth variable, evaluated at the values of t and y obtained from arg. Only nonzero elements need be loaded into jm.

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

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

Create a Kinsol-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 ] Kinsol.serial_session -> 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 ] Kinsol.serial_session -> int

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

val get_num_lin_func_evals : [> Nvector_serial.kind ] Kinsol.serial_session -> int

Returns the number of calls made by a direct linear solver to the user system function for computing the difference quotient approximation to the Jacobian.