Module Fadiff.FTypeName
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
Signature
include Fadbad__.Types.OpS with type elt = T.elt and type scalar = T.scalar
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 byget
type scalar
= T.scalar
Type of scalars
Constructors
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
Arithmetic operators
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
Comparison operators
Additionnal constructors
Accessors
val dim : t -> int
Size of differentiation vector
Automatic Differentiation
val diff : t -> int -> int -> unit
diff x i n
assignsi
as index of variablex
out ofn
val d : t -> int -> elt
d f i
retrieves the derivative of variable of indexi
in computationf
as anelt
val set_deriv : t -> int -> T.t -> unit
set_deriv f i x
sets the derivative off
with respect to the variable of indexi
tox
val deriv : t -> int -> T.t
deriv f i
retrieves the derivative of variable of indexi
in computationf
val reset_diff : t -> unit