Module Fadbad__Tadiff.TTypeName
Re-define usual operators to compute values and taylor coefficients for elements of type T.t.
- 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
Operators
type op +=
CONST
|
SCALE of scalar
|
TRANS of scalar
|
SIN of T.t array
|
COS of T.t array
|
ADD
|
SUB
|
MUL
|
DIV
|
POW
|
POS
|
NEG
|
INV
|
SQR
|
SQRT
|
EXP
|
LOG
|
TAN
|
ASIN
|
ACOS
|
ATAN
val string_of_op : op -> string
Additionnal constructors
Accessors
val order : t -> int
Current number of coefficients that have been computed
Constructors
Automatic Taylor Expansion
val set : t -> int -> T.t -> unit
set f i v
sets thei
-th coefficient off
tov
, this is used to set the direction of the expansion. For example, to expand wrt. a variable x, one would callset x 1 1.
. This can also be used to change the value of a variable: eg.set x 0 5.
.
val d : t -> int -> elt
d f i
retrieves the coefficient of orderi
in computationf
as anelt
. Must be called aftereval
.
val deriv : t -> int -> T.t
deriv f i
retrieves the coefficient of orderi
in computationf
. Must be called aftereval
.
val get_tvalues : t -> elt array
get_tvalues f
retrieves the array of taylor coefficients off
. Must be called aftereval
.
val get_derivatives : t -> elt array
get_derivatives f
retrieves the array of derivatives off
. Must be called aftereval
.
val eval : t -> int -> int
eval f i
propagates the firsti
taylor coefficients of f. The direction of the expansion should have been set usingset
.
val reset : t -> unit
reset f
resets all the arrays of coefficients. It is used to compute a new expansion on the same expression without building a new graph.