package fadbadml

  1. Overview
  2. Docs

Module Fadiff.FTypeNameSource

Re-define usual operators to compute values and derivatives for elements of type T.t in forward mode.

  • 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

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

Sourceval dim : t -> int

Size of differentiation vector

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

Sourceval 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

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

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

Sourceval reset_diff : t -> unit
OCaml

Innovation. Community. Security.