ADiMat comes with a set of Matlab functions. The most prominent are the derivative classes, which are described in a seperate chapter. In this chapter we describe the funtions that make up the ADiMat runtime environment.
Differentiate function and compute the product J*S of the Jacobian matrix J at arguments arg1, ..., argN and the seed matrix S. The computational expense depends linearly on the number of columns of S.
admDiffFor(@f, 1, a, b, c) returns the full Jacobian matrix of function f evaluated at the point (a, b, c). The value of 1 for the seed matrix is a shortcut for the identity matrix of the right size.
admDiffFor(@f, [1 1 1]', 1, 2, 3) returns the column sum of the Jacobian matrix of function f evaluated at the point (1, 2, 3).
Differentiate function and compute the product J*S of the Jacobian matrix J at arguments arg1, ..., argN and the seed matrix S. The computational expense depends linearly on the number of columns of S.
This function uses the new forward mode. Otherwise the functionality is the same.
Differentiate function in reverse mode and compute the product S*J of the the seed matrix S and the Jacobian matrix J at arguments arg1, ..., argN. The computational expense depends linearly on the number of rows of S.
admDiffRev(@f, 1, a, b, c) returns the full Jacobian matrix of function f evaluated at the point (a, b, c).
admDiffRev(@f, [1 1 1], 1, 2, 3) returns the row sum of the Jacobian matrix of function f evaluated at the point (1, 2, 3).
Compute unvariate Taylor coefficients of function, with OO, see Higher order derivatives
Compute unvariate Taylor coefficients of function, with FM ST, see Higher order derivatives
Compute derivatives of unvariate Taylor coefficients of function, with OO applyied to function differentiated in RM, see Higher order derivatives
Compute Hessian of function, using one of several strategies, by default FM-over-RM, see Higher order derivatives
Compute Hessian of function via second order Taylor coefficients, see Higher order derivatives
Compute Hessian of function via second order FM differntiation, see Higher order derivatives
Differentiate function and compute the product J*S of the Jacobian matrix J at arguments arg1, ..., argN and the seed matrix S. The computational expense depends linearly on the number of columns of S.
This function does not do AD at all, but instead uses the so called complex variable method to compute derivatives. The results are equally precise as those returned by AD, provided the function is real and analytic. This functions is provided in order to facilitate the comparison of AD results with the complex variable method.
Differentiate function and compute the product J*S of the Jacobian matrix J at arguments arg1, ..., argN and the seed matrix S. The computational expense depends linearly on the number of columns of S.
This function does not do AD at all, but instead uses divided differences to evaluate the derivatives approximately. The results are at best precise up to half of the machines matissa bits, but may be less precise when the differential step h is chosen carefully. Use the field ddStep of the admOptions structure to adjust the differential step h to your function. This functions is provided in order to facilitate the comparison of AD results with divided differences.
Create a structure that can be used to pass options to the admDiff*
functions, as the last parameter, called opts
in the synopses
above.
Matlab frontend to adimat-client (or admproc, if
present). Differentiate function
using ADiMat. function
can
be a filename as a string or a function handle. flags
is a string
which is added to the adimat-client command line. indeps
and
deps
are strings containing comma separated lists of variable
names or positions.
admTransform works by executing the program adimat-client (or admproc, if present) via the system builtin. The builtin which is used to determine the path and filename of function. admTransform will automatically add the options -I and -p with appropriate arguments to the command line, for adding the directory where the file resides to ADiMat's search path and writing the transformed file to the same directory. You can override the output directory by providing your own -p option in flags.
admTransform(function) transforms the function in classic forward mode.
admTransform(function, indeps, deps, '-F') is the same.
admTransform(function, indeps, deps, '-f') transforms the function in the new forward mode.
admTransform(function, indeps, deps, '-r') transforms the function in the reverse mode.
admTransform(function, [1], [2], mode) transforms the function such that you can compute the derivative of the second output parameter w.r.t. the first input parameter of the function.
Deprecated: This function is now just a synonym for admTransform.
Deprecated: This function is now just a synonym for admTransform.
This function deletes the ADiMat-generated functions from the
directory baseDir
. With the string modes
you can choose
which kind of files will be deleted. The letters in the string
correspond to the mode flags (see
Modes and toolchains), plus 's'
which refers to the status directory
.adimat
.
Warning: Use this function with some care as the file name patterns might also match some other files!
Select the derivative class. This merely modifies the Matlab
path. For a description of the classes, see
The derivative classes. If name
is the string 'list', a
list of available classes is returned. With no argument, the name of
the currently loaded derivative class is returned.
Select the adjoint class. This merely modifies the Matlab path. There are two options, 'default' and 'scalar'. With no argument, the name of the currently loaded adjoint class is returned.
This is the most prominent runtime function found in the transformed source code. Returns zero derivative objects of dimension sz of the derivative class that is currently in use (see adimat_derivclass). In the case of scalar_directderivs, simply returns zeros(sz), i.e. a plain double array.
When adimat_adjoint is 'default', then returns g_zeros(size(v)) to return zero adjoint objects. When adimat_adjoint is 'scalar' then returns zeros(size(v)), i.e. a plain double array.
Select the stack implementation. All stacks are implemented via a
single function adimat_store. This function switches the path to
various directories where different implementations of adimat_store
reside. If name
is the string 'list', a list of available
impletations is returned. With no argument, the name of the currently
loaded stack is returned.
Push values on the stack. Takes any number of arguments.
Pop values from the stack. Returns any number of output arguments, but one value is always removed from the stack.
Operate on the stack according to mode:
Calls adimat_store(2)
Calls adimat_store(3)
Calls adimat_store(4)
Calls adimat_store(6)
Calls adimat_store(5)
Sets the size of the buffer used by the stack implementations with "buffered" in their name.
Sets the parameters of the aio.h API calling aio_init. Used by the stack implementations with "abuffered" in their name.
Sets a parameter of the aio.h based streambuffer, controlling how many preceding blocks of memory to prefetch when a read is being waited for.