Owl_view.Make
module A : Owl_types.Ndarray_Basic
val shape : t -> int array
Refer to :doc:`owl_dense_ndarray_generic`
val num_dims : t -> int
Refer to :doc:`owl_dense_ndarray_generic`
val nth_dim : t -> int -> int
Refer to :doc:`owl_dense_ndarray_generic`
val numel : t -> int
Refer to :doc:`owl_dense_ndarray_generic`
iteri f x
iterates and applies f
to every element in x
. f
has type f : int array -> elt -> unit
, the first parameter is index. 1d indices are passed to the user function.
mapi f x
applies f : int array -> elt -> elt
to every element in x
, then save the result in place. 1d indices are passed to the user function.
map f x
applies f : elt -> elt
to every element in x
, then save the the result in place in x
.
iter2 f x y
applies f : elt -> elt -> elt
every pair of elements in x
and y
. The indices are not passed in the user function.
map2 f x y
applies f : elt -> elt -> elt
every pair of elements in x
and y
, then saves the result in y
. So be careful with the order, it matters, the data reflected by view y
will be modified.
Similar to `iteri` but n-d indices are passed in. This function is much slower than `iteri`.
Similar to `mapi` but n-d indices are passed in. This function is much slower than `mapi`.
exists f x
checks all the elements in x
using f
. If at least one element satisfies f
then the function returns true
otherwise false
.
not_exists f x
checks all the elements in x
, the function returns true
only if all the elements fail to satisfy f : float -> bool
.
for_all f x
checks all the elements in x
, the function returns true
if and only if all the elements pass the check of function f
.