module DenseMatrix:`sig`

..`end`

Dense matrices as passed to callback functions.

See sundials: The DENSE Module

type`t =`

`Dls_impl.DenseTypes.t`

An abstract dense matrix. Values of this type are typically passed
to linear solver callback functions (like

`Cvode.Dls.dense_jac_fn`

,
`Ida.Dls.dense_jac_fn`

, and `Kinsol.Dls.dense_jac_fn`

), in which
case their lifetimes are determined by the underlying library and they
should only be used within the callback to avoid the
Invalidated exception.See sundials: Type DlsMat

`val make : ``int -> int -> float -> t`

`val create : ``int -> int -> t`

`val size : ``t -> int * int`

`m, n = size a`

returns the numbers of columns `m`

and rows `n`

of `a`

.`val print : ``t -> unit`

Prints a dense matrix to stdout.

See sundials: PrintMat

`val pp : ``Format.formatter -> t -> unit`

Pretty-print a dense matrix using the
Format module.

`val ppi : ``?start:string ->`

?stop:string ->

?rowsep:string ->

?indent:int ->

?sep:string ->

?item:(Format.formatter -> int -> int -> float -> unit) ->

Format.formatter -> t -> unit

Pretty-print a dense matrix using the
Format module.
The defaults are:

`start="["`

, `stop="]"`

, `rowsep=";"`

,
`indent=4`

, `sep=" "`

, and
`item=fun f r c->Format.fprintf f "(%2d,%2d)=% -15e" r c`

(see
fprintf).
The `indent`

argument specifies the indent for wrapped rows.`val get : ``t -> int -> int -> float`

`val set : ``t -> int -> int -> float -> unit`

`val update : ``t -> int -> int -> (float -> float) -> unit`

`val set_to_zero : ``t -> unit`

Fills a matrix with zeros.

See sundials: SetToZero

`val add_identity : ``t -> unit`

Increments a square matrix by the identity matrix.

See sundials: AddIdentity

`val matvec : ``t -> x:Sundials.RealArray.t -> y:Sundials.RealArray.t -> unit`

Compute the matrix-vector product $y = Ax$.

**Since** 2.6.0

See sundials: DenseMatvec

`val blit : ``t -> t -> unit`

`blit src dst`

copies the contents of `src`

into `dst`

. Both
must have the same size.See sundials: DenseCopy

`val scale : ``float -> t -> unit`

Multiplies each element by a constant.

See sundials: DenseScale

`val getrf : ``t -> Sundials.LintArray.t -> unit`

`getrf a p`

performs the LU factorization of the square matrix `a`

with
partial pivoting according to `p`

. 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. Multiplying L by U gives a permutation
of `a`

, according to the values of `p`

: `p.{k} = j`

means that rows `k`

and `j`

were swapped (in order, where `p.{0}`

swaps against the
original matrix `a`

).Raises

`ZeroDiagonalElement`

Zero found in matrix diagonalSee sundials: DenseGETRF

`val getrs : ``t -> Sundials.LintArray.t -> Sundials.RealArray.t -> unit`

`getrs a p b`

finds the solution of `ax = b`

using an LU factorization
found by `Dls.DenseMatrix.getrf`

. Both `p`

and `b`

must have the same number of
rows as `a`

.See sundials: DenseGETRS

`val potrf : ``t -> unit`

Performs Cholesky factorization of a real symmetric positive matrix.

See sundials: DensePOTRF

`val potrs : ``t -> Sundials.RealArray.t -> unit`

`potrs a b`

finds the solution of `ax = b`

using the Cholesky
factorization found by `Dls.DenseMatrix.potrf`

. `a`

must be an n by n matrix and `b`

must be of length n.See sundials: DensePOTRS

`val geqrf : ``t -> Sundials.RealArray.t -> Sundials.RealArray.t -> unit`

`geqrf a beta work`

performs the QR factorization of `a`

. `a`

must be
an `m`

by `n`

matrix, where `m >= n`

. The `beta`

vector must have
length `n`

. The `work`

vector must have length `m`

.See sundials: DenseGEQRF

`val ormqr : ``a:t ->`

beta:Sundials.RealArray.t ->

v:Sundials.RealArray.t ->

w:Sundials.RealArray.t -> work:Sundials.RealArray.t -> unit

`ormqr q beta v w work`

computes the product w = qv . `Q`

is
an `m`

by `n`

matrix calculated using `Dls.DenseMatrix.geqrf`

with `m >= n`

,
`beta`

has length `n`

, `v`

has length `n`

, `w`

has length `m`

, and
`work`

has length `m`

.See sundials: DenseORMQR

`beta`

: vector passed to `Dls.DenseMatrix.geqrf`

`v`

: vector multiplier`w`

: result vector`work`

: temporary vector used in the calculation`exception Invalidated`

Raised on an attempt to access a value that has become invalid. Such
values refer to matrices that no longer exist in the underlying
library.

`val invalidate : ``t -> unit`

Called internally when the corresponding value in the underlying
library ceases to exist.

`val unsafe_unwrap : ``t ->`

(float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array2.t

Potentially unsafe access to the underlying storage. This array
**must** only be used when the underlying storage is valid, which
will be the case in callbacks. The array is accessed column first
(unlike in

`Dls.DenseMatrix.get`

).