Next Previous Contents

18. Known bugs and limitations

Index operations with repeated indices (Rev)

When using repeated indices in an index expression, for example x([2 2 2]), the RM differentiation will return wrong results.

Tilde ignored results (For, VFor, Rev)

Ignoring output arguments using tilde (example: [~, S, ~] = svd(A)) is not supported because our parser is not able to recognize it. Dummy variable names must be used instead: [dummy, S, dummy] = svd(A)

Index assignment from a call RHS (For)

When an index expression x(i) is assigned and the RHS is a non-active function call f(...), admDiffFor will afterwards clear the entire variable g_x and not just g_x(i). Workaround: use a temporary variable, like this:


tmp = f(...);
x(i) = tmp;

Although certain builtins are implemented, some partials are still missing (For, VFor, Rev)

For certain builtins, whos derivative have been added to ADiMat, some partials are still missing. This means that you cannot differentiate those builtins w.r.t. certain parameters. The partial derivatives w.r.t those parameters are treated as zero, and unfortunately in most of the cases there will not even be a warning or error message. The following list attempts to collect the cases were we think that a builtin is differentiable w.r.t a certain parameter but the AD modes of ADiMat cannot compute that partial:

When LHS values are indexed, their reuse in derivative computations fails (For)

As stated in Is the derivative assignment put in front of the orginial expression? admDiffFor will in some instances reuse the LHS of an assignment in derivative computations, like this:


   z= a/ b;
   g_r(1: l, 1)= (b' \ (g_a' - g_b' * z' ))' ;

However, when the LHS is an indexed expression the shape of the value may implicitly change during the assignment, so that reusing the LHS value does not work as expected:
   r(:)= a/ b;
   g_r(1: l, 1)= (b' \ (g_a' - g_b' * r(:)' ))' ;

The workaround is to introduce a temporary variable, like this:
   tmp= a/ b;
   r(:)= tmp;


Next Previous Contents