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

Basic access

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

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

val create : int -> int -> t

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

val size : t -> int * int

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

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.

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.

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.

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.

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$.

val set_to_zero : t -> unit

Fills a matrix with zeros.

val blit : src:t -> dst:t -> unit

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

val space : t -> int * int

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

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.