Module type Parallel_arrays.Reduce

type 'a t
val iter : Parallel_kernel.t @ local -> ('a t -> (f:(Parallel_kernel.t @ local -> ('a -> Base.unit) @ local) @ shareable -> Base.unit) @ local) @ local

iter parallel t ~f applies f to each element of t.

val iteri : Parallel_kernel.t @ local -> ('a t -> (f: (Parallel_kernel.t @ local -> (Base.int -> ('a -> Base.unit) @ local) @ local) @ shareable -> Base.unit) @ local) @ local

iteri parallel t ~f applies f to each element of t and its index.

val find : Parallel_kernel.t @ local -> ('a t -> (f:(Parallel_kernel.t @ local -> ('a -> Base.bool) @ local) @ shareable -> 'a Base.option) @ local) @ local

find parallel t ~f returns the first element of t for which f returns true, if it exists. f will always be applied to every element of t.

val findi : Parallel_kernel.t @ local -> ('a t -> (f: (Parallel_kernel.t @ local -> (Base.int -> ('a -> Base.bool) @ local) @ local) @ shareable -> 'a Base.option) @ local) @ local

findi parallel t ~f returns the first element of t for which f returns true, if it exists. f will always be applied to every element of t and its index.

val reduce : Parallel_kernel.t @ local -> ('a t -> (f: (Parallel_kernel.t @ local -> ('a @ shared -> ('a @ shared -> 'a) @ local) @ local) @ shareable -> 'a Base.option) @ local) @ local

reduce parallel t ~f folds f over the elements of t. f must be associative. If t is empty, reduce returns None.

val min_elt : Parallel_kernel.t @ local -> ('a t -> (compare: (Parallel_kernel.t @ local -> ('a @ local shared -> ('a @ local shared -> Base.int) @ local) @ local) @ shareable -> 'a Base.option) @ local) @ local

min_elt parallel t ~compare is the minimum element of t according to compare. If t is empty, returns None.

val max_elt : Parallel_kernel.t @ local -> ('a t -> (compare: (Parallel_kernel.t @ local -> ('a @ local shared -> ('a @ local shared -> Base.int) @ local) @ local) @ shareable -> 'a Base.option) @ local) @ local

max_elt parallel t ~compare is the maximum element of t according to compare. If t is empty, returns None.

val fold : Parallel_kernel.t @ local -> ('a t @ shared -> (init:(Base.unit -> 'acc) @ portable -> (f: (Parallel_kernel.t @ local -> ('acc -> ('a @ shared -> 'acc) @ local) @ local) @ shareable -> (combine: (Parallel_kernel.t @ local -> ('acc -> ('acc -> 'acc) @ local) @ local) @ shareable -> 'acc) @ local) @ local) @ local) @ local @@ portable

fold parallel t ~init ~f ~combine folds combine over the result of map parallel t ~f. combine must be associative and combine init x must equal x.

val foldi : Parallel_kernel.t @ local -> ('a t @ shared -> (init:(Base.unit -> 'acc) @ portable -> (f: (Parallel_kernel.t @ local -> (Base.int -> ('acc -> ('a @ shared -> 'acc) @ local) @ local) @ local) @ shareable -> (combine: (Parallel_kernel.t @ local -> ('acc -> ('acc -> 'acc) @ local) @ local) @ shareable -> 'acc) @ local) @ local) @ local) @ local @@ portable

foldi parallel t ~init ~f ~combine folds combine over the result of mapi parallel t ~f. combine must be associative and combine init x must equal x.