Module Kinsol.Alternate

module Alternate: sig .. end
Alternate Linear Solvers.
See sundials: Providing Alternate Linear Solver Modules

type ('data, 'kind) linit = ('data, 'kind) Kinsol.session -> unit 
Functions that initialize linear solver data, like counters and statistics.

Raising any exception in this function (including Sundials.RecoverableFailure) is treated as an unrecoverable error.

See sundials: linit
type ('data, 'kind) lsetup = ('data, 'kind) Kinsol.session -> unit 
Functions that prepare the linear solver for subsequent calls to Kinsol.Alternate.lsolve. They may recompute Jacobian-related data.

Raising any exception in this function (including Sundials.RecoverableFailure) is treated as an unrecoverable error.

See sundials: lsetup
type ('data, 'kind) lsolve = ('data, 'kind) Kinsol.session ->
'data -> 'data -> float option * float option
Functions that solve the linear equation $Jx = b$. In the call res_norm = lsolve x b, x is an initial guess on entry, on return it must contain the computed solution, and b is the right-hand side vector, set to $-F(u)$, at the current iterate. This function optionally returns the L2-norm of the product $Jp$ ($\lVert D_F J p \rVert_2$) and the dot product of the scaled $F$ vector and the scaled vector $Jp$ ($(D_F F)\cdot(D_F J p)$).

Raising Sundials.RecoverableFailure indicates an error where recovery may be possible by calling the Kinsol.Alternate.lsetup function again. Other exceptions are treated as unrecoverable errors.

The vectors x and b should not be accessed after the function returns.

See sundials: lsolve
type ('data, 'kind) callbacks = {
   linit : ('data, 'kind) linit option;
   lsetup : ('data, 'kind) lsetup option;
   lsolve : ('data, 'kind) lsolve;
}
The callbacks needed to implement an alternate linear solver.
val make : (('data, 'kind) Kinsol.session ->
('data, 'kind) Nvector.t -> ('data, 'kind) callbacks) ->
('data, 'kind) Kinsol.linear_solver
Creates a linear solver from a function returning a set of callbacks. The creation function is passed a session and a vector. The latter indicates the problem size and can, for example, be cloned.

Solver internals


val get_u_uscale : ('data, 'kind) Kinsol.session -> 'data * 'data
Returns the internal u and uscale values.
val get_f_fscale : ('data, 'kind) Kinsol.session -> 'data * 'data
Returns the internal f and fscale values.
val set_sjpnorm : ('data, 'kind) Kinsol.session -> float -> unit
Sets the internal sJpnorm value.
val set_sfdotjp : ('data, 'kind) Kinsol.session -> float -> unit
Sets the internal sfdotJp value.