Matlab enables the use of rather complex formula. These expressions are unwieldy. ADiMat may break up complex active expressions into many smaller expressions, this process is called 'outlining' in contrast to the inlining process performed by many compilers. The 'outlined' subexpressions are assigned to uniquely generated temporary variables. The temporary variables are inserted into the complex expression where the subexpression was removed. This process has some advantages:
for constant expressions, like numbers or operations that do not contain an active variable,
for an active variable,
for subexpressions that may contain active variables,
for calls to user-defined functions,
for calls to functions that are defined to be built into Matlab,
for the costs of the corresponding subexpression,
telling that the coresponding expression is outlined where ever it occurs (See below for more information), and
for the sum of n summands of the expressions expr using i for indexing.
operation | cost |
v = c | v_{c} = 0 |
v = x | v_{c} = 1 |
v = u ± w | v_{c} = u_{c} + w_{c} |
v = u * w | v_{c} = 2 * ( u_{c} + w_{c}) |
v_{c} = 4 * ( u_{c} + w_{c} ) | |
v = u^{c} | v_{c} = 3 * u_{c} |
v = u \ w | v_{c} = infinity |
v= f(u_{1}, ..., u_{n}) | v_{c} = infinity |
v = bui(u_{1}, ..., u_{n}) | v_{c} = SUM(i=1..n,u_{c,i})/n |