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 @@ -AD (owl-base.Owl_algodiff_check.Make.AD)

Parameter Make.AD

include Owl_algodiff_core_sig.Sig
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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

Signature

include Owl_algodiff_core_sig.Sig with type A.arr = A.arr with type A.elt = A.elt
module A : - Owl_types_ndarray_algodiff.Sig with type arr = A.arr with type elt = A.elt
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f x v)

Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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

Core evaluation functions of the engine

TODO

TODO

val eval_graph : Graph.graph -> unit

TODO

+Engine (owl-base.Owl_computation_engine.Flatten.Engine)

Parameter Flatten.Engine

Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

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

Signature

include module type of struct include Engine end
module Graph = Engine.Graph
Core evaluation functions of the engine

TODO

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 save_graph : 'a -> string -> unit
val load_graph : string -> 'a * 'b
val collect_rvs : +Flatten (owl-base.Owl_computation_engine.Flatten)

Module Owl_computation_engine.Flatten

Parameters

Signature

include module type of struct include Engine end
module Graph = Engine.Graph
Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

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 save_graph : 'a -> string -> unit
val load_graph : string -> 'a * 'b
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
Core evaluation functions of the engine

TODO

TODO

val eval_graph : Graph.graph -> unit

TODO

include Owl_computation_graph_sig.Sig
Type definition
type graph

TODO

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 save_graph : 'a -> string -> unit

TODO

val load_graph : string -> 'a * 'b

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
Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

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
type graph

TODO

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 save_graph : 'a -> string -> unit

TODO

val load_graph : string -> 'a * 'b

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

Signature

Type definition
type arr

TODO

type elt

TODO

type value

TODO

type attr

TODO

type graph

TODO

Type conversion functions
val arr_to_value : A.arr -> value

TODO

val value_to_arr : value -> A.arr

TODO

val elt_to_value : A.elt -> value

TODO

val value_to_elt : value -> A.elt

TODO

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 pack_arr : A.arr -> arr

TODO

val unpack_arr : arr -> A.arr

TODO

val pack_elt : A.elt -> elt

TODO

val unpack_elt : elt -> A.elt

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

val const_arr : string -> A.arr -> arr

TODO

val const_elt : string -> A.elt -> elt

TODO

val assign_arr : arr -> A.arr -> unit

TODO

val assign_elt : elt -> A.elt -> unit

TODO

val unsafe_assign_arr : arr -> A.arr -> unit

TODO

Maths functions
val noop : arr -> arr

TODO

val empty : int array -> arr

TODO

val zeros : int array -> arr

TODO

val ones : int array -> arr

TODO

val create : int array -> elt -> arr

TODO

val sequential : ?a:elt -> ?step:elt -> int array -> arr

TODO

val uniform : ?a:elt -> ?b:elt -> int array -> arr

TODO

val gaussian : ?mu:elt -> ?sigma:elt -> int array -> arr

TODO

val bernoulli : ?p:elt -> int array -> arr

TODO

val init : int array -> (int -> elt) -> arr

TODO

val shape : arr -> int array

TODO

val numel : arr -> int

TODO

val get : arr -> int array -> elt

TODO

val set : arr -> int array -> elt -> unit

TODO

val get_slice : int list list -> arr -> arr

TODO

val set_slice : int list list -> arr -> arr -> unit

TODO

val copy : arr -> arr

TODO

val reset : arr -> unit

TODO

val reshape : arr -> int array -> arr

TODO

val reverse : arr -> arr

TODO

val tile : arr -> int array -> arr

TODO

val repeat : arr -> int array -> arr

TODO

val concatenate : ?axis:int -> arr array -> arr

TODO

val split : ?axis:int -> int array -> arr -> arr array

TODO

val draw : ?axis:int -> arr -> int -> arr * 'a array

TODO

val map : (elt -> elt) -> arr -> arr

TODO

val fold : ?axis:int -> (elt -> elt -> elt) -> elt -> arr -> arr

TODO

val scan : ?axis:int -> (elt -> elt -> elt) -> arr -> arr

TODO

val one_hot : int -> arr -> arr

TODO

val lazy_print : +Make (owl-base.Owl_lazy.Make)

Module Owl_lazy.Make

Parameters

Signature

Type definition
type arr

TODO

type elt

TODO

type value

TODO

type attr

TODO

type graph

TODO

Type conversion functions
val arr_to_value : A.arr -> value

TODO

val value_to_arr : value -> A.arr

TODO

val elt_to_value : A.elt -> value

TODO

val value_to_elt : value -> A.elt

TODO

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 pack_arr : A.arr -> arr

TODO

val unpack_arr : arr -> A.arr

TODO

val pack_elt : A.elt -> elt

TODO

val unpack_elt : elt -> A.elt

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

val const_arr : string -> A.arr -> arr

TODO

val const_elt : string -> A.elt -> elt

TODO

val assign_arr : arr -> A.arr -> unit

TODO

val assign_elt : elt -> A.elt -> unit

TODO

val unsafe_assign_arr : arr -> A.arr -> unit

TODO

Maths functions
val noop : arr -> arr

noop arr returns the array arr unchanged.

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.

val create : int array -> elt -> arr

create shape value creates an array of the specified shape filled with the given value.

val sequential : ?a:elt -> ?step:elt -> int array -> arr

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

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

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

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

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.

val get : arr -> int array -> elt

get arr indices retrieves the value at the specified indices from the array arr.

val set : arr -> int array -> elt -> unit

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

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

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

copy arr creates a deep copy of the array arr.

val reset : arr -> unit

reset arr resets all elements in the array arr to zero.

val reshape : arr -> int array -> arr

reshape arr shape returns a new array with the elements of arr rearranged into the specified shape.

val reverse : arr -> arr

reverse arr returns a new array with the elements of arr reversed along all axes.

val tile : arr -> int array -> arr

tile arr reps creates a new array by repeating the array arr according to the repetition pattern reps.

val repeat : arr -> int array -> arr

repeat arr reps repeats the elements of arr along each axis according to the repetition pattern reps.

val concatenate : ?axis:int -> arr array -> arr

concatenate ?axis arrs concatenates the arrays in arrs along the specified axis.

val split : ?axis:int -> int array -> arr -> arr array

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

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

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

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

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

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 print : ?max_row:'a -> ?max_col:'b -> ?header:'c -> ?fmt:'d -> 'e -> unit

TODO

val abs : arr -> arr

TODO

val neg : arr -> arr

TODO

val floor : arr -> arr

TODO

val ceil : arr -> arr

TODO

val round : arr -> arr

TODO

val sqr : arr -> arr

TODO

val sqrt : arr -> arr

TODO

val log : arr -> arr

TODO

val log2 : arr -> arr

TODO

val log10 : arr -> arr

TODO

val exp : arr -> arr

TODO

val sin : arr -> arr

TODO

val cos : arr -> arr

TODO

val tan : arr -> arr

TODO

val sinh : arr -> arr

TODO

val cosh : arr -> arr

TODO

val tanh : arr -> arr

TODO

val asin : arr -> arr

TODO

val acos : arr -> arr

TODO

val atan : arr -> arr

TODO

val asinh : arr -> arr

TODO

val acosh : arr -> arr

TODO

val atanh : arr -> arr

TODO

val min : ?axis:int -> ?keep_dims:bool -> arr -> arr

TODO

val max : ?axis:int -> ?keep_dims:bool -> arr -> arr

TODO

val sum : ?axis:int -> ?keep_dims:bool -> arr -> arr

TODO

val sum_reduce : ?axis:int array -> arr -> arr

TODO

val signum : arr -> arr

TODO

val sigmoid : arr -> arr

TODO

val relu : arr -> arr

TODO

val min' : arr -> elt

TODO

val max' : arr -> elt

TODO

val sum' : arr -> elt

TODO

val l1norm' : arr -> elt

TODO

val l2norm' : arr -> elt

TODO

val l2norm_sqr' : arr -> elt

TODO

val clip_by_value : ?amin:elt -> ?amax:elt -> arr -> arr

TODO

val clip_by_l2norm : elt -> arr -> arr

TODO

val pow : arr -> arr -> arr

TODO

val scalar_pow : elt -> arr -> arr

TODO

val pow_scalar : arr -> elt -> arr

TODO

val atan2 : arr -> arr -> arr

TODO

val scalar_atan2 : elt -> arr -> arr

TODO

val atan2_scalar : arr -> elt -> arr

TODO

val hypot : arr -> arr -> arr

TODO

val min2 : arr -> arr -> arr

TODO

val max2 : arr -> arr -> arr

TODO

val add : arr -> arr -> arr

TODO

val sub : arr -> arr -> arr

TODO

val mul : arr -> arr -> arr

TODO

val div : arr -> arr -> arr

TODO

val add_scalar : arr -> elt -> arr

TODO

val sub_scalar : arr -> elt -> arr

TODO

val mul_scalar : arr -> elt -> arr

TODO

val div_scalar : arr -> elt -> arr

TODO

val scalar_add : elt -> arr -> arr

TODO

val scalar_sub : elt -> arr -> arr

TODO

val scalar_mul : elt -> arr -> arr

TODO

val scalar_div : elt -> arr -> arr

TODO

val fma : arr -> arr -> arr -> arr

TODO

val elt_equal : arr -> arr -> arr

TODO

val elt_not_equal : arr -> arr -> arr

TODO

val elt_less : arr -> arr -> arr

TODO

val elt_greater : arr -> arr -> arr

TODO

val elt_less_equal : arr -> arr -> arr

TODO

val elt_greater_equal : arr -> arr -> arr

TODO

val elt_equal_scalar : arr -> elt -> arr

TODO

val elt_not_equal_scalar : arr -> elt -> arr

TODO

val elt_less_scalar : arr -> elt -> arr

TODO

val elt_greater_scalar : arr -> elt -> arr

TODO

val elt_less_equal_scalar : arr -> elt -> arr

TODO

val elt_greater_equal_scalar : arr -> elt -> 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.

val print : ?max_row:'a -> ?max_col:'b -> ?header:'c -> ?fmt:'d -> 'e -> unit

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

abs arr returns a new array where each element is the absolute value of the corresponding element in arr.

val neg : arr -> arr

neg arr returns a new array where each element is the negation of the corresponding element in arr.

val floor : arr -> arr

floor arr returns a new array where each element is the floor of the corresponding element in arr.

val ceil : arr -> arr

ceil arr returns a new array where each element is the ceiling of the corresponding element in arr.

val round : arr -> arr

round arr returns a new array where each element is rounded to the nearest integer.

val sqr : arr -> arr

sqr arr returns a new array where each element is the square of the corresponding element in arr.

val sqrt : arr -> arr

sqrt arr returns a new array where each element is the square root of the corresponding element in arr.

val log : arr -> arr

log arr returns a new array where each element is the natural logarithm of the corresponding element in arr.

val log2 : arr -> arr

log2 arr returns a new array where each element is the base-2 logarithm of the corresponding element in arr.

val log10 : arr -> arr

log10 arr returns a new array where each element is the base-10 logarithm of the corresponding element in arr.

val exp : arr -> arr

exp arr returns a new array where each element is the exponential of the corresponding element in arr.

val sin : arr -> arr

sin arr returns a new array where each element is the sine of the corresponding element in arr.

val cos : arr -> arr

cos arr returns a new array where each element is the cosine of the corresponding element in arr.

val tan : arr -> arr

tan arr returns a new array where each element is the tangent of the corresponding element in arr.

val sinh : arr -> arr

sinh arr returns a new array where each element is the hyperbolic sine of the corresponding element in arr.

val cosh : arr -> arr

cosh arr returns a new array where each element is the hyperbolic cosine of the corresponding element in arr.

val tanh : arr -> arr

tanh arr returns a new array where each element is the hyperbolic tangent of the corresponding element in arr.

val asin : arr -> arr

asin arr returns a new array where each element is the arc sine of the corresponding element in arr.

val acos : arr -> arr

acos arr returns a new array where each element is the arc cosine of the corresponding element in arr.

val atan : arr -> arr

atan arr returns a new array where each element is the arc tangent of the corresponding element in arr.

val asinh : arr -> arr

asinh arr returns a new array where each element is the inverse hyperbolic sine of the corresponding element in arr.

val acosh : arr -> arr

acosh arr returns a new array where each element is the inverse hyperbolic cosine of the corresponding element in arr.

val atanh : arr -> arr

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

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

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

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

sum_reduce ?axis arr reduces the array arr by summing along the specified axes.

val signum : arr -> arr

signum arr returns a new array where each element is the sign of the corresponding element in arr.

val sigmoid : arr -> arr

sigmoid arr returns a new array where each element is the sigmoid function applied to the corresponding element in arr.

val relu : arr -> 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.

val min' : arr -> elt

min' arr returns the minimum value in the array arr.

val max' : arr -> elt

max' arr returns the maximum value in the array arr.

val sum' : arr -> elt

sum' arr returns the sum of all elements in the array arr.

val l1norm' : arr -> elt

l1norm' arr returns the L1 norm (sum of absolute values) of all elements in the array arr.

val l2norm' : arr -> elt

l2norm' arr returns the L2 norm (Euclidean norm) of all elements in the array arr.

val l2norm_sqr' : arr -> elt

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

add_scalar arr scalar returns a new array where each element in arr is incremented by scalar.

val sub_scalar : arr -> elt -> arr

sub_scalar arr scalar returns a new array where each element in arr is decremented by scalar.

val mul_scalar : arr -> elt -> arr

mul_scalar arr scalar returns a new array where each element in arr is multiplied by scalar.

val div_scalar : arr -> elt -> arr

div_scalar arr scalar returns a new array where each element in arr is divided by scalar.

val scalar_add : elt -> arr -> arr

scalar_add scalar arr returns a new array where scalar is added to each element in arr.

val scalar_sub : elt -> arr -> arr

scalar_sub scalar arr returns a new array where scalar is subtracted from each element in arr.

val scalar_mul : elt -> arr -> arr

scalar_mul scalar arr returns a new array where each element in arr is multiplied by scalar.

val scalar_div : elt -> arr -> arr

scalar_div scalar arr returns a new array where scalar is divided by each element in arr.

val fma : arr -> arr -> arr -> 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.

val elt_equal : arr -> arr -> arr

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

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

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

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

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

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

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

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

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

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

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

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 conv1d_backward_input : arr -> arr -> int array -> arr -> arr

TODO

val conv1d_backward_kernel : arr -> arr -> int array -> arr -> arr

TODO

val conv2d_backward_input : arr -> arr -> int array -> arr -> arr

TODO

val conv2d_backward_kernel : arr -> arr -> int array -> arr -> arr

TODO

val conv3d_backward_input : arr -> arr -> int array -> arr -> arr

TODO

val conv3d_backward_kernel : arr -> arr -> int array -> arr -> arr

TODO

val transpose_conv2d_backward_input : arr -> arr -> int array -> arr -> arr

TODO

val transpose_conv2d_backward_kernel : arr -> arr -> int array -> arr -> 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.

val conv1d_backward_input : arr -> arr -> int array -> arr -> arr

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

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

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

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

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

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

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

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 row : arr -> 'a -> arr

TODO

val rows : arr -> int array -> arr

TODO

val copy_row_to : arr -> 'a -> 'b -> unit

TODO

val copy_col_to : arr -> 'a -> 'b -> unit

TODO

val trace : arr -> elt

TODO

val dot : arr -> arr -> arr

TODO

val transpose : ?axis:int array -> arr -> arr

TODO

val to_rows : arr -> 'a array

TODO

val of_rows : arr array -> arr

TODO

val to_cols : arr -> 'a array

TODO

val of_cols : arr array -> arr

TODO

val of_array : elt array -> int array -> arr

TODO

val of_arrays : elt array array -> arr

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.

val row : arr -> 'a -> arr

row arr i returns the i-th row of the array arr.

val rows : arr -> int 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.

val trace : arr -> elt

trace arr returns the trace (sum of the diagonal elements) of the array arr.

val dot : arr -> arr -> arr

dot arr1 arr2 returns the dot product of the arrays arr1 and arr2.

val transpose : ?axis:int array -> arr -> arr

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 of_rows : arr array -> arr

of_rows rows creates an array by stacking the input array of rows.

val to_cols : arr -> 'a array

to_cols arr converts the array arr into an array of columns.

val of_cols : arr array -> arr

of_cols cols creates an array by stacking the input array of columns.

val of_array : elt array -> int array -> arr

of_array data shape creates an array of the specified shape from the 1D array data.

val of_arrays : elt array array -> arr

of_arrays data creates an array from the 2D 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

val polint : float array -> float array -> float -> float * float

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.

val ratint : float array -> float array -> float -> float * float

TODO

+Owl_maths_interpolate (owl-base.Owl_maths_interpolate)

Module Owl_maths_interpolate

Interpolation and Extrapolation

val polint : float array -> float array -> float -> float * float

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.

val ratint : float array -> float array -> float -> float * float

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:

  • parameter xs

    An array of x-values (the independent variable).

  • parameter ys

    An array of y-values (the dependent variable) corresponding to xs.

  • parameter x

    The point at which the interpolated value is to be calculated.

    Returns:

  • returns

    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/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

Core evaluation functions of the engine

TODO

TODO

val eval_graph : Graph.graph -> unit

TODO

+E (owl-base.Owl_neural_compiler.Make.E)

Parameter Make.E

Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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

Core evaluation functions of the engine

TODO

TODO

val eval_graph : Graph.graph -> unit

TODO

+Sig (owl-base.Owl_types_computation_engine.Sig)

Module type Owl_types_computation_engine.Sig

Core evaluation functions of the engine

Execute actual computation included in each CGraph element (of output type ndarray) in an array.

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
val length : 'a array -> int

Refer to OCaml native array.

val get : 'a array -> int -> 'a

Refer to OCaml native array.

val set : 'a array -> int -> 'a -> unit

Refer to OCaml native array.

val make : int -> 'a -> 'a array

Refer to OCaml native array.

val create_float : int -> float array

Refer to OCaml native array.

val init : int -> (int -> 'a) -> 'a array

Refer to OCaml native array.

val make_matrix : int -> int -> 'a -> 'a array array

Refer to OCaml native array.

val append : 'a array -> 'a array -> 'a array

Refer to OCaml native array.

val concat : 'a array list -> 'a array

Refer to OCaml native array.

val sub : 'a array -> int -> int -> 'a array

Refer to OCaml native array.

val copy : 'a array -> 'a array

Refer to OCaml native array.

val fill : 'a array -> int -> int -> 'a -> unit

Refer to OCaml native array.

val blit : 'a array -> int -> 'a array -> int -> int -> unit

Refer to OCaml native array.

val to_list : 'a array -> 'a list

Refer to OCaml native array.

val of_list : 'a list -> 'a array

Refer to OCaml native array.

val iter : ('a -> unit) -> 'a array -> unit

Refer to OCaml native array.

val iteri : (int -> 'a -> unit) -> 'a array -> unit

Refer to OCaml native array.

val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b array -> 'a

Refer to OCaml native array.

val fold_right : ('b -> 'a -> 'a) -> 'b array -> 'a -> 'a

Refer to OCaml native array.

val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

Refer to OCaml native array.

val for_all : ('a -> bool) -> 'a array -> bool

Refer to OCaml native array.

val exists : ('a -> bool) -> 'a array -> bool

Refer to OCaml native array.

val mem : 'a -> 'a array -> bool

Refer to OCaml native array.

val memq : 'a -> 'a array -> bool

Refer to OCaml native array.

val min_i : ?cmp:('a -> 'a -> int) -> 'a array -> int

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.

val max_i : ?cmp:('a -> 'a -> int) -> 'a array -> int

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.

val argsort : ?cmp:('a -> 'a -> int) -> 'a array -> int array

argsort cmp x sorts x according to the compare function cmp and returns the corresponding indices.

val sort : ('a -> 'a -> int) -> 'a array -> unit

Refer to OCaml native array.

val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

Refer to OCaml native array.

val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

Refer to OCaml native array.

val sort_fill : ?min:int -> ?max:int -> ?fill:int -> int array -> int array

sort_fill ~min ~max ~fill x first sorts x, then expands it to an array of length max - min + 1, and fills the holes with fill. E.g., sort_fill ~min:1 ~max:5 ~fill:0 [|4;2|] x returns a new array as follows: [|1; 0; 2; 0; 4; 5|].

val unsafe_get : 'a array -> int -> 'a

Refer to OCaml native array.

val unsafe_set : 'a array -> int -> 'a -> unit

Refer to OCaml native array.

Extended functions
val (@) : 'a array -> 'a array -> 'a array

Operator of array concatenation.

val get_slice : int array -> 'a array -> 'a array

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.

val set_slice : int array -> 'a array -> 'a array -> unit

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 flatten : 'a array array -> 'a array

Flatten an array array into an array.

val set_n : 'a array -> int array -> 'a -> unit

TODO

val range : int -> int -> int array

TODO

val count : 'a array -> 'a -> int

TODO

val insert : 'a array -> 'a array -> int -> 'a array

TODO

val unique : 'a array -> 'a array

unique x removes the duplicates in the array x.

val merge : 'a array -> 'a array -> 'a array

merge x y merges two arrays and removes the duplicates.

val remove : 'a array -> int -> 'a array

TODO

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.

val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array

TODO

val map : ('a -> 'b) -> 'a array -> 'b array

TODO

val iter2i : (int -> 'a -> 'b -> unit) -> 'a array -> 'b array -> unit

TODO

val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit

TODO

val iter3i : +Owl_utils_array (owl-base.Owl_utils_array)

Module Owl_utils_array

Basic functions
val length : 'a array -> int

Refer to OCaml native array.

val get : 'a array -> int -> 'a

Refer to OCaml native array.

val set : 'a array -> int -> 'a -> unit

Refer to OCaml native array.

val make : int -> 'a -> 'a array

Refer to OCaml native array.

val create_float : int -> float array

Refer to OCaml native array.

val init : int -> (int -> 'a) -> 'a array

Refer to OCaml native array.

val make_matrix : int -> int -> 'a -> 'a array array

Refer to OCaml native array.

val append : 'a array -> 'a array -> 'a array

Refer to OCaml native array.

val concat : 'a array list -> 'a array

Refer to OCaml native array.

val sub : 'a array -> int -> int -> 'a array

Refer to OCaml native array.

val copy : 'a array -> 'a array

Refer to OCaml native array.

val fill : 'a array -> int -> int -> 'a -> unit

Refer to OCaml native array.

val blit : 'a array -> int -> 'a array -> int -> int -> unit

Refer to OCaml native array.

val to_list : 'a array -> 'a list

Refer to OCaml native array.

val of_list : 'a list -> 'a array

Refer to OCaml native array.

val iter : ('a -> unit) -> 'a array -> unit

Refer to OCaml native array.

val iteri : (int -> 'a -> unit) -> 'a array -> unit

Refer to OCaml native array.

val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b array -> 'a

Refer to OCaml native array.

val fold_right : ('b -> 'a -> 'a) -> 'b array -> 'a -> 'a

Refer to OCaml native array.

val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

Refer to OCaml native array.

val for_all : ('a -> bool) -> 'a array -> bool

Refer to OCaml native array.

val exists : ('a -> bool) -> 'a array -> bool

Refer to OCaml native array.

val mem : 'a -> 'a array -> bool

Refer to OCaml native array.

val memq : 'a -> 'a array -> bool

Refer to OCaml native array.

val min_i : ?cmp:('a -> 'a -> int) -> 'a array -> int

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.

val max_i : ?cmp:('a -> 'a -> int) -> 'a array -> int

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.

val argsort : ?cmp:('a -> 'a -> int) -> 'a array -> int array

argsort cmp x sorts x according to the compare function cmp and returns the corresponding indices.

val sort : ('a -> 'a -> int) -> 'a array -> unit

Refer to OCaml native array.

val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

Refer to OCaml native array.

val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

Refer to OCaml native array.

val sort_fill : ?min:int -> ?max:int -> ?fill:int -> int array -> int array

sort_fill ~min ~max ~fill x first sorts x, then expands it to an array of length max - min + 1, and fills the holes with fill. E.g., sort_fill ~min:1 ~max:5 ~fill:0 [|4;2|] x returns a new array as follows: [|1; 0; 2; 0; 4; 5|].

val unsafe_get : 'a array -> int -> 'a

Refer to OCaml native array.

val unsafe_set : 'a array -> int -> 'a -> unit

Refer to OCaml native array.

Extended functions
val (@) : 'a array -> 'a array -> 'a array

Operator of array concatenation.

val get_slice : int array -> 'a array -> 'a array

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.

val set_slice : int array -> 'a array -> 'a array -> unit

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 flatten : 'a array array -> 'a array

Flatten an array array into an array.

val set_n : 'a array -> int array -> 'a -> unit

set_n arr indices v sets the elements at the positions specified by indices in the array arr to the value v.

  • parameter arr

    The array in which to set values.

  • parameter indices

    An array of indices specifying the positions in arr to be updated.

  • parameter v

    The value to set at each of the specified positions.

val range : int -> int -> int array

range start stop generates an array of integers from start to stop inclusive.

  • parameter start

    The starting value of the range.

  • parameter stop

    The ending value of the range.

  • returns

    An array of integers from start to stop.

val count : 'a array -> 'a -> int

count arr x counts the number of occurrences of the value x in the array arr.

  • parameter arr

    The array in which to count occurrences.

  • parameter x

    The value to count within the array.

  • returns

    The number of times x appears in arr.

val insert : 'a array -> 'a array -> int -> 'a array

insert arr1 arr2 pos inserts the elements of arr2 into arr1 at the specified position pos.

  • parameter arr1

    The array into which elements are inserted.

  • parameter arr2

    The array of elements to insert into arr1.

  • parameter pos

    The position in arr1 at which to insert arr2.

  • returns

    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.

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

remove arr pos removes the element at position pos from the array arr.

val replace : int -> int -> 'a array -> 'a array -> 'a array

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

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

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

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

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

val iter3 : + unit

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

val iter4i : + unit

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

val iter4 : + unit

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

val map2i : (int -> 'a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

TODO

val map2i_split2 : + unit

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

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

val map3i : + 'c array * 'd array

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

val map3 : + 'd array

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

val map4i : + 'd array

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

val map4 : + 'e array

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

val filteri_v : (int -> 'a -> bool * 'b) -> 'a array -> 'b array

TODO

val filter_v : ('a -> bool * 'b) -> 'a array -> 'b array

TODO

val filteri : (int -> 'a -> bool) -> 'a array -> 'a array

filteri f x filters out the elements in x according to predicate f.

val filter : ('a -> bool) -> 'a array -> 'a array

filter f x filters out the elements in x according to predicate f.

val filter2i : + 'e array

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

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

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.

val filter : ('a -> bool) -> 'a array -> 'a array

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.

val resize : ?head:bool -> 'a -> int -> 'a array -> 'a 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.

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 align : + '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.

val resize : ?head:bool -> 'a -> int -> 'a array -> 'a 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.

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

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.

val greater_eqaul : 'a array -> 'a array -> bool

TODO

val swap : 'a array -> int -> int -> unit

TODO

val permute : int array -> 'a array -> 'a array

TODO

val of_tuples : ('a * 'a) array -> 'a array

TODO

val complement : 'a array -> 'a array -> 'a array
val balance_last : float -> float array -> float array

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).

val index_of : 'a array -> 'a -> int

index_of x a returns the index of first occurrence of a in x.

val bsearch : cmp:('a -> 'a -> int) -> 'a -> 'a array -> int

Binary search. bsearch cmp x a returns the index of the largest value in the sorted array a less than or equal to x, according to the comparison function cmp. If x is smaller than all elements, returns -1. The function raises an exception if a is empty.

val to_string : + 'a array * 'a array * 'a array

align3 side v x y z aligns three arrays x, y, and z.

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

swap arr i j swaps the elements at indices i and j in the array arr.

val permute : int array -> 'a array -> 'a array

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

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
val balance_last : float -> float array -> float array

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).

val index_of : 'a array -> 'a -> int

index_of x a returns the index of first occurrence of a in x.

val bsearch : cmp:('a -> 'a -> int) -> 'a -> 'a array -> int

Binary search. bsearch cmp x a returns the index of the largest value in the sorted array a less than or equal to x, according to the comparison function cmp. If x is smaller than all elements, returns -1. The function raises an exception if a is empty.

val to_string : ?prefix:string -> ?suffix:string -> ?sep:string -> ('a -> string) -> 'a array -> - string

TODO

+ 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

TODO

val make_reverse : t -> int -> t

TODO

val reverse_prop : t -> t -> unit

TODO

val diff : (t -> t) -> t -> t

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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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
Type definition
include Owl_algodiff_types_sig.Sig with type elt := A.elt and type arr := A.arr
type t =
  1. | F of A.elt
  2. | Arr of A.arr
  3. | DF of t * t * int
  4. | DR of t * t Stdlib.ref * op * int Stdlib.ref * int * int Stdlib.ref
and adjoint = t -> t Stdlib.ref -> (t * t) list -> (t * t) list
and register = t list -> t list
and label = string * t list
and op = adjoint * register * label
Core functions
val tag : unit -> int

TODO

val primal : t -> t

TODO

val primal' : t -> t

TODO

val zero : t -> t

TODO

val reset_zero : t -> t

TODO

val tangent : t -> t

TODO

val adjref : t -> t Stdlib.ref

TODO

val adjval : t -> t

TODO

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 clip_by_value : amin:A.elt -> amax:A.elt -> t -> t

other functions, without tracking gradient

val clip_by_l2norm : A.elt -> t -> t

other functions, without tracking gradient

val copy_primal' : t -> t

TODO

val tile : t -> int array -> t

TODO

val repeat : t -> int array -> t

TODO

val pack_elt : A.elt -> t

convert from elt type to t type.

val unpack_elt : t -> A.elt

convert from t type to elt type.

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 pack_arr : A.arr -> t

convert from arr type to t type.

val unpack_arr : t -> A.arr

convert from t type to arr type.

val deep_info : t -> string

TODO

val type_info : t -> string

TODO

val error_binop : string -> t -> t -> 'a

TODO

val error_uniop : string -> t -> 'a

TODO

val make_forward : t -> t -> int -> t

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

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

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 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 |> ...

val diff' : (t -> t) -> t -> t * t

similar to diff, but return (f x, diff f x).

val grad : (t -> t) -> t -> t

gradient of f : (vector -> scalar) at x, reverse ad.

val grad' : (t -> t) -> t -> t * t

similar to grad, but return (f x, grad f x).

val jacobian : (t -> t) -> t -> t

jacobian of f : (vector -> vector) at x, both x and y are row vectors.

val jacobian' : (t -> t) -> t -> t * t

similar to jacobian, but return (f x, jacobian f x)

val jacobianv : (t -> t) -> t -> t -> t

jacobian vector product of f : (vector -> vector) at x along v, forward ad. Namely, it calcultes (jacobian x) v

val jacobianv' : (t -> t) -> t -> t -> t * t

similar to jacobianv', but return (f x, jacobianv f x v)

val jacobianTv : (t -> t) -> t -> t -> t

transposed jacobian vector product of f : (vector -> vector) at x along v, backward ad. Namely, it calculates transpose ((jacobianv f x v)).

val jacobianTv' : (t -> t) -> t -> t -> t * t

similar to jacobianTv, but return (f x, transpose (jacobianv f x v))

val hessian : (t -> t) -> t -> t

hessian of f : (scalar -> scalar) at x.

val hessian' : (t -> t) -> t -> t * t

simiarl to hessian, but return (f x, hessian f x)

val hessianv : (t -> t) -> t -> t -> t

hessian vector product of f : (scalar -> scalar) at x along v. Namely, it calculates (hessian x) v.

val hessianv' : (t -> t) -> t -> t -> t * t

similar to hessianv, but return (f x, hessianv f x v).

val laplacian : (t -> t) -> t -> t

laplacian of f : (scalar -> scalar) at x.

val laplacian' : (t -> t) -> t -> t * t

similar to laplacian, but return (f x, laplacian f x).

val gradhessian : (t -> t) -> t -> t * t

return (grad f x, hessian f x), f : (scalar -> scalar)

val gradhessian' : (t -> t) -> t -> t * t * t

return (f x, grad f x, hessian f x)

val gradhessianv : (t -> t) -> t -> t -> t * t

return (grad f x v, hessian f x v)

val gradhessianv' : (t -> t) -> t -> t -> t * t * t

return (f x, grad f x v, hessian f 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