package owl-base
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7e7725e9a1a967b2af54d7f091a0aea76c54e9abeb4220947921864ef6ffe7d0
md5=247e4b6e6190df68830095441e71e69a
doc/owl-base/Owl_utils_array/index.html
Module Owl_utils_array
Basic functions
Extended functions
``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.
``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``.
``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``.
``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.
``balance_last mass x`` performs the following function. Let ``k`` be the length of ``x``, if ``i < l - 1``, then ``x.(i) = x.(i)``, otherwise ``x.(l - 1) = mass - \sum x.(i)``.
``index_of x a`` returns the index of first occurrence of ``a`` in ``x``.