Module Dls.ArrayBandMatrix

module ArrayBandMatrix: sig .. end
General-purpose band matrix operations on arrays.
See sundials: The BAND Module

type t = Sundials.RealArray2.t 
A band matrix accessible directly through a Bigarray.

The layout of these arrays are characterized by the storage upper bandwidth smu. Given an array a, the first dimension indexes the diagonals, with the main diagonal ($i = j$ ) at a.{smu, _}. The value in the ith row and jth column provided $\mathtt{i} \leq \mathtt{j} + \mathtt{ml}$ and $\mathtt{j} \leq \mathtt{i} + \mathtt{smu}$ is at a.{i - j + smu, j}.

See sundials: newBandMat
type smu = int 
Storage upper-bandwidth.
type mu = int 
Upper-bandwidth.
type ml = int 
Lower-bandwidth.

Basic access


val create : int ->
smu -> ml -> t
create n smu ml returns an n by n band matrix with storage upper bandwidth smu and lower half-bandwidth ml. 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 after a call to Dls.ArrayBandMatrix.gbtrf.
See sundials: newBandMat
val get : t -> smu -> int -> int -> float
get a smu i j returns the value at row i and column j of a. smu is the storage upper bandwidth. 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 ->
smu -> int -> int -> float -> unit
set a smu i j v sets the value at row i and column j of a to v. smu is the storage upper bandwidth. 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 ->
smu -> int -> int -> (float -> float) -> unit
update a smu i j f sets the value at row i and column j of a to f v. smu is the storage upper bandwidth. Only rows and columns satisfying $\mathtt{i} \leq \mathtt{j} + \mathtt{ml}$ and $\mathtt{j} \leq \mathtt{i} + \mathtt{smu}$ are valid.

Calculations


val add_identity : t -> smu -> unit
Increment a square matrix by the identity matrix.
See sundials: bandAddIdentity
val matvec : t ->
smu ->
mu ->
ml ->
x:Sundials.RealArray.t -> y:Sundials.RealArray.t -> unit
Compute the matrix-vector product $y = Ax$.
Since 2.6.0
See sundials: bandMatvec
val blit : t ->
t ->
smu -> smu -> int -> int -> unit
blit src dst src_smu dst_smu copy_mu copy_ml copies the contents of src into dst. The storage upper bandwidths of src and dst are, respectively, src_smu and dst_smu. The bandwidth to copy is given by copy_mu and copy_ml. Both matrices must have the same size.
See sundials: bandCopy
val scale : float ->
t ->
smu ->
mu -> ml -> unit
scale c a smu mu ml multiplies each element of the band matrix a by c. The parameters smu, mu, and ml give, respectively, the storage upper, upper, and lower bandwidths.
See sundials: bandScale
val gbtrf : t ->
smu ->
mu ->
ml -> Sundials.LintArray.t -> unit
gbtrf a smu mu ml p performs the LU factorization of a with partial pivoting according to p. The parameters smu, mu, and ml give, respectively, the storage upper, upper, and lower bandwidths. The values in a are overwritten with those of the calculated L and U matrices. The diagonal belongs to U. The diagonal of L is all 1s. U may occupy elements up to bandwidth smu (rather than to mu).
See sundials: bandGBTRF
val gbtrs : t ->
smu ->
ml ->
Sundials.LintArray.t -> Sundials.RealArray.t -> unit
gbtrs a smu ml p b finds the solution of ax = b using LU factorization. The parameters smu and ml give, respectively, the storage upper and lower bandwidths. Both p and b must have the same number of rows as a.
See sundials: bandGBTRS