module RealArray2: Sundials_RealArray2
Matrices of floats (two-dimensional bigarrays plus extra information for Sundials.
type
t
A two-dimensional matrix. The underlying data can be accessed as
a Bigarray via Sundials_RealArray2.unwrap
,
but note that the first index specifies the column.
typedata =
(float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout)
Stdlib.Bigarray.Array2.t
An alias for two-dimensional Bigarrays of floating-point numbers.
val make : int -> int -> float -> t
make nr nc v
returns an array with nr
rows and nc
columns, and
with elements set to v
.
val create : int -> int -> t
create nr nc
returns an uninitialized array with nr
rows and nc
columns.
val of_lists : float list list -> t
of_lists xxs
constructs an array from lists of rows. The inner lists
must all have the same length.
val of_arrays : float array array -> t
of_lists xxs
constructs an array from an array of rows. The inner arrays
must all have the same length.
val empty : t
An array with no elements.
val get : t -> int -> int -> float
get a i j
returns the value at row i
and column j
of a
.
val col : t -> int -> Sundials.RealArray.t
col a j
returns the j
th column of a
. The slice shares storage
with 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 size : t -> int * int
nr, nc = size a
returns the numbers of rows nr
and columns nc
of a
val pp : Stdlib.Format.formatter -> t -> unit
Pretty-print an array using the Format module.
val ppi : ?start:string ->
?rowstart:string ->
?stop:string ->
?rowstop:string ->
?sep:string ->
?rowsep:string ->
?item:(Stdlib.Format.formatter -> int -> int -> float -> unit) ->
unit -> Stdlib.Format.formatter -> t -> unit
val copy : t -> t
Creates a new array with the same contents as an existing one.
val blit : src:t -> dst:t -> unit
Copy the first array into the second one.
See
Bigarray.Genarray.blit
for more details.
val fill : t -> float -> unit
fill a c
sets all elements of a
to the constant c
.
val make_data : int -> int -> data
make m n
returns an uninitialized m
by n
array.
val wrap : data -> t
Creates a new matrix from an existing Sundials_RealArray2.data
array. Changes to
one affect the other since they share the same underlying storage.
val unwrap : t -> data
Returns the Sundials_RealArray2.data
array behind a matrix. Changes to one affect
the other since they share the same underlying storage. Note that the
array is accessed column-first, that is,
get a i j = (unwrap a).{j, i}
.