module Band:sig..end
Banded matrices
type t
A band matrix. Values of this type are typically passed to linear
solver callback functions (like Cvode.Dls.jac_fn,
Ida.Dls.jac_fn, and Kinsol.Dls.jac_fn).
type dimensions = {
|
n : |
(* | Matrix size: | *) |
|
mu : |
(* | Upper bandwidth. | *) |
|
smu : |
(* | Storage upper bandwidth. | *) |
|
ml : |
(* | Lower bandwidth. | *) |
}
Band matrix dimensions. If the result will not be LU factored then $\mathtt{smu} = \mathtt{mu}$ , otherwise $\mathtt{smu} = \min(\mathtt{n}-1, \mathtt{mu} + \mathtt{ml})$ . The extra space is used to store U.
val make : dimensions -> float -> tReturns a band matrix with the given Sundials_Matrix.Band.dimensions and all elements
initialized to the given value.
val create : dimensions -> tReturns an uninitialized band matrix with the given Sundials_Matrix.Band.dimensions.
val size : t -> int * intm, n = size a returns the numbers of rows m and columns n of a.
NB: m and n are always equal for band matrices.
val dims : t -> dimensionsReturns the dimensions of a band matrix.
val pp : Stdlib.Format.formatter -> t -> unitPretty-print a band matrix using the Format module.
val ppi : ?start:string ->
?stop:string ->
?sep:string ->
?indent:int ->
?itemsep:string ->
?empty:string ->
?item:(Stdlib.Format.formatter -> int -> int -> float -> unit) ->
unit -> Stdlib.Format.formatter -> t -> unitval get : t -> int -> int -> floatget a i j returns the value at row i and column j of a.
Only rows and columns satisfying
$\mathtt{i} \leq \mathtt{j} + \mathtt{ml}$ and
$\mathtt{j} \leq \mathtt{i} + \mathtt{smu}$ are valid.
val set : t -> int -> int -> float -> unitset a i j v sets the value at row i and column j of a to v.
Only rows and columns satisfying
$\mathtt{i} \leq \mathtt{j} + \mathtt{ml}$ and
$\mathtt{j} \leq \mathtt{i} + \mathtt{smu}$ are valid.
val update : t -> int -> int -> (float -> float) -> unitupdate a i j f sets the value at row i and column j of a
to f v. Only rows and columns satisfying
$\mathtt{i} \leq \mathtt{j} + \mathtt{ml}$ and
$\mathtt{j} \leq \mathtt{i} + \mathtt{smu}$ are valid.
val unwrap : t -> Sundials.RealArray2.dataDirect access to the underlying storage array, which is accessed
column first (unlike in Sundials_Matrix.Band.get).
NB: The Sundials_Matrix.Band.scale_add operation, invoked either directly or from within
a solver, will replace the underlying storage of its first matrix
argument if the second matrix has a strictly larger bandwidth.
Similarly, the Sundials_Matrix.Band.blit operation, invoked either directly or from
within a solver, will replace the underlying storage of its second
matrix argument if the first matrix has a strictly larger bandwidth.
In both cases, any previously 'unwrapped' array is no longer
associated with the matrix storage.
NB: For Config.sundials_version < 3.0.0, this access is potentially unsafe and must only be used when the underlying storage is valid, which will be the case in callbacks.
val ops : (t, Nvector_serial.data) Sundials_Matrix.matrix_opsOperations on band matrices.
val scale_add : float -> t -> t -> unitscale_add c A B calculates $A = cA + B$.
NB: This operation, invoked either directly or from within a solver, will replace the underlying storage of its first matrix argument if the second matrix has a strictly larger bandwidth.
val scale_addi : float -> t -> unitscale_addi c A calculates $A = cA + I$.
val matvec : t ->
Sundials.RealArray.t -> Sundials.RealArray.t -> unitThe call matvec a x y computes the matrix-vector product $y = Ax$.
val set_to_zero : t -> unitFills a matrix with zeros.
val blit : src:t -> dst:t -> unitblit ~src ~dst copies the contents of src into dst. Both
must have the same size.
NB: This operation, invoked either directly or from within a solver, will replace the underlying storage of its second matrix argument if the first matrix has a strictly larger bandwidth.
val space : t -> int * intlrw, liw = space a returns the storage requirements of a as
lrw realtype words and liw integer words.
val invalidate : t -> unitCalled internally when the corresponding value in the underlying library ceases to exist. Has no effect when Config.sundials_version >= 3.0.0.