# Module Sundials_Matrix.Dense

module Dense: sig .. end

Dense matrices

type t

A dense 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).

See sundials: The SUNMatrix_Dense implementation

#### Basic access

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

make m n x returns an m by n dense matrix with elements set to x.

See sundials: SUNDenseMatrix
val create : int -> int -> t

create m n returns an uninitialized m by n dense matrix.

See sundials: SUNDenseMatrix
val size : t -> int * int

m, n = size a returns the numbers of columns m and rows n of a.

See sundials: SM_ROWS_D
See sundials: SM_COLUMNS_D
See sundials: SUNDenseMatrix_Rows
See sundials: SUNDenseMatrix_Columns
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print a dense matrix using the Format module.

val ppi : ?start:string ->       ?stop:string ->       ?sep:string ->       ?indent:int ->       ?itemsep:string ->       ?item:(Stdlib.Format.formatter -> int -> int -> float -> unit) ->       unit -> Stdlib.Format.formatter -> t -> unit

Pretty-print a dense matrix using the Format module. The defaults are: start="[", stop="]", sep=";", indent=4, itemsep=" ", 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

get a i j returns the value at row i and column j of a.

See sundials: SM_ELEMENT_D
val set : t -> int -> int -> float -> unit

set a i j v sets the value at row i and column j of a to v.

See sundials: SM_ELEMENT_D
val update : t -> int -> int -> (float -> float) -> unit

update a i j f sets the value at row i and column j of a to f v.

See sundials: SM_ELEMENT_D
val unwrap : t -> Sundials.RealArray2.data

Direct access to the underlying storage array, which is accessed column first (unlike in Sundials_Matrix.Dense.get).

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.

See sundials: SM_CONTENT_D

#### Operations

val ops : (t, Nvector_serial.data) Sundials_Matrix.matrix_ops

Operations on dense matrices.

val scale_add : float -> t -> t -> unit

scale_add c A B calculates $A = cA + B$.

val scale_addi : float -> t -> unit

scale_addi c A calculates $A = cA + I$.

val matvec : t ->       Sundials.RealArray.t -> Sundials.RealArray.t -> unit

The call matvec a x y computes the matrix-vector product $y = Ax$.

See sundials: SUNMatMatvec
See sundials: SUNMatMatvec_Dense
val set_to_zero : t -> unit

Fills a matrix with zeros.

See sundials: SUNMatZero
See sundials: SUNMatZero_Dense
val blit : t -> t -> unit

blit src dst copies the contents of src into dst. Both must have the same size.

See sundials: SUNMatCopy
See sundials: SUNMatCopy_Dense
val space : t -> int * int

lrw, liw = space a returns the storage requirements of a as lrw realtype words and liw integer words.

See sundials: SUNMatSpace
See sundials: SUNMatSpace_Dense

#### Low-level details

val invalidate : t -> unit

Called internally when the corresponding value in the underlying library ceases to exist. Has no effect when Config.sundials_version >= 3.0.0.