Library
Module
Module type
Parameter
Class
Class type
Re-define usual operators to compute values and taylor coefficients for elements of type T.t.
module T : sig ... end
type elt = T.elt
Type of values: this is the type that the user should use with make
and that will be returned by get
type scalar = T.scalar
Type of scalars
val create : unit -> t
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
val to_string : t -> string
val string_of_scalar : scalar -> string
val string_of_elt : elt -> string
val string_of_op : op -> string
val order : t -> int
Current number of coefficients that have been computed
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
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
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.
.
d f i
retrieves the coefficient of order i
in computation f
as an elt
. Must be called after eval
.
deriv f i
retrieves the coefficient of order i
in computation f
. Must be called after eval
.
get_tvalues f
retrieves the array of taylor coefficients of f
. Must be called after eval
.
get_derivatives f
retrieves the array of derivatives of f
. Must be called after eval
.
val 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
.
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.