package owl-base
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fb0578965c71b473315cc5b6aaffae79905dc0056926645faf1b5d80ed4041f1
md5=8693a75e8ee06c0ea000543ed9733359
doc/owl-base/Owl_utils_array/index.html
Module Owl_utils_array
Source
Basic functions
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
``min_i x`` returns the index of minimum value in array ``x``. If ``cmp`` is not passed in then ``Pervasives.compare`` is used as default value.
``max_i x`` returns the index of minimum value in array ``x``. If ``cmp`` is not passed in then ``Pervasives.compare`` is used as default value.
``argsort cmp x`` sorts ``x`` according to the compare function ``cmp`` and returns the corresponding indices.
Refer to OCaml native array.
Refer to OCaml native array.
Refer to OCaml native array.
``sort_fill ~min ~max ~fill x`` first sorts ``x``, then expands it to an array of length ``max - min + 1``, and fills the holes with ``fill``. E.g., ``sort_fill ~min:1 ~max:5 ~fill:0 |4;2|
x`` returns a new array as follows: ``|1; 0; 2; 0; 4; 5|
``.
Refer to OCaml native array.
Refer to OCaml native array.
Extended functions
Operator of array concatenation.
``get_slice slice x`` returns a copy of slice of ``x`` defined by ``slice``. The ``slice`` definition must have ``|start;stop;step|
`` format. The value of start, stop, and step can be negative, and the boundary is inclusive.
``set_slice slice x y`` sets the elements in ``x`` to the corresponding value of the elements in ``y`` based on the slice definition ``slice``. Please refer to ``get_slice`` function for the information on the format of slice definiton.
Flatten an array array into an array.
TODO
TODO
TODO
TODO
``unique x`` removes the duplicates in the array ``x``.
``merge x y`` merges two arrays and removes the duplicates.
TODO
TODO
``reverse x`` reverse the elements in ``x`` in place.
TODO
TODO
TODO
TODO
TODO
TODO
val iter4i :
(int -> 'a -> 'b -> 'c -> 'd -> unit) ->
'a array ->
'b array ->
'c array ->
'd array ->
unit
TODO
val iter4 :
('a -> 'b -> 'c -> 'd -> unit) ->
'a array ->
'b array ->
'c array ->
'd array ->
unit
TODO
TODO
val map2i_split2 :
(int -> 'a -> 'b -> 'c * 'd) ->
'a array ->
'b array ->
'c array * 'd array
TODO
TODO
TODO
val map4i :
(int -> 'a -> 'b -> 'c -> 'd -> 'e) ->
'a array ->
'b array ->
'c array ->
'd array ->
'e array
TODO
val map4 :
('a -> 'b -> 'c -> 'd -> 'e) ->
'a array ->
'b array ->
'c array ->
'd array ->
'e array
TODO
TODO
TODO
``filteri f x`` filters out the elements in ``x`` according to predicate ``f``.
``filter f x`` filters out the elements in ``x`` according to predicate ``f``.
``filter2i f x y`` filters the elements in ``x`` and ``y`` using passed in function ``f``. Both arrays must have same length.
``filter2 f x y`` is similar to ``filter2i`` but without passing index of the elements to function ``f``.
``filter2i_i f x y`` filters the elements in ``x`` and ``y`` using passed in function ``f``. Both arrays must have same length. Note that the indices of those satisfying the predicate ``f`` are returned in an array.
``filter2_i f x y`` is similar to ``filter2i_i`` but without passing index of the elements to function ``f``.
``filter2_split f x y`` is similar to ``filter2 f x y``, but the returned results are two separated arrays rather than merging into one tuple array.
``resize ~head v n x`` resizes ``x`` of length ``m`` to length ``n``. If ``m <= n``, a copy of ``x`` subarray is returned. If ``m > n``, then ``x`` is extended, the extra space is filled with value ``v``.
``fold2 a x y`` folds both ``x`` and ``y`` from left with starting value ``a``.
TODO
``align side v x y`` aligns two arrays ``x`` and ``y`` along the specified side with value ``v``. The copies of two arrays are returned.
val align3 :
[ `Left | `Right ] ->
'a ->
'a array ->
'a array ->
'a array ->
'a array * 'a array * 'a array
``align3 side v x y z`` aligns three arrays ``x``, ``y``, and ``z``.
TODO
TODO
TODO
TODO
``balance_last mass x`` performs the following function. Let ``l`` be the length of ``x``, if ``i < l - 1``, then ``x.(i) = x.(i)``, otherwise ``x.(l - 1) = mass - \sum_< l - 1 x.(i)``.
``index_of x a`` returns the index of first occurrence of ``a`` in ``x``.
Binary search. ``bsearch cmp x a`` returns the index of the largest value in the sorted array ``a`` less than or equal to ``x``, according to the comparison function ``cmp``. If ``x`` is smaller than all elements, returns -1. The function raises an exception if ``a`` is empty.
val to_string :
?prefix:string ->
?suffix:string ->
?sep:string ->
('a -> string) ->
'a array ->
string
TODO