Language Reference


TRACE Function

TRACE (matrix);

The TRACE function returns the sum of the diagonal elements of matrix, as shown in the following example:

a = trace({5 2,
           1 3});
print a;

Figure 25.416: Trace of a Matrix

a
8