Module Tadiff.OrderedTTypeName
Extends TTypeName with comparison operators.
- parameter T
module of operators over the underlying type on which we perform automatic differentiation
Parameters
Signature
include Fadbad__.Types.OrderedOpS with type elt = T.elt and type scalar = T.scalar
include Fadbad__.Types.OpS
type ttype eltType of values: this is the type that the user should use with
makeand that will be returned byget
Constructors
val integer : int -> tWrap an integer
val zero : unit -> tConstruct a fresh value corresponding to 0
val one : unit -> tConstruct a fresh value corresponding to 1
val two : unit -> tConstruct a fresh value corresponding to 2
Destructors
Arithmetic operators
val (+) : t -> t -> tval (+=) : t -> t -> tval (-) : t -> t -> tval (-=) : t -> t -> tval (*) : t -> t -> tval (*=) : t -> t -> tval (/) : t -> t -> tval (/=) : t -> t -> tval (**) : t -> t -> tval inv : t -> tval sqr : t -> tval sqrt : t -> tval log : t -> tval exp : t -> tval sin : t -> tval cos : t -> tval tan : t -> tval asin : t -> tval acos : t -> tval 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 -> intCurrent number of coefficients that have been computed
Constructors
Automatic Taylor Expansion
val set : t -> int -> T.t -> unitset f i vsets thei-th coefficient offtov, 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 -> eltd f iretrieves the coefficient of orderiin computationfas anelt. Must be called aftereval.
val deriv : t -> int -> T.tderiv f iretrieves the coefficient of orderiin computationf. Must be called aftereval.
val get_tvalues : t -> elt arrayget_tvalues fretrieves the array of taylor coefficients off. Must be called aftereval.
val get_derivatives : t -> elt arrayget_derivatives fretrieves the array of derivatives off. Must be called aftereval.
val eval : t -> int -> inteval f ipropagates the firstitaylor coefficients of f. The direction of the expansion should have been set usingset.
val reset : t -> unitreset fresets all the arrays of coefficients. It is used to compute a new expansion on the same expression without building a new graph.