package fadbadml

  1. Overview
  2. Docs

Module Tadiff.OrderedTTypeNameSource

Extends TTypeName with comparison operators.

  • 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
Sourceval (<) : t -> t -> bool
Sourceval (<=) : t -> t -> bool
Sourceval (>) : t -> t -> bool
Sourceval (>=) : t -> t -> bool
Sourceval min : t -> t -> t
Sourceval max : t -> t -> t

Operators

Sourcetype op = ..
Sourcetype op +=
  1. | CONST
  2. | SCALE of scalar
  3. | TRANS of scalar
  4. | SIN of T.t array
  5. | COS of T.t array
  6. | ADD
  7. | SUB
  8. | MUL
  9. | DIV
  10. | POW
  11. | POS
  12. | NEG
  13. | INV
  14. | SQR
  15. | SQRT
  16. | EXP
  17. | LOG
  18. | TAN
  19. | ASIN
  20. | ACOS
  21. | ATAN
Sourceval string_of_op : op -> string

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 operator : t -> op

operator f retrieves the operator represented by f

Sourceval order : t -> int

Current number of coefficients that have been computed

Constructors

Sourceval un_op : op -> t -> t

un_op op f builds a node that represents the expression op(f) where op is a unary operator. This is useful to write custom operators

Sourceval bin_op : op -> t -> t -> t

bin_op op f1 f2 builds a node that represents the expression op(f1,f2) where op is a binary operator. This is useful to write custom operators

Automatic Taylor Expansion

Sourceval set : t -> int -> T.t -> unit

set f i v sets the i-th coefficient of f to v, this is used to set the direction of the expansion. For example, to expand wrt. a variable x, one would call set x 1 1.. This can also be used to change the value of a variable: eg. set x 0 5..

Sourceval d : t -> int -> elt

d f i retrieves the coefficient of order i in computation f as an elt. Must be called after eval.

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

deriv f i retrieves the coefficient of order i in computation f. Must be called after eval.

Sourceval get_tvalues : t -> elt array

get_tvalues f retrieves the array of taylor coefficients of f. Must be called after eval.

Sourceval get_derivatives : t -> elt array

get_derivatives f retrieves the array of derivatives of f. Must be called after eval.

Sourceval eval : t -> int -> int

eval f i propagates the first i taylor coefficients of f. The direction of the expansion should have been set using set.

Sourceval 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.

OCaml

Innovation. Community. Security.