package fadbadml

  1. Overview
  2. Docs

Extends FTypeName 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

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

val dim : t -> int

Size of differentiation vector

Automatic Differentiation

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

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

val set_deriv : t -> int -> T.t -> unit

set_deriv f i x sets the derivative of f with respect to the variable of index i to x

val d : t -> int -> elt

d f i retrieves the derivative of variable of index i in computation f as an elt

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

deriv f i retrieves the derivative of variable of index i in computation f

val reset_diff : t -> unit
OCaml

Innovation. Community. Security.