module Sundials_ROArray:sig..end
Read-only polymorphic arrays.
An immutable version of the Array module from the OCaml standard
library. Used when the values in an array are shared with the underlying C
library and must not be removed. Holding the values in the array stops
them from being garbage collected until the array is no longer required.
This, in turn, prevents the corresponding C values from being freed while
the array is still reachable.
type 'a t
An immutable array.
val from_array : 'a array -> 'a tCopy a mutable array into an immutable one.
val to_array : 'a t -> 'a arrayCopy an immutable array into a mutable one.
val length : 'a t -> intReturn the length of the array.
val get : 'a t -> int -> 'aReturn the element at the given index.
val init : int -> (int -> 'a) -> 'a tCreate an immutable array of the given length and apply a function to set each element.
val append : 'a t -> 'a t -> 'a tCreate a new immutable array by joining two existing ones.
val concat : 'a t list -> 'a tCreate a new immutable array by concatenating a list of existing ones.
val sub : 'a t -> int -> int -> 'a tCreate a new immutable array from a slice of an existing one.
val copy : 'a t -> 'a tCopy an immutable array.
val to_list : 'a t -> 'a listCopy the elements of an immutable array into a list.
val of_list : 'a list -> 'a tCopy the elements of a list into a new immutable array.
val iter : ('a -> unit) -> 'a t -> unitCall a function successively on elements of an immutable array
starting at index 0.
val iteri : (int -> 'a -> unit) -> 'a t -> unitCall a function successively on index values and elements of an
immutable array starting at index 0.
val map : ('a -> 'b) -> 'a t -> 'b tCreate a new immutable array by mapping a function across the elements of an existing one.
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b tCreate a new immutable array by mapping a function across the elements, and their indexes, of an existing one.
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aFold a function across the elements of an immutable array from the
0th element upward.
val fold_right : ('b -> 'a -> 'a) -> 'b t -> 'a -> 'aFold a function across the elements of an immutable array from the last element downward.
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unitCall a function successively on paired elements from two immutable arrays
starting at index 0.
Invalid_Argument if the arrays are not of the same size.val iteri2 : (int -> 'a -> 'b -> unit) ->
'a t -> 'b t -> unitCall a function successively on paired elements, and their indexes, from
two immutable arrays starting at index 0.
Invalid_Argument if the arrays are not of the same size.val map2 : ('a -> 'b -> 'c) ->
'a t -> 'b t -> 'c tCreate a new immutable array by mapping a function across the elements of two existing ones.
Invalid_Argument if the arrays are not of the same size.val fold_left2 : ('a -> 'b -> 'c -> 'a) ->
'a -> 'b t -> 'c t -> 'aFold a function across the elements of two immutable arrays from the
0th elements upward.
Invalid_Argument if the arrays are not of the same size.val for_all : ('a -> bool) -> 'a t -> boolReturns true only if a predicate is true for all elements of an immutable array.
val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> boolReturns true only if a predicate is true for all paired elements of two immutable arrays.
Invalid_Argument if the arrays are not of the same size.val exists : ('a -> bool) -> 'a t -> boolReturns true only if a predicate is true for at least one element of an immutable array.
val mem : 'a -> 'a t -> boolReturns true only if the immutable array contains an element that is structurally equal to the given one.
val memq : 'a -> 'a t -> boolReturns true only if the immutable array contains an element that is (physically) identical to the given one.
val iter3 : ('a -> 'b -> 'c -> unit) ->
'a t ->
'b t -> 'c t -> unitCall a function successively on triples from three immutable arrays
starting at index 0.
Invalid_Argument if the arrays are not of the same size.val iteri3 : (int -> 'a -> 'b -> 'c -> unit) ->
'a t ->
'b t -> 'c t -> unitCall a function successively on triples, and their indexes, from three
immutable arrays starting at index 0.
Invalid_Argument if the arrays are not of the same size.val map3 : ('a -> 'b -> 'c -> 'd) ->
'a t ->
'b t -> 'c t -> 'd tCreate a new immutable array by mapping a function across the elements of three existing ones.
Invalid_Argument if the arrays are not of the same size.val fold_left3 : ('a -> 'b -> 'c -> 'd -> 'a) ->
'a ->
'b t -> 'c t -> 'd t -> 'aFold a function across the elements of three immutable arrays from the
0th elements upward.
Invalid_Argument if the arrays are not of the same size.