package fadbadml

  1. Overview
  2. Docs

Module Badiff.OrderedBTypeNameSource

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

Sourcetype t
Sourcetype elt = T.elt

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

Sourcetype scalar = T.scalar

Type of scalars

Sourceval copy : t -> t
Sourceval deepcopy : t -> t

Constructors

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

Wrap a user-provided value

Sourceval integer : int -> t

Wrap an integer

Sourceval zero : unit -> t

Construct a fresh value corresponding to 0

Sourceval one : unit -> t

Construct a fresh value corresponding to 1

Sourceval two : unit -> t

Construct a fresh value corresponding to 2

Destructors

Sourceval get : t -> elt

Unwrap a value

Sourceval (!!) : t -> elt

Alias for get

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

Arithmetic operators

Sourceval (~+) : t -> t

unary plus (with copy)

Sourceval (~-) : t -> t

unary minus (with copy)

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

Scalar operators

Sourceval scale : t -> scalar -> t

Multiplication between a value and a scalar

Sourceval translate : t -> scalar -> t

Addition between a value and a scalar

Comparison operators

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

Operators

Sourcetype op = ..
Sourcetype 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

Sourceval lift : T.t -> t

Accessors

Sourceval value : t -> T.t

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

Automatic Differentiation

Sourceval diff : t -> int -> int -> unit

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

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

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

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

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

Sourceval compute_list : t list -> unit

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

OCaml

Innovation. Community. Security.