Module Sundials.Roots

module Roots: sig .. end

Vectors of root (zero-crossing) statuses.


type t 

Arrays that communicate the occurrence of zero-crossings. The underlying representation is hidden to isolate compatability issues related to integers.

type r = 
| NoRoot (*

No root was found on the corresponding function (0).

*)
| Rising (*

The corresponding root function is increasing (1).

*)
| Falling (*

The corresponding root function is decreasing (-1).

*)

Values indicating the status of root functions.

val create : int -> t

create n returns an array with n elements each set to NoRoot.

val make : int -> r -> t

make n x returns an array with n elements each set to x.

val init : int -> (int -> r) -> t

init n f returns an array with n elements, with element i set to f i.

val length : t -> int

Returns the length of an array.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print a root array using the Format module.

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

Pretty-print a root array using the Format module. The defaults are: start="[", stop="]", sep="; ", and item prints '_' for NoRoot, 'R' for Rising, and 'F' for Falling.

val detected : t -> int -> bool

Returns true only if the specified element is either Rising or Falling.

val rising : t -> int -> bool

Returns true only if the specified element is Rising.

val falling : t -> int -> bool

Returns true only if the specified element is Falling.

val get : t -> int -> r

get r i returns the ith element of r.

val set : t -> int -> r -> unit

set r i v sets the ith element of r to v.

val set_noroot : t -> int -> unit

set_noroot r i sets the ith element of r to NoRoot.

val set_rising : t -> int -> unit

set_rising r i sets the ith element of r to Rising.

val set_falling : t -> int -> unit

set_falling r i sets the ith element of r to Falling.

val fill : t -> r -> unit

fill a x sets all elements in a to x.

val copy : t -> t

Creates a new array with the same contents as an existing one.

val int_of_root : r -> int

Returns 0 for NoRoot, 1 for Rising, and -1 for Falling.

val reset : t -> unit

Resets all elements to NoRoot.

val exists : t -> bool

true if any elements are equal to Rising or Falling.

val iter : (r -> unit) -> t -> unit

iter f r successively applies f to each element in r.

val iteri : (int -> r -> unit) -> t -> unit

iteri f r successively applies f to the indexes and elements of r.

val of_list : r list -> t

Creates an array by copying the contents of a r list.

val to_list : t -> r list

Copies into a list.

val of_array : r array -> t

Creates a new value from the contents of an array.

val to_array : t -> r array

Creates a new array from the contents of a given value.