ADiMat defines several different modes of source code transformation, which are called toolchains. The most prominent are the transformation in forward mode and reverse mode of AD, but there are others. All can be accessed from within Matlab via the admTransform command, from the command line via the adimat-client program or via the web interface.
When you use the admTransform function, give it the name of handle of
your function and an admOptions structure. In this structure the
fields mode
and toolchain
allow you to choose the toolchain. The four
AD transformations are set via the field mode:
'F'
- perform forward mode AD transformation by the classic ADiMat
implementation. This is used by admDiffFor'f'
- run the toolchain "forward-ad", which perform the new forward
mode AD transformation, as it is used by admDiffVFor'r'
- run the toolchain "reverse-ad", which performs the reverse mode
AD transformation, as it is used by admDiffRev and admTaylorRev't'
- run the toolchain "taylor-ad", which performs the new forward
mode AD transformation for progagating univariate Taylor coefficients,
as it is used by admTaylorForThe other toolchains are selected by specifying their name, as it is given in the list of toolchains (cf. List of toolchains). The toolchain name also appears on the web interface.
When using adimat-client
, the four AD modes are selected by
the short flags -F
, -f
, -r
, and -t
, with the same
meaning as in the list above. The classic forward mode AD is the
default, so the -F
flag may be omitted. The other toolchains are
selected by giving the name to the option -T
.
On the web interface of the ADiMat transformation server you can choose the toolchain in the select field which is in the fieldset labeled "Select transformation". Selecting a toolchain will show a corresponding fieldset. These will automatically show fields for the mandatory parameters. Other parameters can be added by clicking on the button "Add a parameter".
This is a provisional list of the most important parameters. For more information please refer to the web server interface.
This is used by admDiffFor.
Parameters:
This prefix is added to each active variable. The prefix is used for variables, when ADiMat is in forward mode (<PREFIX>='g_').
If the 2ndorderfwd
(
2ndorderfwd)
flag is set, then this prefix is used to preceed the variables that
store Hessians (<PREFIX>='h_').
The prefix is added to each function that is augemented in forward mode. There is no distinction between functions that are differentiated once or twice. (<PREFIX>='g_')
Parameters:
This prefix is added to each active variable. The prefix is used for variables and functions.
The prefix used for differentiated variables (default: <PREFIX>=$prefix).
The prefix used for differentiated functions (default: <PREFIX>=$prefix).
Set to one to wrap index operations on RHS in calls to the adimat_opdiff_subsref function (default: 0). Try to turn this on when you get errors regarding dimension mismatches or wrong sizes. However, code with this option on is much slower. See How can I avoid having to use subsref and subsasgn.
Set to one to wrap assignments to index expressions in calls to the adimat_opdiff_subsasgn function (default: 0). Try to turn this on when you get errors regarding dimension mismatches or wrong sizes. However, code with this option on is much slower. See How can I avoid having to use use-subsref and use-subsasgn.
Parameters:
Translate instances of brackets [] to calls to the functions horzcat and/or vertcat.
Rewrite calls of functions horzcat and/or vertcat with brackets [].
Translate index expression to calls to the functions subsref (RHSs) and subsasgn (LHSs).
Returns the raw XML output of the parser in the adimat tool. Results of activity analysis for each variable and the function call graph are also included.
Renames all identifiers given by parameter "from" to the value of parameter "to".
ADiMat uses several parameters that can be used to influence certain aspects of the source code transformation. The set of parameters is different for each transformation toolchain.
Transformation parameters are set using the sub struct parameters of the admOptions structure. This is contructed by the function admTransformParameters.
adopts = admOptions; adopts.parameters.useSubsref = '1';
Transformation parameters can also be set on the command line of adimat-client, by passing a string of the form name=value to the option -s, for example like this:
adimat-client -f -o- -s use-subsref=1 f.m
Parameter names are slightly different in both cases: in the structure, the parameter names are written in camel-style, e.g. "useSubsref", or "printStackInfo". On the command-line, dashed style is used instead: "use-subsref", or "print-stack-info". Parameter name are translated automatically when the command-line is constructed by admTransform.
This is a provisional list of the most important parameters. For more information please refer to the web server interface. For any toolchain you select on the web server, when you hit the button "Add a parameter", you will see only the parameters that are relevant for that toolchain.