package fadbadml

  1. Overview
  2. Docs

Extends BTypeName with comparison operators.

  • parameter T

    module of operators over the underlying type on which we perform automatic differentiation

Parameters

module T : sig ... end

Signature

type t
type elt = T.elt

Type of values: this is the type that the user should use with make and that will be returned by get

type scalar = T.scalar

Type of scalars

val copy : t -> t
val deepcopy : t -> t

Constructors

val create : unit -> t
val make : elt -> t

Wrap a user-provided value

val integer : int -> t

Wrap an integer

val zero : unit -> t

Construct a fresh value corresponding to 0

val one : unit -> t

Construct a fresh value corresponding to 1

val two : unit -> t

Construct a fresh value corresponding to 2

Destructors

val get : t -> elt

Unwrap a value

val (!!) : t -> elt

Alias for get

val to_string : t -> string
val string_of_scalar : scalar -> string
val string_of_elt : elt -> string

Arithmetic operators

val (~+) : t -> t

unary plus (with copy)

val (~-) : t -> t

unary minus (with copy)

val (+) : t -> t -> t
val (+=) : t -> t -> t
val (-) : t -> t -> t
val (-=) : t -> t -> t
val (*) : t -> t -> t
val (*=) : t -> t -> t
val (/) : t -> t -> t
val (/=) : t -> t -> t
val (**) : t -> t -> t
val inv : t -> t
val sqr : t -> t
val sqrt : t -> t
val log : t -> t
val exp : t -> t
val sin : t -> t
val cos : t -> t
val tan : t -> t
val asin : t -> t
val acos : t -> t
val atan : t -> t

Scalar operators

val scale : t -> scalar -> t

Multiplication between a value and a scalar

val translate : t -> scalar -> t

Addition between a value and a scalar

Comparison operators

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val min : t -> t -> t
val max : t -> t -> t

Operators

type op = ..
type op +=
  1. | CONST
  2. | SCALE of scalar
  3. | TRANS of scalar
  4. | ADD
  5. | SUB
  6. | MUL
  7. | DIV
  8. | POW
  9. | POS
  10. | NEG
  11. | INV
  12. | SQR
  13. | SQRT
  14. | EXP
  15. | LOG
  16. | SIN
  17. | COS
  18. | TAN
  19. | ASIN
  20. | ACOS
  21. | ATAN

Additionnal constructors

val lift : T.t -> t

Accessors

val value : t -> T.t

Same as get but returns an T.t instead of an elt

Automatic Differentiation

val diff : t -> int -> int -> unit

diff x i n assigns i as index of variable x out of n

val d : t -> int -> elt

d f i retrieves the derivative of variable of index i in computation f as an elt. Must be called after diff and compute.

val deriv : t -> int -> T.t

Same as d but returns an T.t instead of an elt

val compute : t -> unit

compute f updates the reference counter of the nodes in the sub-graph starting from f so that they are propagated at the right moment. Must be called before d or deriv.

val compute_list : t list -> unit

Same as running compute on each element of the input list.

OCaml

Innovation. Community. Security.