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 | vc = 0 |
v = x | vc = 1 |
v = u ± w | vc = uc + wc |
v = u * w | vc = 2 * ( uc + wc) |
vc = 4 * ( uc + wc ) | |
v = uc | vc = 3 * uc |
v = u \ w | vc = infinity |
v= f(u1, ..., un) | vc = infinity |
v = bui(u1, ..., un) | vc = SUM(i=1..n,uc,i)/n |