diff --git a/docs/owl-base/Owl_algodiff_check/Make/argument-1-AD/index.html b/docs/owl-base/Owl_algodiff_check/Make/argument-1-AD/index.html index ef19fbcc3..64ca52bd0 100644 --- a/docs/owl-base/Owl_algodiff_check/Make/argument-1-AD/index.html +++ b/docs/owl-base/Owl_algodiff_check/Make/argument-1-AD/index.html @@ -1,5 +1,5 @@ -
Make.AD
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+AD (owl-base.Owl_algodiff_check.Make.AD) Parameter Make.AD
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_algodiff_generic/Make/index.html b/docs/owl-base/Owl_algodiff_generic/Make/index.html
index bfcb7c31d..1c250b4f1 100644
--- a/docs/owl-base/Owl_algodiff_generic/Make/index.html
+++ b/docs/owl-base/Owl_algodiff_generic/Make/index.html
@@ -2,7 +2,7 @@
Make (owl-base.Owl_algodiff_generic.Make) Module Owl_algodiff_generic.Make
Parameters
module A : Owl_types_ndarray_algodiff.Sig
Signature
include Owl_algodiff_core_sig.Sig
with type A.arr = A.arr
with type A.elt = A.elt
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+ Owl_types_ndarray_algodiff.Sig with type arr = A.arr with type elt = A.elt
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_algodiff_generic_sig/module-type-Sig/index.html b/docs/owl-base/Owl_algodiff_generic_sig/module-type-Sig/index.html
index e5b464def..14201a47b 100644
--- a/docs/owl-base/Owl_algodiff_generic_sig/module-type-Sig/index.html
+++ b/docs/owl-base/Owl_algodiff_generic_sig/module-type-Sig/index.html
@@ -1,5 +1,5 @@
-Sig (owl-base.Owl_algodiff_generic_sig.Sig) Module type Owl_algodiff_generic_sig.Sig
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Sig (owl-base.Owl_algodiff_generic_sig.Sig) Module type Owl_algodiff_generic_sig.Sig
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_computation_engine/Flatten/argument-1-Engine/index.html b/docs/owl-base/Owl_computation_engine/Flatten/argument-1-Engine/index.html
index d99a285e3..fdf00c9cb 100644
--- a/docs/owl-base/Owl_computation_engine/Flatten/argument-1-Engine/index.html
+++ b/docs/owl-base/Owl_computation_engine/Flatten/argument-1-Engine/index.html
@@ -1,2 +1,2 @@
-Engine (owl-base.Owl_computation_engine.Flatten.Engine) Parameter Flatten.Engine
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
TODO
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
TODO
val eval_graph : Graph.graph -> unit
TODO
+Engine (owl-base.Owl_computation_engine.Flatten.Engine) Parameter Flatten.Engine
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
Execute actual computation included in each CGraph element (of output type ndarray) in an array.
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
Execute actual computation included in each CGraph element (of output type float) in an array.
val eval_graph : Graph.graph -> unit
Execute actual computation of a computation graph.
diff --git a/docs/owl-base/Owl_computation_engine/Flatten/index.html b/docs/owl-base/Owl_computation_engine/Flatten/index.html
index e66fc75cb..f53451776 100644
--- a/docs/owl-base/Owl_computation_engine/Flatten/index.html
+++ b/docs/owl-base/Owl_computation_engine/Flatten/index.html
@@ -1,5 +1,5 @@
-Flatten (owl-base.Owl_computation_engine.Flatten) Module Owl_computation_engine.Flatten
Parameters
module Engine : Owl_types_computation_engine.Sig
Signature
include module type of struct include Engine end
module Graph = Engine.Graph
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
TODO
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
TODO
val eval_graph : Graph.graph -> unit
TODO
include module type of struct include Graph end
module Optimiser = Graph.Optimiser
type graph = Engine.Graph.graph
val shape_or_value : Optimiser.Operator.Symbol.Shape.Type.t -> string
val graph_to_dot : graph -> string
val graph_to_trace : graph -> string
val collect_rvs :
+Flatten (owl-base.Owl_computation_engine.Flatten) Module Owl_computation_engine.Flatten
Parameters
module Engine : Owl_types_computation_engine.Sig
Signature
include module type of struct include Engine end
module Graph = Engine.Graph
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
Execute actual computation included in each CGraph element (of output type ndarray) in an array.
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
Execute actual computation included in each CGraph element (of output type float) in an array.
val eval_graph : Graph.graph -> unit
Execute actual computation of a computation graph.
include module type of struct include Graph end
module Optimiser = Graph.Optimiser
type graph = Engine.Graph.graph
val shape_or_value : Optimiser.Operator.Symbol.Shape.Type.t -> string
val graph_to_dot : graph -> string
val graph_to_trace : graph -> string
val collect_rvs :
Optimiser.Operator.Symbol.Shape.Type.attr Owl_graph.node array ->
Optimiser.Operator.Symbol.Shape.Type.attr Owl_graph.node array
val invalidate_rvs : graph -> unit
val make_graph :
input:Optimiser.Operator.Symbol.Shape.Type.attr Owl_graph.node array ->
diff --git a/docs/owl-base/Owl_computation_engine_sig/module-type-Flatten_Sig/index.html b/docs/owl-base/Owl_computation_engine_sig/module-type-Flatten_Sig/index.html
index be3377284..9639ed70f 100644
--- a/docs/owl-base/Owl_computation_engine_sig/module-type-Flatten_Sig/index.html
+++ b/docs/owl-base/Owl_computation_engine_sig/module-type-Flatten_Sig/index.html
@@ -1,5 +1,5 @@
-Flatten_Sig (owl-base.Owl_computation_engine_sig.Flatten_Sig) Module type Owl_computation_engine_sig.Flatten_Sig
include Owl_types_computation_engine.Sig
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
TODO
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
TODO
val eval_graph : Graph.graph -> unit
TODO
include Owl_computation_graph_sig.Sig
Type definition
Core functions
val shape_or_value : Optimiser.Operator.Symbol.Shape.Type.t -> string
TODO
val graph_to_dot : graph -> string
TODO
val graph_to_trace : graph -> string
TODO
val collect_rvs :
+Flatten_Sig (owl-base.Owl_computation_engine_sig.Flatten_Sig) Module type Owl_computation_engine_sig.Flatten_Sig
include Owl_types_computation_engine.Sig
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
Execute actual computation included in each CGraph element (of output type ndarray) in an array.
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
Execute actual computation included in each CGraph element (of output type float) in an array.
val eval_graph : Graph.graph -> unit
Execute actual computation of a computation graph.
include Owl_computation_graph_sig.Sig
Type definition
Core functions
val shape_or_value : Optimiser.Operator.Symbol.Shape.Type.t -> string
TODO
val graph_to_dot : graph -> string
TODO
val graph_to_trace : graph -> string
TODO
val collect_rvs :
Optimiser.Operator.Symbol.Shape.Type.attr Owl_graph.node array ->
Optimiser.Operator.Symbol.Shape.Type.attr Owl_graph.node array
TODO
val invalidate_rvs : graph -> unit
TODO
val make_graph :
input:Optimiser.Operator.Symbol.Shape.Type.attr Owl_graph.node array ->
diff --git a/docs/owl-base/Owl_lazy/Make/index.html b/docs/owl-base/Owl_lazy/Make/index.html
index 3793155bc..21b44bff7 100644
--- a/docs/owl-base/Owl_lazy/Make/index.html
+++ b/docs/owl-base/Owl_lazy/Make/index.html
@@ -1,82 +1,82 @@
-Make (owl-base.Owl_lazy.Make) Module Owl_lazy.Make
Parameters
module A : Owl_types.Ndarray_Mutable
Signature
Type definition
Type conversion functions
val value_to_float : value -> float
TODO
val node_to_arr : attr Owl_graph.node -> arr
TODO
val arr_to_node : arr -> attr Owl_graph.node
TODO
val node_to_elt : attr Owl_graph.node -> elt
TODO
val elt_to_node : elt -> attr Owl_graph.node
TODO
val float_to_elt : float -> elt
TODO
val elt_to_float : elt -> float
TODO
Utility functions
val graph_to_dot : graph -> string
TODO
val graph_to_trace : graph -> string
TODO
Create variables
val var_arr : ?shape:int array -> string -> arr
TODO
val var_elt : string -> elt
TODO
Maths functions
val empty : int array -> arr
TODO
val zeros : int array -> arr
TODO
val ones : int array -> arr
TODO
val shape : arr -> int array
TODO
val numel : arr -> int
TODO
val reset : arr -> unit
TODO
val lazy_print :
+Make (owl-base.Owl_lazy.Make) Module Owl_lazy.Make
Parameters
module A : Owl_types.Ndarray_Mutable
Signature
Type definition
Type conversion functions
val value_to_float : value -> float
TODO
val node_to_arr : attr Owl_graph.node -> arr
TODO
val arr_to_node : arr -> attr Owl_graph.node
TODO
val node_to_elt : attr Owl_graph.node -> elt
TODO
val elt_to_node : elt -> attr Owl_graph.node
TODO
val float_to_elt : float -> elt
TODO
val elt_to_float : elt -> float
TODO
Utility functions
val graph_to_dot : graph -> string
TODO
val graph_to_trace : graph -> string
TODO
Create variables
val var_arr : ?shape:int array -> string -> arr
TODO
val var_elt : string -> elt
TODO
Maths functions
val empty : int array -> arr
empty shape
creates an uninitialized array with the specified shape
.
val zeros : int array -> arr
zeros shape
creates an array of the specified shape
filled with zeros.
val ones : int array -> arr
ones shape
creates an array of the specified shape
filled with ones.
create shape value
creates an array of the specified shape
filled with the given value
.
sequential ?a ?step shape
creates an array of the specified shape
filled with sequential values starting from a
and incremented by step
.
uniform ?a ?b shape
creates an array of the specified shape
filled with values drawn from a uniform distribution between a
and b
.
gaussian ?mu ?sigma shape
creates an array of the specified shape
filled with values drawn from a Gaussian distribution with mean mu
and standard deviation sigma
.
bernoulli ?p shape
creates an array of the specified shape
filled with values drawn from a Bernoulli distribution with probability p
.
init shape f
creates an array of the specified shape
where each element is initialized by the function f
, which takes the index of the element as input.
val shape : arr -> int array
shape arr
returns the shape of the array arr
.
val numel : arr -> int
numel arr
returns the total number of elements in the array arr
.
get arr indices
retrieves the value at the specified indices
from the array arr
.
set arr indices value
sets the value at the specified indices
in the array arr
to value
.
get_slice slice_spec arr
extracts a slice from the array arr
according to the slice specification slice_spec
.
set_slice slice_spec src dst
sets the specified slice in the array dst
to the values from src
according to the slice specification slice_spec
.
val reset : arr -> unit
reset arr
resets all elements in the array arr
to zero.
reshape arr shape
returns a new array with the elements of arr
rearranged into the specified shape
.
reverse arr
returns a new array with the elements of arr
reversed along all axes.
tile arr reps
creates a new array by repeating the array arr
according to the repetition pattern reps
.
repeat arr reps
repeats the elements of arr
along each axis according to the repetition pattern reps
.
concatenate ?axis arrs
concatenates the arrays in arrs
along the specified axis
.
split ?axis indices arr
splits the array arr
into multiple sub-arrays along the specified axis
at the given indices
.
draw ?axis arr n
randomly selects n
elements from the array arr
along the specified axis
, returning the selected elements and their corresponding indices.
map f arr
applies the function f
to each element of the array arr
, returning a new array with the results.
fold ?axis f init arr
reduces the array arr
along the specified axis
using the function f
, starting with the initial value init
.
scan ?axis f arr
performs a cumulative reduction of the array arr
along the specified axis
using the function f
.
one_hot depth arr
converts the array arr
into a one-hot encoded array with the specified depth.
val lazy_print :
?max_row:int ->
?max_col:int ->
?header:bool ->
?fmt:(A.elt -> string) ->
arr ->
- arr
TODO
val conv1d : ?padding:Owl_types.padding -> arr -> arr -> int array -> arr
TODO
val conv2d : ?padding:Owl_types.padding -> arr -> arr -> int array -> arr
TODO
val conv3d : ?padding:Owl_types.padding -> arr -> arr -> int array -> arr
TODO
val transpose_conv2d :
+ arr
lazy_print ?max_row ?max_col ?header ?fmt arr
returns a formatted string representation of the array arr
, potentially truncated based on max_row
and max_col
, with an optional header
and custom formatting function fmt
. The array itself is returned unchanged.
print ?max_row ?max_col ?header ?fmt arr
prints a formatted string representation of the array arr
to the standard output, potentially truncated based on max_row
and max_col
, with an optional header
and custom formatting function fmt
.
abs arr
returns a new array where each element is the absolute value of the corresponding element in arr
.
neg arr
returns a new array where each element is the negation of the corresponding element in arr
.
floor arr
returns a new array where each element is the floor of the corresponding element in arr
.
ceil arr
returns a new array where each element is the ceiling of the corresponding element in arr
.
round arr
returns a new array where each element is rounded to the nearest integer.
sqr arr
returns a new array where each element is the square of the corresponding element in arr
.
sqrt arr
returns a new array where each element is the square root of the corresponding element in arr
.
log arr
returns a new array where each element is the natural logarithm of the corresponding element in arr
.
log2 arr
returns a new array where each element is the base-2 logarithm of the corresponding element in arr
.
log10 arr
returns a new array where each element is the base-10 logarithm of the corresponding element in arr
.
exp arr
returns a new array where each element is the exponential of the corresponding element in arr
.
sin arr
returns a new array where each element is the sine of the corresponding element in arr
.
cos arr
returns a new array where each element is the cosine of the corresponding element in arr
.
tan arr
returns a new array where each element is the tangent of the corresponding element in arr
.
sinh arr
returns a new array where each element is the hyperbolic sine of the corresponding element in arr
.
cosh arr
returns a new array where each element is the hyperbolic cosine of the corresponding element in arr
.
tanh arr
returns a new array where each element is the hyperbolic tangent of the corresponding element in arr
.
asin arr
returns a new array where each element is the arc sine of the corresponding element in arr
.
acos arr
returns a new array where each element is the arc cosine of the corresponding element in arr
.
atan arr
returns a new array where each element is the arc tangent of the corresponding element in arr
.
asinh arr
returns a new array where each element is the inverse hyperbolic sine of the corresponding element in arr
.
acosh arr
returns a new array where each element is the inverse hyperbolic cosine of the corresponding element in arr
.
atanh arr
returns a new array where each element is the inverse hyperbolic tangent of the corresponding element in arr
.
min ?axis ?keep_dims arr
returns the minimum value along the specified axis in the array arr
.
max ?axis ?keep_dims arr
returns the maximum value along the specified axis in the array arr
.
sum ?axis ?keep_dims arr
returns the sum of elements along the specified axis in the array arr
.
sum_reduce ?axis arr
reduces the array arr
by summing along the specified axes.
signum arr
returns a new array where each element is the sign of the corresponding element in arr
.
sigmoid arr
returns a new array where each element is the sigmoid function applied to the corresponding element in arr
.
relu arr
returns a new array where each element is the result of applying the ReLU (Rectified Linear Unit) function to the corresponding element in arr
.
l1norm' arr
returns the L1 norm (sum of absolute values) of all elements in the array arr
.
l2norm' arr
returns the L2 norm (Euclidean norm) of all elements in the array arr
.
l2norm_sqr' arr
returns the squared L2 norm of all elements in the array arr
.
clip_by_value ?amin ?amax arr
clips the values in the array arr
to be within the range amin, amax
.
clip_by_l2norm max_norm arr
clips the values in the array arr
so that its L2 norm does not exceed max_norm
.
pow arr1 arr2
returns a new array where each element is the result of raising the corresponding element in arr1
to the power of the corresponding element in arr2
.
scalar_pow scalar arr
returns a new array where each element in arr
is raised to the power of scalar
.
pow_scalar arr scalar
returns a new array where each element in arr
is raised to the power of scalar
.
atan2 arr1 arr2
returns a new array where each element is the result of applying the two-argument arctangent function to the corresponding elements in arr1
and arr2
.
scalar_atan2 scalar arr
returns a new array where each element is the result of applying the two-argument arctangent function to scalar
and the corresponding element in arr
.
atan2_scalar arr scalar
returns a new array where each element is the result of applying the two-argument arctangent function to the corresponding element in arr
and scalar
.
hypot arr1 arr2
returns a new array where each element is the result of applying the hypotenuse function to the corresponding elements in arr1
and arr2
.
min2 arr1 arr2
returns a new array where each element is the minimum of the corresponding elements in arr1
and arr2
.
max2 arr1 arr2
returns a new array where each element is the maximum of the corresponding elements in arr1
and arr2
.
add arr1 arr2
returns a new array where each element is the sum of the corresponding elements in arr1
and arr2
.
sub arr1 arr2
returns a new array where each element is the difference between the corresponding elements in arr1
and arr2
.
mul arr1 arr2
returns a new array where each element is the product of the corresponding elements in arr1
and arr2
.
div arr1 arr2
returns a new array where each element is the quotient of the corresponding elements in arr1
and arr2
.
add_scalar arr scalar
returns a new array where each element in arr
is incremented by scalar
.
sub_scalar arr scalar
returns a new array where each element in arr
is decremented by scalar
.
mul_scalar arr scalar
returns a new array where each element in arr
is multiplied by scalar
.
div_scalar arr scalar
returns a new array where each element in arr
is divided by scalar
.
scalar_add scalar arr
returns a new array where scalar
is added to each element in arr
.
scalar_sub scalar arr
returns a new array where scalar
is subtracted from each element in arr
.
scalar_mul scalar arr
returns a new array where each element in arr
is multiplied by scalar
.
scalar_div scalar arr
returns a new array where scalar
is divided by each element in arr
.
fma arr1 arr2 arr3
returns a new array where each element is the result of a fused multiply-add operation applied to the corresponding elements in arr1
, arr2
, and arr3
.
elt_equal arr1 arr2
returns a new array where each element is 1
if the corresponding elements in arr1
and arr2
are equal, otherwise 0
.
elt_not_equal arr1 arr2
returns a new array where each element is 1
if the corresponding elements in arr1
and arr2
are not equal, otherwise 0
.
elt_less arr1 arr2
returns a new array where each element is 1
if the corresponding element in arr1
is less than the corresponding element in arr2
, otherwise 0
.
elt_greater arr1 arr2
returns a new array where each element is 1
if the corresponding element in arr1
is greater than the corresponding element in arr2
, otherwise 0
.
elt_less_equal arr1 arr2
returns a new array where each element is 1
if the corresponding element in arr1
is less than or equal to the corresponding element in arr2
, otherwise 0
.
elt_greater_equal arr1 arr2
returns a new array where each element is 1
if the corresponding element in arr1
is greater than or equal to the corresponding element in arr2
, otherwise 0
.
elt_equal_scalar arr scalar
returns a new array where each element is 1
if the corresponding element in arr
is equal to scalar
, otherwise 0
.
elt_not_equal_scalar arr scalar
returns a new array where each element is 1
if the corresponding element in arr
is not equal to scalar
, otherwise 0
.
elt_less_scalar arr scalar
returns a new array where each element is 1
if the corresponding element in arr
is less than scalar
, otherwise 0
.
elt_greater_scalar arr scalar
returns a new array where each element is 1
if the corresponding element in arr
is greater than scalar
, otherwise 0
.
elt_less_equal_scalar arr scalar
returns a new array where each element is 1
if the corresponding element in arr
is less than or equal to scalar
, otherwise 0
.
elt_greater_equal_scalar arr scalar
returns a new array where each element is 1
if the corresponding element in arr
is greater than or equal to scalar
, otherwise 0
.
val conv1d : ?padding:Owl_types.padding -> arr -> arr -> int array -> arr
conv1d ?padding kernel arr stride
performs a 1D convolution of the array arr
with the kernel kernel
, using the specified stride and optional padding.
val conv2d : ?padding:Owl_types.padding -> arr -> arr -> int array -> arr
conv2d ?padding kernel arr stride
performs a 2D convolution of the array arr
with the kernel kernel
, using the specified stride and optional padding.
val conv3d : ?padding:Owl_types.padding -> arr -> arr -> int array -> arr
conv3d ?padding kernel arr stride
performs a 3D convolution of the array arr
with the kernel kernel
, using the specified stride and optional padding.
val transpose_conv2d :
?padding:Owl_types.padding ->
arr ->
arr ->
int array ->
- arr
TODO
val max_pool1d :
+ arr
transpose_conv2d ?padding kernel arr stride
performs a 2D transposed convolution (also known as a deconvolution) of the array arr
with the kernel kernel
, using the specified stride and optional padding.
val max_pool1d :
?padding:Owl_types.padding ->
arr ->
int array ->
int array ->
- arr
TODO
val max_pool2d :
+ arr
max_pool1d ?padding arr size stride
performs a 1D max pooling operation on the array arr
using the specified size and stride, with optional padding.
val max_pool2d :
?padding:Owl_types.padding ->
arr ->
int array ->
int array ->
- arr
TODO
val max_pool3d :
+ arr
max_pool2d ?padding arr size stride
performs a 2D max pooling operation on the array arr
using the specified size and stride, with optional padding.
val max_pool3d :
?padding:Owl_types.padding ->
arr ->
int array ->
int array ->
- arr
TODO
val avg_pool1d :
+ arr
max_pool3d ?padding arr size stride
performs a 3D max pooling operation on the array arr
using the specified size and stride, with optional padding.
val avg_pool1d :
?padding:Owl_types.padding ->
arr ->
int array ->
int array ->
- arr
TODO
val avg_pool2d :
+ arr
avg_pool1d ?padding arr size stride
performs a 1D average pooling operation on the array arr
using the specified size and stride, with optional padding.
val avg_pool2d :
?padding:Owl_types.padding ->
arr ->
int array ->
int array ->
- arr
TODO
val avg_pool3d :
+ arr
avg_pool2d ?padding arr size stride
performs a 2D average pooling operation on the array arr
using the specified size and stride, with optional padding.
val avg_pool3d :
?padding:Owl_types.padding ->
arr ->
int array ->
int array ->
- arr
TODO
val max_pool1d_backward :
+ arr
avg_pool3d ?padding arr size stride
performs a 3D average pooling operation on the array arr
using the specified size and stride, with optional padding.
conv1d_backward_input kernel output_grad stride input_grad
computes the gradient of the input with respect to the 1D convolution, given the kernel, output gradient, and stride.
conv1d_backward_kernel input output_grad stride kernel_grad
computes the gradient of the kernel with respect to the 1D convolution, given the input, output gradient, and stride.
conv2d_backward_input kernel output_grad stride input_grad
computes the gradient of the input with respect to the 2D convolution, given the kernel, output gradient, and stride.
conv2d_backward_kernel input output_grad stride kernel_grad
computes the gradient of the kernel with respect to the 2D convolution, given the input, output gradient, and stride.
conv3d_backward_input kernel output_grad stride input_grad
computes the gradient of the input with respect to the 3D convolution, given the kernel, output gradient, and stride.
conv3d_backward_kernel input output_grad stride kernel_grad
computes the gradient of the kernel with respect to the 3D convolution, given the input, output gradient, and stride.
transpose_conv2d_backward_input kernel output_grad stride input_grad
computes the gradient of the input with respect to the 2D transposed convolution, given the kernel, output gradient, and stride.
transpose_conv2d_backward_kernel input output_grad stride kernel_grad
computes the gradient of the kernel with respect to the 2D transposed convolution, given the input, output gradient, and stride.
val max_pool1d_backward :
Owl_types.padding ->
arr ->
int array ->
int array ->
arr ->
- arr
TODO
val max_pool2d_backward :
+ arr
max_pool1d_backward padding input size stride output_grad
computes the gradient of the input with respect to the 1D max pooling operation, given the padding, input, size, stride, and output gradient.
val max_pool2d_backward :
Owl_types.padding ->
arr ->
int array ->
int array ->
arr ->
- arr
TODO
val max_pool3d_backward :
+ arr
max_pool2d_backward padding input size stride output_grad
computes the gradient of the input with respect to the 2D max pooling operation, given the padding, input, size, stride, and output gradient.
val max_pool3d_backward :
Owl_types.padding ->
arr ->
int array ->
int array ->
arr ->
- arr
TODO
val avg_pool1d_backward :
+ arr
max_pool3d_backward padding input size stride output_grad
computes the gradient of the input with respect to the 3D max pooling operation, given the padding, input, size, stride, and output gradient.
val avg_pool1d_backward :
Owl_types.padding ->
arr ->
int array ->
int array ->
arr ->
- arr
TODO
val avg_pool2d_backward :
+ arr
avg_pool1d_backward padding input size stride output_grad
computes the gradient of the input with respect to the 1D average pooling operation, given the padding, input, size, stride, and output gradient.
val avg_pool2d_backward :
Owl_types.padding ->
arr ->
int array ->
int array ->
arr ->
- arr
TODO
val avg_pool3d_backward :
+ arr
avg_pool2d_backward padding input size stride output_grad
computes the gradient of the input with respect to the 2D average pooling operation, given the padding, input, size, stride, and output gradient.
val avg_pool3d_backward :
Owl_types.padding ->
arr ->
int array ->
int array ->
arr ->
- arr
TODO
val row_num : arr -> int
TODO
val col_num : arr -> int
TODO
val copy_row_to : arr -> 'a -> 'b -> unit
TODO
val copy_col_to : arr -> 'a -> 'b -> unit
TODO
val to_rows : arr -> 'a array
TODO
val to_cols : arr -> 'a array
TODO
Evaluation functions
val make_graph :
+ arr
avg_pool3d_backward padding input size stride output_grad
computes the gradient of the input with respect to the 3D average pooling operation, given the padding, input, size, stride, and output gradient.
val row_num : arr -> int
row_num arr
returns the number of rows in the array arr
.
val col_num : arr -> int
col_num arr
returns the number of columns in the array arr
.
rows arr indices
returns the rows of the array arr
specified by indices
.
val copy_row_to : arr -> 'a -> 'b -> unit
copy_row_to src src_index dst
copies the row at index src_index
in the array src
to the array dst
.
val copy_col_to : arr -> 'a -> 'b -> unit
copy_col_to src src_index dst
copies the column at index src_index
in the array src
to the array dst
.
transpose ?axis arr
returns a new array where the axes of the array arr
are transposed according to axis
.
val to_rows : arr -> 'a array
to_rows arr
converts the array arr
into an array of rows.
val to_cols : arr -> 'a array
to_cols arr
converts the array arr
into an array of columns.
of_array data shape
creates an array of the specified shape
from the 1D array data
.
Evaluation functions
val make_graph :
input:attr Owl_graph.node array ->
output:attr Owl_graph.node array ->
string ->
diff --git a/docs/owl-base/Owl_maths_interpolate/index.html b/docs/owl-base/Owl_maths_interpolate/index.html
index 7b2126c15..d0e18e3e1 100644
--- a/docs/owl-base/Owl_maths_interpolate/index.html
+++ b/docs/owl-base/Owl_maths_interpolate/index.html
@@ -1,2 +1,2 @@
-Owl_maths_interpolate (owl-base.Owl_maths_interpolate) Module Owl_maths_interpolate
Interpolation and Extrapolation
polint xs ys x
performs polynomial interpolation of the given arrays xs
and ys
. Given arrays xs[0..(n-1)]
and ys[0..(n-1)]
, and a value x
, the function returns a value y
, and an error estimate dy
. If P(x)
is the polynomial of degree N − 1
such that P(xs[i]) = ys[i]
for i = 0,...,n-1
,
Parameters: * xs
: an array of input x
values of P(x)
. * ys
: an array of corresponding y
values of P(x)
. * x
: value to interpolate.
Returns: * (y, dy)
wherein y
is the returned value y = P(x)
, and dy
is the estimated error.
+Owl_maths_interpolate (owl-base.Owl_maths_interpolate) Module Owl_maths_interpolate
Interpolation and Extrapolation
polint xs ys x
performs polynomial interpolation of the given arrays xs
and ys
. Given arrays xs[0..(n-1)]
and ys[0..(n-1)]
, and a value x
, the function returns a value y
, and an error estimate dy
. If P(x)
is the polynomial of degree N − 1
such that P(xs[i]) = ys[i]
for i = 0,...,n-1
,
Parameters: * xs
: an array of input x
values of P(x)
. * ys
: an array of corresponding y
values of P(x)
. * x
: value to interpolate.
Returns: * (y, dy)
wherein y
is the returned value y = P(x)
, and dy
is the estimated error.
ratint xs ys x
performs rational function interpolation on the data points given by xs
and ys
, and returns the interpolated value at the point x
, along with an estimate of the error.
This function fits a rational function (a ratio of two polynomials) to the provided data points. It is particularly useful when the data exhibits behavior that might be better captured by such a function, especially in cases where the data might have singularities or steep gradients.
The function raises an exception if the lengths of xs
and ys
do not match, or if a pole is encountered during the interpolation process.
Parameters:
diff --git a/docs/owl-base/Owl_neural_compiler/Make/argument-1-E/index.html b/docs/owl-base/Owl_neural_compiler/Make/argument-1-E/index.html
index 3723a5dd1..4c1700c54 100644
--- a/docs/owl-base/Owl_neural_compiler/Make/argument-1-E/index.html
+++ b/docs/owl-base/Owl_neural_compiler/Make/argument-1-E/index.html
@@ -1,2 +1,2 @@
-E (owl-base.Owl_neural_compiler.Make.E) Parameter Make.E
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
TODO
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
TODO
val eval_graph : Graph.graph -> unit
TODO
+E (owl-base.Owl_neural_compiler.Make.E) Parameter Make.E
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
Execute actual computation included in each CGraph element (of output type ndarray) in an array.
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
Execute actual computation included in each CGraph element (of output type float) in an array.
val eval_graph : Graph.graph -> unit
Execute actual computation of a computation graph.
diff --git a/docs/owl-base/Owl_neural_generic/Flatten/argument-1-Graph/Neuron/Optimise/Algodiff/index.html b/docs/owl-base/Owl_neural_generic/Flatten/argument-1-Graph/Neuron/Optimise/Algodiff/index.html
index ca1e3605b..895b1edc4 100644
--- a/docs/owl-base/Owl_neural_generic/Flatten/argument-1-Graph/Neuron/Optimise/Algodiff/index.html
+++ b/docs/owl-base/Owl_neural_generic/Flatten/argument-1-Graph/Neuron/Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_neural_generic.Flatten.Graph.Neuron.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_neural_generic.Flatten.Graph.Neuron.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_neural_graph/Make/argument-1-Neuron/Optimise/Algodiff/index.html b/docs/owl-base/Owl_neural_graph/Make/argument-1-Neuron/Optimise/Algodiff/index.html
index b3b343e1c..9f98a65ed 100644
--- a/docs/owl-base/Owl_neural_graph/Make/argument-1-Neuron/Optimise/Algodiff/index.html
+++ b/docs/owl-base/Owl_neural_graph/Make/argument-1-Neuron/Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_neural_graph.Make.Neuron.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_neural_graph.Make.Neuron.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_neural_graph_sig/module-type-Sig/Neuron/Optimise/Algodiff/index.html b/docs/owl-base/Owl_neural_graph_sig/module-type-Sig/Neuron/Optimise/Algodiff/index.html
index 9b23ad7d5..056b2af84 100644
--- a/docs/owl-base/Owl_neural_graph_sig/module-type-Sig/Neuron/Optimise/Algodiff/index.html
+++ b/docs/owl-base/Owl_neural_graph_sig/module-type-Sig/Neuron/Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_neural_graph_sig.Sig.Neuron.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_neural_graph_sig.Sig.Neuron.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_neural_neuron/Make/argument-1-Optimise/Algodiff/index.html b/docs/owl-base/Owl_neural_neuron/Make/argument-1-Optimise/Algodiff/index.html
index 2c9d2f895..b20fb4a98 100644
--- a/docs/owl-base/Owl_neural_neuron/Make/argument-1-Optimise/Algodiff/index.html
+++ b/docs/owl-base/Owl_neural_neuron/Make/argument-1-Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_neural_neuron.Make.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_neural_neuron.Make.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_neural_neuron_sig/module-type-Sig/Optimise/Algodiff/index.html b/docs/owl-base/Owl_neural_neuron_sig/module-type-Sig/Optimise/Algodiff/index.html
index 953876238..8ae5f5456 100644
--- a/docs/owl-base/Owl_neural_neuron_sig/module-type-Sig/Optimise/Algodiff/index.html
+++ b/docs/owl-base/Owl_neural_neuron_sig/module-type-Sig/Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_neural_neuron_sig.Sig.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_neural_neuron_sig.Sig.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_optimise_generic/Make/argument-1-Algodiff/index.html b/docs/owl-base/Owl_optimise_generic/Make/argument-1-Algodiff/index.html
index cf40a37d9..b0e74ba49 100644
--- a/docs/owl-base/Owl_optimise_generic/Make/argument-1-Algodiff/index.html
+++ b/docs/owl-base/Owl_optimise_generic/Make/argument-1-Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_optimise_generic.Make.Algodiff) Parameter Make.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_optimise_generic.Make.Algodiff) Parameter Make.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_optimise_generic_sig/module-type-Sig/Algodiff/index.html b/docs/owl-base/Owl_optimise_generic_sig/module-type-Sig/Algodiff/index.html
index b74f6483b..3f0bd6ef8 100644
--- a/docs/owl-base/Owl_optimise_generic_sig/module-type-Sig/Algodiff/index.html
+++ b/docs/owl-base/Owl_optimise_generic_sig/module-type-Sig/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl-base.Owl_optimise_generic_sig.Sig.Algodiff) Module Sig.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl-base.Owl_optimise_generic_sig.Sig.Algodiff) Module Sig.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl-base/Owl_types_computation_engine/module-type-Sig/index.html b/docs/owl-base/Owl_types_computation_engine/module-type-Sig/index.html
index a7656b9b3..d190f5c0d 100644
--- a/docs/owl-base/Owl_types_computation_engine/module-type-Sig/index.html
+++ b/docs/owl-base/Owl_types_computation_engine/module-type-Sig/index.html
@@ -1,2 +1,2 @@
-Sig (owl-base.Owl_types_computation_engine.Sig) Module type Owl_types_computation_engine.Sig
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
TODO
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
TODO
val eval_graph : Graph.graph -> unit
TODO
+Sig (owl-base.Owl_types_computation_engine.Sig) Module type Owl_types_computation_engine.Sig
module Graph : Owl_computation_graph_sig.Sig
Core evaluation functions of the engine
val eval_arr : Graph.Optimiser.Operator.Symbol.Shape.Type.arr array -> unit
Execute actual computation included in each CGraph element (of output type ndarray) in an array.
val eval_elt : Graph.Optimiser.Operator.Symbol.Shape.Type.elt array -> unit
Execute actual computation included in each CGraph element (of output type float) in an array.
val eval_graph : Graph.graph -> unit
Execute actual computation of a computation graph.
diff --git a/docs/owl-base/Owl_utils_array/index.html b/docs/owl-base/Owl_utils_array/index.html
index 961df0cb6..8ea9bd107 100644
--- a/docs/owl-base/Owl_utils_array/index.html
+++ b/docs/owl-base/Owl_utils_array/index.html
@@ -1,53 +1,53 @@
-Owl_utils_array (owl-base.Owl_utils_array) Module Owl_utils_array
Basic functions
min_i x
returns the index of minimum value in array x
. If cmp
is not passed in then Stdlib.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 Stdlib.compare
is used as default value.
argsort cmp x
sorts x
according to the compare function cmp
and returns the corresponding indices.
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|]
.
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 definition.
val iter3i :
+Owl_utils_array (owl-base.Owl_utils_array) Module Owl_utils_array
Basic functions
min_i x
returns the index of minimum value in array x
. If cmp
is not passed in then Stdlib.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 Stdlib.compare
is used as default value.
argsort cmp x
sorts x
according to the compare function cmp
and returns the corresponding indices.
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|]
.
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 definition.
set_n arr indices v
sets the elements at the positions specified by indices
in the array arr
to the value v
.
range start stop
generates an array of integers from start
to stop
inclusive.
count arr x
counts the number of occurrences of the value x
in the array arr
.
insert arr1 arr2 pos
inserts the elements of arr2
into arr1
at the specified position pos
.
remove arr pos
removes the element at position pos
from the array arr
.
replace pos len arr1 arr2
replaces the subarray of length len
starting at pos
in arr1
with the elements from arr2
.
mapi f arr
applies the function f
to each element of the array arr
, passing the index of the element as the first argument to f
, and returns a new array of the results.
map f arr
applies the function f
to each element of the array arr
and returns a new array of the results.
iter2i f arr1 arr2
applies the function f
to each pair of corresponding elements from arr1
and arr2
, passing the index as the first argument to f
.
iter2 f arr1 arr2
applies the function f
to each pair of corresponding elements from arr1
and arr2
.
iter3i f arr1 arr2 arr3
applies the function f
to each triplet of corresponding elements from arr1
, arr2
, and arr3
, passing the index as the first argument to f
.
iter3 f arr1 arr2 arr3
applies the function f
to each triplet of corresponding elements from arr1
, arr2
, and arr3
.
val iter4i :
(int -> 'a -> 'b -> 'c -> 'd -> unit) ->
'a array ->
'b array ->
'c array ->
'd array ->
- unit
TODO
iter4i f arr1 arr2 arr3 arr4
applies the function f
to each group of corresponding elements from arr1
, arr2
, arr3
, and arr4
, passing the index of the elements as the first argument to f
.
val iter4 :
('a -> 'b -> 'c -> 'd -> unit) ->
'a array ->
'b array ->
'c array ->
'd array ->
- unit
TODO
iter4 f arr1 arr2 arr3 arr4
applies the function f
to each group of corresponding elements from arr1
, arr2
, arr3
, and arr4
.
map2i f arr1 arr2
applies the function f
to each pair of corresponding elements from arr1
and arr2
, passing the index of the elements as the first argument to f
, and returns an array of the results.
TODO
map2i_split2 f arr1 arr2
applies the function f
to each pair of corresponding elements from arr1
and arr2
, passing the index of the elements as the first argument to f
, and returns a tuple of two arrays containing the first and second elements of the results of f
.
map3i f arr1 arr2 arr3
applies the function f
to each triplet of corresponding elements from arr1
, arr2
, and arr3
, passing the index of the elements as the first argument to f
, and returns an array of the results.
map3 f arr1 arr2 arr3
applies the function f
to each triplet of corresponding elements from arr1
, arr2
, and arr3
, and returns an array of the results.
val map4i :
(int -> 'a -> 'b -> 'c -> 'd -> 'e) ->
'a array ->
'b array ->
'c array ->
'd array ->
- 'e array
TODO
map4i f arr1 arr2 arr3 arr4
applies the function f
to each group of corresponding elements from arr1
, arr2
, arr3
, and arr4
, passing the index of the elements as the first argument to f
, and returns an array of the results.
val map4 :
('a -> 'b -> 'c -> 'd -> 'e) ->
'a array ->
'b array ->
'c array ->
'd array ->
- 'e array
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
.
map4 f arr1 arr2 arr3 arr4
applies the function f
to each group of corresponding elements from arr1
, arr2
, arr3
, and arr4
, and returns an array of the results.
filteri_v f arr
applies the function f
to each element of arr
, passing the index of the element as the first argument to f
. The function f
returns a pair of a boolean and a value. If the boolean is true
, the value is included in the result array.
filter_v f arr
applies the function f
to each element of arr
. The function f
returns a pair of a boolean and a value. If the boolean is true
, the value is included in the result array.
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
.
val filter2i :
(int -> 'a -> 'b -> bool) ->
'a array ->
'b array ->
@@ -55,7 +55,7 @@
('a -> 'b -> bool) ->
'a array ->
'b array ->
- 'a array * 'b array
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
.
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
.
pad side v len arr
pads the array arr
with the value v
on the specified side (`Left` or `Right`) until the array reaches the desired length len
.
If len
is less than or equal to the length of arr
, the original array is returned.
val align :
[ `Left | `Right ] ->
'a ->
'a array ->
@@ -66,10 +66,10 @@
'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
.
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_{i < l - 1} x.(i)
.
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.
align3 side v x y z
aligns three arrays x
, y
, and z
.
greater_equal arr1 arr2
returns true
if all elements in arr1
are greater than or equal to the corresponding elements in arr2
, and false
otherwise.
swap arr i j
swaps the elements at indices i
and j
in the array arr
.
permute indices arr
rearranges the elements of arr
according to the order specified by indices
, returning a new array with the permuted elements.
of_tuples arr
converts an array of pairs into an array containing all the first elements followed by all the second elements of the pairs in arr
.
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_{i < l - 1} x.(i)
.
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.
+ string
to_string ?prefix ?suffix ?sep f arr
converts the array arr
to a string representation, applying the function f
to each element to produce a string. The elements are separated by sep
(default is ", "), and the entire output is optionally wrapped with prefix
and suffix
.
diff --git a/docs/owl/Owl_regression_generic/Make/argument-1-Optimise/Algodiff/index.html b/docs/owl/Owl_regression_generic/Make/argument-1-Optimise/Algodiff/index.html
index 928b2ebaf..ed2700a91 100644
--- a/docs/owl/Owl_regression_generic/Make/argument-1-Optimise/Algodiff/index.html
+++ b/docs/owl/Owl_regression_generic/Make/argument-1-Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl.Owl_regression_generic.Make.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl.Owl_regression_generic.Make.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/docs/owl/Owl_regression_generic_sig/module-type-Sig/Optimise/Algodiff/index.html b/docs/owl/Owl_regression_generic_sig/module-type-Sig/Optimise/Algodiff/index.html
index cf5701dde..63de134ab 100644
--- a/docs/owl/Owl_regression_generic_sig/module-type-Sig/Optimise/Algodiff/index.html
+++ b/docs/owl/Owl_regression_generic_sig/module-type-Sig/Optimise/Algodiff/index.html
@@ -1,5 +1,5 @@
-Algodiff (owl.Owl_regression_generic_sig.Sig.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
+Algodiff (owl.Owl_regression_generic_sig.Sig.Optimise.Algodiff) Module Optimise.Algodiff
include Owl_algodiff_core_sig.Sig
module A : Owl_types_ndarray_algodiff.Sig
Type definition
Core functions
val shape : t -> int array
TODO
val is_float : t -> bool
TODO
val is_arr : t -> bool
TODO
val row_num : t -> int
number of rows
val col_num : t -> int
number of columns
val numel : t -> int
number of elements
val pack_flt : float -> t
convert from float
type to t
type.
val _f : float -> t
A shortcut function for F A.(float_to_elt x)
.
val unpack_flt : t -> float
convert from t
type to float
type.
val deep_info : t -> string
TODO
val type_info : t -> string
TODO
val error_uniop : string -> t -> 'a
TODO
make_forward p t i
construct a forward algodiff data type DF, consisting of primal p
, tangent t
, and tag i
.
make_reverse p i
construct a reverse algodiff data type DR, consisting of primal, adjoint, op, fanout, tag, and tracker.
reverse_prop f x
performs reverse propagation for function f
using the output value x
.
diff f x
returns the exat derivative of a function f : scalar -> scalar
at point x
. Simply calling diff f
will return its derivative function g
of the same type, i.e. g : scalar -> scalar
.
Keep calling this function will give you higher-order derivatives of f
, i.e. f |> diff |> diff |> diff |> ...
jacobian of f
: (vector -> vector) at x
, both x
and y
are row vectors.
jacobian vector product of f
: (vector -> vector) at x
along v
, forward ad. Namely, it calcultes (jacobian x) v
similar to jacobianv'
, but return (f x, jacobianv f x v)
transposed jacobian vector product of f : (vector -> vector)
at x
along v
, backward ad. Namely, it calculates transpose ((jacobianv f x v))
.
similar to jacobianTv
, but return (f x, transpose (jacobianv f x v))
hessian vector product of f
: (scalar -> scalar) at x
along v
. Namely, it calculates (hessian x) v
.
include Owl_algodiff_ops_sig.Sig
with type t := t
and type elt := A.elt
and type arr := A.arr
diff --git a/src/base/algodiff/owl_algodiff_generic_sig.ml b/src/base/algodiff/owl_algodiff_generic_sig.ml
index 1786ed709..de1fc843d 100644
--- a/src/base/algodiff/owl_algodiff_generic_sig.ml
+++ b/src/base/algodiff/owl_algodiff_generic_sig.ml
@@ -7,13 +7,15 @@ module type Sig = sig
include Owl_algodiff_core_sig.Sig
val make_forward : t -> t -> int -> t
- (** TODO *)
+ (** [make_forward p t i] construct a forward algodiff data type DF, consisting of
+ primal [p], tangent [t], and tag [i]. *)
val make_reverse : t -> int -> t
- (** TODO *)
+ (** [make_reverse p i ] construct a reverse algodiff data type DR, consisting of
+ primal, adjoint, op, fanout, tag, and tracker. *)
val reverse_prop : t -> t -> unit
- (** TODO *)
+ (** [reverse_prop f x] performs reverse propagation for function [f] using the output value [x]. *)
val diff : (t -> t) -> t -> t
(** [diff f x] returns the exat derivative of a function [f : scalar -> scalar] at
diff --git a/src/base/core/owl_lazy.mli b/src/base/core/owl_lazy.mli
index edd6178f4..fecd366a2 100644
--- a/src/base/core/owl_lazy.mli
+++ b/src/base/core/owl_lazy.mli
@@ -110,91 +110,103 @@ module Make (A : Ndarray_Mutable) : sig
(** {5 Maths functions} *)
val noop : arr -> arr
- (** TODO *)
+ (** [noop arr] returns the array [arr] unchanged. *)
val empty : int array -> arr
- (** TODO *)
+ (** [empty shape] creates an uninitialized array with the specified [shape]. *)
val zeros : int array -> arr
- (** TODO *)
+ (** [zeros shape] creates an array of the specified [shape] filled with zeros. *)
val ones : int array -> arr
- (** TODO *)
+ (** [ones shape] creates an array of the specified [shape] filled with ones. *)
val create : int array -> elt -> arr
- (** TODO *)
+ (** [create shape value] creates an array of the specified [shape] filled with the given [value]. *)
val sequential : ?a:elt -> ?step:elt -> int array -> arr
- (** TODO *)
+ (** [sequential ?a ?step shape] creates an array of the specified [shape] filled with sequential values
+ starting from [a] and incremented by [step]. *)
val uniform : ?a:elt -> ?b:elt -> int array -> arr
- (** TODO *)
+ (** [uniform ?a ?b shape] creates an array of the specified [shape] filled with values drawn
+ from a uniform distribution between [a] and [b]. *)
val gaussian : ?mu:elt -> ?sigma:elt -> int array -> arr
- (** TODO *)
+ (** [gaussian ?mu ?sigma shape] creates an array of the specified [shape] filled with values
+ drawn from a Gaussian distribution with mean [mu] and standard deviation [sigma]. *)
val bernoulli : ?p:elt -> int array -> arr
- (** TODO *)
+ (** [bernoulli ?p shape] creates an array of the specified [shape] filled with values drawn
+ from a Bernoulli distribution with probability [p]. *)
val init : int array -> (int -> elt) -> arr
- (** TODO *)
+ (** [init shape f] creates an array of the specified [shape] where each element is initialized
+ by the function [f], which takes the index of the element as input. *)
val shape : arr -> int array
- (** TODO *)
+ (** [shape arr] returns the shape of the array [arr]. *)
val numel : arr -> int
- (** TODO *)
+ (** [numel arr] returns the total number of elements in the array [arr]. *)
val get : arr -> int array -> elt
- (** TODO *)
+ (** [get arr indices] retrieves the value at the specified [indices] from the array [arr]. *)
val set : arr -> int array -> elt -> unit
- (** TODO *)
+ (** [set arr indices value] sets the value at the specified [indices] in the array [arr] to [value]. *)
val get_slice : int list list -> arr -> arr
- (** TODO *)
+ (** [get_slice slice_spec arr] extracts a slice from the array [arr] according to the slice specification [slice_spec]. *)
val set_slice : int list list -> arr -> arr -> unit
- (** TODO *)
+ (** [set_slice slice_spec src dst] sets the specified slice in the array [dst] to the values from [src]
+ according to the slice specification [slice_spec]. *)
val copy : arr -> arr
- (** TODO *)
+ (** [copy arr] creates a deep copy of the array [arr]. *)
val reset : arr -> unit
- (** TODO *)
+ (** [reset arr] resets all elements in the array [arr] to zero. *)
val reshape : arr -> int array -> arr
- (** TODO *)
+ (** [reshape arr shape] returns a new array with the elements of [arr] rearranged into the specified [shape]. *)
val reverse : arr -> arr
- (** TODO *)
+ (** [reverse arr] returns a new array with the elements of [arr] reversed along all axes. *)
val tile : arr -> int array -> arr
- (** TODO *)
+ (** [tile arr reps] creates a new array by repeating the array [arr] according to the repetition pattern [reps]. *)
val repeat : arr -> int array -> arr
- (** TODO *)
+ (** [repeat arr reps] repeats the elements of [arr] along each axis according to the repetition pattern [reps]. *)
val concatenate : ?axis:int -> arr array -> arr
- (** TODO *)
+ (** [concatenate ?axis arrs] concatenates the arrays in [arrs] along the specified [axis]. *)
val split : ?axis:int -> int array -> arr -> arr array
- (** TODO *)
+ (** [split ?axis indices arr] splits the array [arr] into multiple sub-arrays along the specified [axis]
+ at the given [indices]. *)
val draw : ?axis:int -> arr -> int -> arr * 'a array
- (** TODO *)
+ (** [draw ?axis arr n] randomly selects [n] elements from the array [arr] along the specified [axis],
+ returning the selected elements and their corresponding indices. *)
val map : (elt -> elt) -> arr -> arr
- (** TODO *)
+ (** [map f arr] applies the function [f] to each element of the array [arr], returning a new array
+ with the results. *)
val fold : ?axis:int -> (elt -> elt -> elt) -> elt -> arr -> arr
- (** TODO *)
+ (** [fold ?axis f init arr] reduces the array [arr] along the specified [axis] using the function [f],
+ starting with the initial value [init]. *)
val scan : ?axis:int -> (elt -> elt -> elt) -> arr -> arr
- (** TODO *)
+ (** [scan ?axis f arr] performs a cumulative reduction of the array [arr] along the specified [axis]
+ using the function [f]. *)
val one_hot : int -> arr -> arr
- (** TODO *)
+ (** [one_hot depth arr] converts the array [arr] into a one-hot encoded array with the specified depth. *)
+
val lazy_print
: ?max_row:int
@@ -203,343 +215,374 @@ module Make (A : Ndarray_Mutable) : sig
-> ?fmt:(A.elt -> string)
-> arr
-> arr
- (** TODO *)
+ (** [lazy_print ?max_row ?max_col ?header ?fmt arr] returns a formatted string
+ representation of the array [arr], potentially truncated based on [max_row]
+ and [max_col], with an optional [header] and custom formatting function [fmt].
+ The array itself is returned unchanged. *)
val print : ?max_row:'a -> ?max_col:'b -> ?header:'c -> ?fmt:'d -> 'e -> unit
- (** TODO *)
+ (** [print ?max_row ?max_col ?header ?fmt arr] prints a formatted string
+ representation of the array [arr] to the standard output, potentially truncated
+ based on [max_row] and [max_col], with an optional [header] and custom formatting function [fmt]. *)
val abs : arr -> arr
- (** TODO *)
+ (** [abs arr] returns a new array where each element is the absolute value of the corresponding element in [arr]. *)
val neg : arr -> arr
- (** TODO *)
+ (** [neg arr] returns a new array where each element is the negation of the corresponding element in [arr]. *)
val floor : arr -> arr
- (** TODO *)
+ (** [floor arr] returns a new array where each element is the floor of the corresponding element in [arr]. *)
val ceil : arr -> arr
- (** TODO *)
+ (** [ceil arr] returns a new array where each element is the ceiling of the corresponding element in [arr]. *)
val round : arr -> arr
- (** TODO *)
+ (** [round arr] returns a new array where each element is rounded to the nearest integer. *)
val sqr : arr -> arr
- (** TODO *)
+ (** [sqr arr] returns a new array where each element is the square of the corresponding element in [arr]. *)
val sqrt : arr -> arr
- (** TODO *)
+ (** [sqrt arr] returns a new array where each element is the square root of the corresponding element in [arr]. *)
val log : arr -> arr
- (** TODO *)
+ (** [log arr] returns a new array where each element is the natural logarithm of the corresponding element in [arr]. *)
val log2 : arr -> arr
- (** TODO *)
+ (** [log2 arr] returns a new array where each element is the base-2 logarithm of the corresponding element in [arr]. *)
val log10 : arr -> arr
- (** TODO *)
+ (** [log10 arr] returns a new array where each element is the base-10 logarithm of the corresponding element in [arr]. *)
val exp : arr -> arr
- (** TODO *)
+ (** [exp arr] returns a new array where each element is the exponential of the corresponding element in [arr]. *)
val sin : arr -> arr
- (** TODO *)
+ (** [sin arr] returns a new array where each element is the sine of the corresponding element in [arr]. *)
val cos : arr -> arr
- (** TODO *)
+ (** [cos arr] returns a new array where each element is the cosine of the corresponding element in [arr]. *)
val tan : arr -> arr
- (** TODO *)
+ (** [tan arr] returns a new array where each element is the tangent of the corresponding element in [arr]. *)
val sinh : arr -> arr
- (** TODO *)
+ (** [sinh arr] returns a new array where each element is the hyperbolic sine of the corresponding element in [arr]. *)
val cosh : arr -> arr
- (** TODO *)
+ (** [cosh arr] returns a new array where each element is the hyperbolic cosine of the corresponding element in [arr]. *)
val tanh : arr -> arr
- (** TODO *)
+ (** [tanh arr] returns a new array where each element is the hyperbolic tangent of the corresponding element in [arr]. *)
val asin : arr -> arr
- (** TODO *)
+ (** [asin arr] returns a new array where each element is the arc sine of the corresponding element in [arr]. *)
val acos : arr -> arr
- (** TODO *)
+ (** [acos arr] returns a new array where each element is the arc cosine of the corresponding element in [arr]. *)
val atan : arr -> arr
- (** TODO *)
+ (** [atan arr] returns a new array where each element is the arc tangent of the corresponding element in [arr]. *)
val asinh : arr -> arr
- (** TODO *)
+ (** [asinh arr] returns a new array where each element is the inverse hyperbolic sine of the corresponding element in [arr]. *)
val acosh : arr -> arr
- (** TODO *)
+ (** [acosh arr] returns a new array where each element is the inverse hyperbolic cosine of the corresponding element in [arr]. *)
val atanh : arr -> arr
- (** TODO *)
+ (** [atanh arr] returns a new array where each element is the inverse hyperbolic tangent of the corresponding element in [arr]. *)
val min : ?axis:int -> ?keep_dims:bool -> arr -> arr
- (** TODO *)
+ (** [min ?axis ?keep_dims arr] returns the minimum value along the specified axis in the array [arr]. *)
val max : ?axis:int -> ?keep_dims:bool -> arr -> arr
- (** TODO *)
+ (** [max ?axis ?keep_dims arr] returns the maximum value along the specified axis in the array [arr]. *)
val sum : ?axis:int -> ?keep_dims:bool -> arr -> arr
- (** TODO *)
+ (** [sum ?axis ?keep_dims arr] returns the sum of elements along the specified axis in the array [arr]. *)
val sum_reduce : ?axis:int array -> arr -> arr
- (** TODO *)
+ (** [sum_reduce ?axis arr] reduces the array [arr] by summing along the specified axes. *)
val signum : arr -> arr
- (** TODO *)
+ (** [signum arr] returns a new array where each element is the sign of the corresponding element in [arr]. *)
val sigmoid : arr -> arr
- (** TODO *)
+ (** [sigmoid arr] returns a new array where each element is the sigmoid function applied to the corresponding element in [arr]. *)
val relu : arr -> arr
- (** TODO *)
+ (** [relu arr] returns a new array where each element is the result of applying the ReLU (Rectified Linear Unit) function to the corresponding element in [arr]. *)
val min' : arr -> elt
- (** TODO *)
+ (** [min' arr] returns the minimum value in the array [arr]. *)
val max' : arr -> elt
- (** TODO *)
+ (** [max' arr] returns the maximum value in the array [arr]. *)
val sum' : arr -> elt
- (** TODO *)
+ (** [sum' arr] returns the sum of all elements in the array [arr]. *)
val l1norm' : arr -> elt
- (** TODO *)
+ (** [l1norm' arr] returns the L1 norm (sum of absolute values) of all elements in the array [arr]. *)
val l2norm' : arr -> elt
- (** TODO *)
+ (** [l2norm' arr] returns the L2 norm (Euclidean norm) of all elements in the array [arr]. *)
val l2norm_sqr' : arr -> elt
- (** TODO *)
+ (** [l2norm_sqr' arr] returns the squared L2 norm of all elements in the array [arr]. *)
val clip_by_value : ?amin:elt -> ?amax:elt -> arr -> arr
- (** TODO *)
+ (** [clip_by_value ?amin ?amax arr] clips the values in the array [arr] to be within the range [amin, amax]. *)
val clip_by_l2norm : elt -> arr -> arr
- (** TODO *)
+ (** [clip_by_l2norm max_norm arr] clips the values in the array [arr] so that its L2 norm does not exceed [max_norm]. *)
val pow : arr -> arr -> arr
- (** TODO *)
+ (** [pow arr1 arr2] returns a new array where each element is the result of raising the corresponding element in [arr1] to the power of the corresponding element in [arr2]. *)
val scalar_pow : elt -> arr -> arr
- (** TODO *)
+ (** [scalar_pow scalar arr] returns a new array where each element in [arr] is raised to the power of [scalar]. *)
val pow_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [pow_scalar arr scalar] returns a new array where each element in [arr] is raised to the power of [scalar]. *)
val atan2 : arr -> arr -> arr
- (** TODO *)
+ (** [atan2 arr1 arr2] returns a new array where each element is the result of applying the two-argument arctangent function to the corresponding elements in [arr1] and [arr2]. *)
val scalar_atan2 : elt -> arr -> arr
- (** TODO *)
+ (** [scalar_atan2 scalar arr] returns a new array where each element is the result of applying the two-argument arctangent function to [scalar] and the corresponding element in [arr]. *)
val atan2_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [atan2_scalar arr scalar] returns a new array where each element is the result of applying the two-argument arctangent function to the corresponding element in [arr] and [scalar]. *)
val hypot : arr -> arr -> arr
- (** TODO *)
+ (** [hypot arr1 arr2] returns a new array where each element is the result of applying the hypotenuse function to the corresponding elements in [arr1] and [arr2]. *)
val min2 : arr -> arr -> arr
- (** TODO *)
+ (** [min2 arr1 arr2] returns a new array where each element is the minimum of the corresponding elements in [arr1] and [arr2]. *)
val max2 : arr -> arr -> arr
- (** TODO *)
+ (** [max2 arr1 arr2] returns a new array where each element is the maximum of the corresponding elements in [arr1] and [arr2]. *)
val add : arr -> arr -> arr
- (** TODO *)
+ (** [add arr1 arr2] returns a new array where each element is the sum of the corresponding elements in [arr1] and [arr2]. *)
val sub : arr -> arr -> arr
- (** TODO *)
+ (** [sub arr1 arr2] returns a new array where each element is the difference between the corresponding elements in [arr1] and [arr2]. *)
val mul : arr -> arr -> arr
- (** TODO *)
+ (** [mul arr1 arr2] returns a new array where each element is the product of the corresponding elements in [arr1] and [arr2]. *)
val div : arr -> arr -> arr
- (** TODO *)
+ (** [div arr1 arr2] returns a new array where each element is the quotient of the corresponding elements in [arr1] and [arr2]. *)
val add_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [add_scalar arr scalar] returns a new array where each element in [arr] is incremented by [scalar]. *)
val sub_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [sub_scalar arr scalar] returns a new array where each element in [arr] is decremented by [scalar]. *)
val mul_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [mul_scalar arr scalar] returns a new array where each element in [arr] is multiplied by [scalar]. *)
val div_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [div_scalar arr scalar] returns a new array where each element in [arr] is divided by [scalar]. *)
val scalar_add : elt -> arr -> arr
- (** TODO *)
+ (** [scalar_add scalar arr] returns a new array where [scalar] is added to each element in [arr]. *)
val scalar_sub : elt -> arr -> arr
- (** TODO *)
+ (** [scalar_sub scalar arr] returns a new array where [scalar] is subtracted from each element in [arr]. *)
val scalar_mul : elt -> arr -> arr
- (** TODO *)
+ (** [scalar_mul scalar arr] returns a new array where each element in [arr] is multiplied by [scalar]. *)
val scalar_div : elt -> arr -> arr
- (** TODO *)
+ (** [scalar_div scalar arr] returns a new array where [scalar] is divided by each element in [arr]. *)
val fma : arr -> arr -> arr -> arr
- (** TODO *)
+ (** [fma arr1 arr2 arr3] returns a new array where each element is the result of a fused multiply-add operation
+ applied to the corresponding elements in [arr1], [arr2], and [arr3]. *)
val elt_equal : arr -> arr -> arr
- (** TODO *)
+ (** [elt_equal arr1 arr2] returns a new array where each element is [1] if the corresponding elements in [arr1] and [arr2] are equal, otherwise [0]. *)
val elt_not_equal : arr -> arr -> arr
- (** TODO *)
+ (** [elt_not_equal arr1 arr2] returns a new array where each element is [1] if the corresponding elements in [arr1] and [arr2] are not equal, otherwise [0]. *)
val elt_less : arr -> arr -> arr
- (** TODO *)
+ (** [elt_less arr1 arr2] returns a new array where each element is [1] if the corresponding element in [arr1] is less than the corresponding element in [arr2], otherwise [0]. *)
val elt_greater : arr -> arr -> arr
- (** TODO *)
+ (** [elt_greater arr1 arr2] returns a new array where each element is [1] if the corresponding element in [arr1] is greater than the corresponding element in [arr2], otherwise [0]. *)
val elt_less_equal : arr -> arr -> arr
- (** TODO *)
+ (** [elt_less_equal arr1 arr2] returns a new array where each element is [1] if the corresponding element in [arr1] is less than or equal to the corresponding element in [arr2], otherwise [0]. *)
val elt_greater_equal : arr -> arr -> arr
- (** TODO *)
+ (** [elt_greater_equal arr1 arr2] returns a new array where each element is [1] if the corresponding element in [arr1] is greater than or equal to the corresponding element in [arr2], otherwise [0]. *)
val elt_equal_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [elt_equal_scalar arr scalar] returns a new array where each element is [1] if the corresponding element in [arr] is equal to [scalar], otherwise [0]. *)
val elt_not_equal_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [elt_not_equal_scalar arr scalar] returns a new array where each element is [1] if the corresponding element in [arr] is not equal to [scalar], otherwise [0]. *)
val elt_less_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [elt_less_scalar arr scalar] returns a new array where each element is [1] if the corresponding element in [arr] is less than [scalar], otherwise [0]. *)
val elt_greater_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [elt_greater_scalar arr scalar] returns a new array where each element is [1] if the corresponding element in [arr] is greater than [scalar], otherwise [0]. *)
val elt_less_equal_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [elt_less_equal_scalar arr scalar] returns a new array where each element is [1] if the corresponding element in [arr] is less than or equal to [scalar], otherwise [0]. *)
val elt_greater_equal_scalar : arr -> elt -> arr
- (** TODO *)
+ (** [elt_greater_equal_scalar arr scalar] returns a new array where each element is [1] if the corresponding element in [arr] is greater than or equal to [scalar], otherwise [0]. *)
val conv1d : ?padding:padding -> arr -> arr -> int array -> arr
- (** TODO *)
+ (** [conv1d ?padding kernel arr stride] performs a 1D convolution of the array [arr] with the kernel [kernel],
+ using the specified stride and optional padding. *)
val conv2d : ?padding:padding -> arr -> arr -> int array -> arr
- (** TODO *)
+ (** [conv2d ?padding kernel arr stride] performs a 2D convolution of the array [arr] with the kernel [kernel],
+ using the specified stride and optional padding. *)
val conv3d : ?padding:padding -> arr -> arr -> int array -> arr
- (** TODO *)
+ (** [conv3d ?padding kernel arr stride] performs a 3D convolution of the array [arr] with the kernel [kernel],
+ using the specified stride and optional padding. *)
val transpose_conv2d : ?padding:padding -> arr -> arr -> int array -> arr
- (** TODO *)
+ (** [transpose_conv2d ?padding kernel arr stride] performs a 2D transposed convolution (also known as a deconvolution)
+ of the array [arr] with the kernel [kernel], using the specified stride and optional padding. *)
val max_pool1d : ?padding:padding -> arr -> int array -> int array -> arr
- (** TODO *)
+ (** [max_pool1d ?padding arr size stride] performs a 1D max pooling operation on the array [arr]
+ using the specified size and stride, with optional padding. *)
val max_pool2d : ?padding:padding -> arr -> int array -> int array -> arr
- (** TODO *)
+ (** [max_pool2d ?padding arr size stride] performs a 2D max pooling operation on the array [arr]
+ using the specified size and stride, with optional padding. *)
val max_pool3d : ?padding:padding -> arr -> int array -> int array -> arr
- (** TODO *)
+ (** [max_pool3d ?padding arr size stride] performs a 3D max pooling operation on the array [arr]
+ using the specified size and stride, with optional padding. *)
val avg_pool1d : ?padding:padding -> arr -> int array -> int array -> arr
- (** TODO *)
+ (** [avg_pool1d ?padding arr size stride] performs a 1D average pooling operation on the array [arr]
+ using the specified size and stride, with optional padding. *)
val avg_pool2d : ?padding:padding -> arr -> int array -> int array -> arr
- (** TODO *)
+ (** [avg_pool2d ?padding arr size stride] performs a 2D average pooling operation on the array [arr]
+ using the specified size and stride, with optional padding. *)
val avg_pool3d : ?padding:padding -> arr -> int array -> int array -> arr
- (** TODO *)
+ (** [avg_pool3d ?padding arr size stride] performs a 3D average pooling operation on the array [arr]
+ using the specified size and stride, with optional padding. *)
val conv1d_backward_input : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [conv1d_backward_input kernel output_grad stride input_grad] computes the gradient of the input
+ with respect to the 1D convolution, given the kernel, output gradient, and stride. *)
val conv1d_backward_kernel : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [conv1d_backward_kernel input output_grad stride kernel_grad] computes the gradient of the kernel
+ with respect to the 1D convolution, given the input, output gradient, and stride. *)
val conv2d_backward_input : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [conv2d_backward_input kernel output_grad stride input_grad] computes the gradient of the input
+ with respect to the 2D convolution, given the kernel, output gradient, and stride. *)
val conv2d_backward_kernel : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [conv2d_backward_kernel input output_grad stride kernel_grad] computes the gradient of the kernel
+ with respect to the 2D convolution, given the input, output gradient, and stride. *)
val conv3d_backward_input : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [conv3d_backward_input kernel output_grad stride input_grad] computes the gradient of the input
+ with respect to the 3D convolution, given the kernel, output gradient, and stride. *)
val conv3d_backward_kernel : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [conv3d_backward_kernel input output_grad stride kernel_grad] computes the gradient of the kernel
+ with respect to the 3D convolution, given the input, output gradient, and stride. *)
val transpose_conv2d_backward_input : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [transpose_conv2d_backward_input kernel output_grad stride input_grad] computes the gradient of the input
+ with respect to the 2D transposed convolution, given the kernel, output gradient, and stride. *)
val transpose_conv2d_backward_kernel : arr -> arr -> int array -> arr -> arr
- (** TODO *)
+ (** [transpose_conv2d_backward_kernel input output_grad stride kernel_grad] computes the gradient of the kernel
+ with respect to the 2D transposed convolution, given the input, output gradient, and stride. *)
val max_pool1d_backward : padding -> arr -> int array -> int array -> arr -> arr
- (** TODO *)
+ (** [max_pool1d_backward padding input size stride output_grad] computes the gradient of the input
+ with respect to the 1D max pooling operation, given the padding, input, size, stride, and output gradient. *)
val max_pool2d_backward : padding -> arr -> int array -> int array -> arr -> arr
- (** TODO *)
+ (** [max_pool2d_backward padding input size stride output_grad] computes the gradient of the input
+ with respect to the 2D max pooling operation, given the padding, input, size, stride, and output gradient. *)
val max_pool3d_backward : padding -> arr -> int array -> int array -> arr -> arr
- (** TODO *)
+ (** [max_pool3d_backward padding input size stride output_grad] computes the gradient of the input
+ with respect to the 3D max pooling operation, given the padding, input, size, stride, and output gradient. *)
val avg_pool1d_backward : padding -> arr -> int array -> int array -> arr -> arr
- (** TODO *)
+ (** [avg_pool1d_backward padding input size stride output_grad] computes the gradient of the input
+ with respect to the 1D average pooling operation, given the padding, input, size, stride, and output gradient. *)
val avg_pool2d_backward : padding -> arr -> int array -> int array -> arr -> arr
- (** TODO *)
+ (** [avg_pool2d_backward padding input size stride output_grad] computes the gradient of the input
+ with respect to the 2D average pooling operation, given the padding, input, size, stride, and output gradient. *)
val avg_pool3d_backward : padding -> arr -> int array -> int array -> arr -> arr
- (** TODO *)
+ (** [avg_pool3d_backward padding input size stride output_grad] computes the gradient of the input
+ with respect to the 3D average pooling operation, given the padding, input, size, stride, and output gradient. *)
val row_num : arr -> int
- (** TODO *)
+ (** [row_num arr] returns the number of rows in the array [arr]. *)
val col_num : arr -> int
- (** TODO *)
+ (** [col_num arr] returns the number of columns in the array [arr]. *)
val row : arr -> 'a -> arr
- (** TODO *)
+ (** [row arr i] returns the [i]-th row of the array [arr]. *)
val rows : arr -> int array -> arr
- (** TODO *)
+ (** [rows arr indices] returns the rows of the array [arr] specified by [indices]. *)
val copy_row_to : arr -> 'a -> 'b -> unit
- (** TODO *)
+ (** [copy_row_to src src_index dst] copies the row at index [src_index] in the array [src] to the array [dst]. *)
val copy_col_to : arr -> 'a -> 'b -> unit
- (** TODO *)
+ (** [copy_col_to src src_index dst] copies the column at index [src_index] in the array [src] to the array [dst]. *)
val trace : arr -> elt
- (** TODO *)
+ (** [trace arr] returns the trace (sum of the diagonal elements) of the array [arr]. *)
val dot : arr -> arr -> arr
- (** TODO *)
+ (** [dot arr1 arr2] returns the dot product of the arrays [arr1] and [arr2]. *)
val transpose : ?axis:int array -> arr -> arr
- (** TODO *)
+ (** [transpose ?axis arr] returns a new array where the axes of the array [arr] are transposed according to [axis]. *)
val to_rows : arr -> 'a array
- (** TODO *)
+ (** [to_rows arr] converts the array [arr] into an array of rows. *)
val of_rows : arr array -> arr
- (** TODO *)
+ (** [of_rows rows] creates an array by stacking the input array of rows. *)
val to_cols : arr -> 'a array
- (** TODO *)
+ (** [to_cols arr] converts the array [arr] into an array of columns. *)
val of_cols : arr array -> arr
- (** TODO *)
+ (** [of_cols cols] creates an array by stacking the input array of columns. *)
val of_array : elt array -> int array -> arr
- (** TODO *)
+ (** [of_array data shape] creates an array of the specified [shape] from the 1D array [data]. *)
val of_arrays : elt array array -> arr
- (** TODO *)
+ (** [of_arrays data] creates an array from the 2D array [data]. *)
+
(** {5 Evaluation functions} *)
diff --git a/src/base/maths/owl_maths_interpolate.mli b/src/base/maths/owl_maths_interpolate.mli
index 69ea1a40c..1a6e78202 100644
--- a/src/base/maths/owl_maths_interpolate.mli
+++ b/src/base/maths/owl_maths_interpolate.mli
@@ -23,6 +23,25 @@ Returns:
*)
val ratint : float array -> float array -> float -> float * float
-(**
- TODO
- *)
+(** [ratint xs ys x] performs rational function interpolation on the data points
+ given by [xs] and [ys], and returns the interpolated value at the point [x],
+ along with an estimate of the error.
+
+ This function fits a rational function (a ratio of two polynomials) to the
+ provided data points. It is particularly useful when the data exhibits behavior
+ that might be better captured by such a function, especially in cases where
+ the data might have singularities or steep gradients.
+
+ The function raises an exception if the lengths of [xs] and [ys] do not match,
+ or if a pole is encountered during the interpolation process.
+
+ Parameters:
+ @param xs An array of x-values (the independent variable).
+ @param ys An array of y-values (the dependent variable) corresponding to [xs].
+ @param x The point at which the interpolated value is to be calculated.
+
+ Returns:
+ @return A tuple [(y, dy)], where [y] is the interpolated value at [x],
+ and [dy] is an estimate of the error in the interpolation.
+*)
+
diff --git a/src/base/misc/owl_utils_array.ml b/src/base/misc/owl_utils_array.ml
index 56d4f8abd..dfe5ddb04 100644
--- a/src/base/misc/owl_utils_array.ml
+++ b/src/base/misc/owl_utils_array.ml
@@ -300,7 +300,7 @@ let align3 s v x y z =
(* [x] is greater or equal than [y] elementwise *)
-let greater_eqaul x y =
+let greater_equal x y =
let la = Array.length x in
let lb = Array.length y in
assert (la = lb);
diff --git a/src/base/misc/owl_utils_array.mli b/src/base/misc/owl_utils_array.mli
index ba2e07617..e0d238269 100644
--- a/src/base/misc/owl_utils_array.mli
+++ b/src/base/misc/owl_utils_array.mli
@@ -141,16 +141,38 @@ val flatten : 'a array array -> 'a array
(** Flatten an array array into an array. *)
val set_n : 'a array -> int array -> 'a -> unit
-(** TODO *)
+(** [set_n arr indices v] sets the elements at the positions specified by [indices]
+ in the array [arr] to the value [v].
+
+ @param arr The array in which to set values.
+ @param indices An array of indices specifying the positions in [arr] to be updated.
+ @param v The value to set at each of the specified positions.
+*)
val range : int -> int -> int array
-(** TODO *)
+(** [range start stop] generates an array of integers from [start] to [stop] inclusive.
+
+ @param start The starting value of the range.
+ @param stop The ending value of the range.
+ @return An array of integers from [start] to [stop].
+*)
val count : 'a array -> 'a -> int
-(** TODO *)
+(** [count arr x] counts the number of occurrences of the value [x] in the array [arr].
+
+ @param arr The array in which to count occurrences.
+ @param x The value to count within the array.
+ @return The number of times [x] appears in [arr].
+*)
val insert : 'a array -> 'a array -> int -> 'a array
-(** TODO *)
+(** [insert arr1 arr2 pos] inserts the elements of [arr2] into [arr1] at the specified position [pos].
+
+ @param arr1 The array into which elements are inserted.
+ @param arr2 The array of elements to insert into [arr1].
+ @param pos The position in [arr1] at which to insert [arr2].
+ @return A new array with [arr2] inserted into [arr1] at the position [pos].
+*)
val unique : 'a array -> 'a array
(** [unique x] removes the duplicates in the array [x]. *)
@@ -158,32 +180,48 @@ val unique : 'a array -> 'a array
val merge : 'a array -> 'a array -> 'a array
(** [merge x y] merges two arrays and removes the duplicates. *)
+val reverse : 'a array -> unit
+(** [reverse arr] reverses the elements of the array [arr] in place. *)
+
val remove : 'a array -> int -> 'a array
-(** TODO *)
+(** [remove arr pos] removes the element at position [pos] from the array [arr].*)
val replace : int -> int -> 'a array -> 'a array -> 'a array
-(** TODO *)
-
-val reverse : 'a array -> unit
-(** [reverse x] reverse the elements in [x] in place. *)
+(** [replace pos len arr1 arr2] replaces the subarray of length [len] starting at [pos]
+ in [arr1] with the elements from [arr2].
+*)
val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array
-(** TODO *)
+(** [mapi f arr] applies the function [f] to each element of the array [arr],
+ passing the index of the element as the first argument to [f], and returns
+ a new array of the results.
+*)
val map : ('a -> 'b) -> 'a array -> 'b array
-(** TODO *)
+(** [map f arr] applies the function [f] to each element of the array [arr]
+ and returns a new array of the results.
+*)
val iter2i : (int -> 'a -> 'b -> unit) -> 'a array -> 'b array -> unit
-(** TODO *)
+(** [iter2i f arr1 arr2] applies the function [f] to each pair of corresponding elements
+ from [arr1] and [arr2], passing the index as the first argument to [f].
+*)
val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit
-(** TODO *)
+(** [iter2 f arr1 arr2] applies the function [f] to each pair of corresponding elements
+ from [arr1] and [arr2].
+*)
val iter3i : (int -> 'a -> 'b -> 'c -> unit) -> 'a array -> 'b array -> 'c array -> unit
-(** TODO *)
+(** [iter3i f arr1 arr2 arr3] applies the function [f] to each triplet of corresponding elements
+ from [arr1], [arr2], and [arr3], passing the index as the first argument to [f].
+*)
val iter3 : ('a -> 'b -> 'c -> unit) -> 'a array -> 'b array -> 'c array -> unit
-(** TODO *)
+(** [iter3 f arr1 arr2 arr3] applies the function [f] to each triplet of corresponding elements
+ from [arr1], [arr2], and [arr3].
+*)
+
val iter4i
: (int -> 'a -> 'b -> 'c -> 'd -> unit)
@@ -192,7 +230,9 @@ val iter4i
-> 'c array
-> 'd array
-> unit
-(** TODO *)
+(** [iter4i f arr1 arr2 arr3 arr4] applies the function [f] to each group of corresponding
+ elements from [arr1], [arr2], [arr3], and [arr4], passing the index of the elements
+ as the first argument to [f]. *)
val iter4
: ('a -> 'b -> 'c -> 'd -> unit)
@@ -201,23 +241,32 @@ val iter4
-> 'c array
-> 'd array
-> unit
-(** TODO *)
+(** [iter4 f arr1 arr2 arr3 arr4] applies the function [f] to each group of corresponding
+ elements from [arr1], [arr2], [arr3], and [arr4]. *)
val map2i : (int -> 'a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
-(** TODO *)
+(** [map2i f arr1 arr2] applies the function [f] to each pair of corresponding elements
+ from [arr1] and [arr2], passing the index of the elements as the first argument to [f],
+ and returns an array of the results. *)
val map2i_split2
: (int -> 'a -> 'b -> 'c * 'd)
-> 'a array
-> 'b array
-> 'c array * 'd array
-(** TODO *)
+(** [map2i_split2 f arr1 arr2] applies the function [f] to each pair of corresponding elements
+ from [arr1] and [arr2], passing the index of the elements as the first argument to [f],
+ and returns a tuple of two arrays containing the first and second elements of the results
+ of [f]. *)
val map3i : (int -> 'a -> 'b -> 'c -> 'd) -> 'a array -> 'b array -> 'c array -> 'd array
-(** TODO *)
+(** [map3i f arr1 arr2 arr3] applies the function [f] to each triplet of corresponding elements
+ from [arr1], [arr2], and [arr3], passing the index of the elements as the first argument
+ to [f], and returns an array of the results. *)
val map3 : ('a -> 'b -> 'c -> 'd) -> 'a array -> 'b array -> 'c array -> 'd array
-(** TODO *)
+(** [map3 f arr1 arr2 arr3] applies the function [f] to each triplet of corresponding elements
+ from [arr1], [arr2], and [arr3], and returns an array of the results. *)
val map4i
: (int -> 'a -> 'b -> 'c -> 'd -> 'e)
@@ -226,7 +275,9 @@ val map4i
-> 'c array
-> 'd array
-> 'e array
-(** TODO *)
+(** [map4i f arr1 arr2 arr3 arr4] applies the function [f] to each group of corresponding elements
+ from [arr1], [arr2], [arr3], and [arr4], passing the index of the elements as the first argument
+ to [f], and returns an array of the results. *)
val map4
: ('a -> 'b -> 'c -> 'd -> 'e)
@@ -235,13 +286,19 @@ val map4
-> 'c array
-> 'd array
-> 'e array
-(** TODO *)
+(** [map4 f arr1 arr2 arr3 arr4] applies the function [f] to each group of corresponding elements
+ from [arr1], [arr2], [arr3], and [arr4], and returns an array of the results. *)
val filteri_v : (int -> 'a -> bool * 'b) -> 'a array -> 'b array
-(** TODO *)
+(** [filteri_v f arr] applies the function [f] to each element of [arr], passing the index
+ of the element as the first argument to [f]. The function [f] returns a pair of a boolean
+ and a value. If the boolean is [true], the value is included in the result array. *)
val filter_v : ('a -> bool * 'b) -> 'a array -> 'b array
-(** TODO *)
+(** [filter_v f arr] applies the function [f] to each element of [arr]. The function [f]
+ returns a pair of a boolean and a value. If the boolean is [true], the value is included
+ in the result array. *)
+
val filteri : (int -> 'a -> bool) -> 'a array -> 'a array
(** [filteri f x] filters out the elements in [x] according to predicate [f]. *)
@@ -292,8 +349,12 @@ val fold2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b array -> 'c array -> 'a
[fold2 a x y] folds both [x] and [y] from left with starting value [a].
*)
-val pad : [ `Left | `Right ] -> 'a -> int -> 'a array -> 'a array
-(** TODO *)
+ val pad : [ `Left | `Right ] -> 'a -> int -> 'a array -> 'a array
+ (** [pad side v len arr] pads the array [arr] with the value [v] on the specified side
+ (`Left` or `Right`) until the array reaches the desired length [len].
+
+ If [len] is less than or equal to the length of [arr], the original array is returned. *)
+
val align : [ `Left | `Right ] -> 'a -> 'a array -> 'a array -> 'a array * 'a array
(**
@@ -310,17 +371,20 @@ val align3
-> 'a array * 'a array * 'a array
(** [align3 side v x y z] aligns three arrays [x], [y], and [z]. *)
-val greater_eqaul : 'a array -> 'a array -> bool
-(** TODO *)
+val greater_equal : 'a array -> 'a array -> bool
+(** [greater_equal arr1 arr2] returns [true] if all elements in [arr1] are greater than or equal to
+ the corresponding elements in [arr2], and [false] otherwise. *)
val swap : 'a array -> int -> int -> unit
-(** TODO *)
+(** [swap arr i j] swaps the elements at indices [i] and [j] in the array [arr]. *)
val permute : int array -> 'a array -> 'a array
-(** TODO *)
+(** [permute indices arr] rearranges the elements of [arr] according to the order specified
+ by [indices], returning a new array with the permuted elements. *)
val of_tuples : ('a * 'a) array -> 'a array
-(** TODO *)
+(** [of_tuples arr] converts an array of pairs into an array containing all the first elements
+ followed by all the second elements of the pairs in [arr]. *)
val complement : 'a array -> 'a array -> 'a array
@@ -351,4 +415,7 @@ val to_string
-> ('a -> string)
-> 'a array
-> string
-(** TODO *)
+(** [to_string ?prefix ?suffix ?sep f arr] converts the array [arr] to a string
+ representation, applying the function [f] to each element to produce a string.
+ The elements are separated by [sep] (default is ", "), and the entire output is
+ optionally wrapped with [prefix] and [suffix]. *)
diff --git a/src/base/types/owl_types_computation_engine.ml b/src/base/types/owl_types_computation_engine.ml
index e3b296b1d..9fd79b4ee 100644
--- a/src/base/types/owl_types_computation_engine.ml
+++ b/src/base/types/owl_types_computation_engine.ml
@@ -12,11 +12,12 @@ module type Sig = sig
(** {5 Core evaluation functions of the engine} *)
val eval_arr : arr array -> unit
- (** TODO *)
+ (** Execute actual computation included in each CGraph element (of output type ndarray) in an array. *)
val eval_elt : elt array -> unit
- (** TODO *)
+ (** Execute actual computation included in each CGraph element (of output type float) in an array. *)
val eval_graph : graph -> unit
- (** TODO *)
+ (** Execute actual computation of a computation graph. *)
+
end