module Sundials_RealArray:sig
..end
Arrays of flaoting-point values.
typet =
(float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout)
Stdlib.Bigarray.Array1.t
A Bigarray of floats.
val make : int -> float -> t
make n x
returns an array with n
elements each set to x
.
val create : int -> t
create n
returns an uninitialized array with n
elements.
val empty : t
An array with no elements.
val get : t -> int -> float
get a i
returns the i
th element of a
.
val set : t -> int -> float -> unit
set a i v
sets the i
th element of a
to v
.
val init : int -> (int -> float) -> t
init n f
returns an array with n
elements, with element i
set to f i
.
val pp : Stdlib.Format.formatter -> t -> unit
Pretty-print an array using the Format module.
val ppi : ?start:string ->
?stop:string ->
?sep:string ->
?item:(Stdlib.Format.formatter -> int -> float -> unit) ->
unit -> Stdlib.Format.formatter -> t -> unit
val of_array : float array -> t
Creates an array by copying the contents of a
float array
.
val of_list : float list -> t
Creates an array by copying the contents of a
float list
.
val to_array : t -> float array
Copies into a new float array
.
val into_array : t -> float array -> unit
Copies into an existing
float array
.
val to_list : t -> float list
Copies into a float list
.
val copy : t -> t
Creates a new array with the same contents as an existing one.
val sub : t -> int -> int -> t
Access a sub-array of the given array without copying.
val blitn : src:t ->
?spos:int -> dst:t -> ?dpos:int -> int -> unit
blitn ~src ?spos ~dst ?dpos len
copies len
elements of src
at
offset spos
to dst
at offset dpos
.
The spos
and dpos
arguments are optional and default to zero.
Invalid_argument
"RealArray.nblit" if spos
, dpos
, and
len
do not specify valid subarrays of src
and dst
.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 -> ?pos:int -> ?len:int -> float -> unit
fill a c
sets elements of a
to the constant c
.
The elements from pos
to pos + len - 1
are set to the constant,
with pos
defaulting to 0 and len
to the length of the array.
val length : t -> int
Returns the length of an array.
val fold_left : ('a -> float -> 'a) -> 'a -> t -> 'a
fold_left f b a
returns f (f (f b a.{0}) a.{1}) ...)
.
val fold_right : (float -> 'a -> 'a) -> t -> 'a -> 'a
fold_right f b a
returns (f ... (f a.{n-2} (f a.{n-1} b)))
.
val iter : (float -> unit) -> t -> unit
iter f a
successively applies f
to the elements of a
.
val iteri : (int -> float -> unit) -> t -> unit
iteri f a
successively applies f
to the indexes and values
of a
.
val map : (float -> float) -> t -> unit
map f a
replaces each element a.{i}
with f a.{i}
.
val mapi : (int -> float -> float) -> t -> unit
map f a
replaces each element a.{i}
with f i a.{i}
.