trace

STD.BLAS.trace ( m, n, x );

mNumber of rows
nNumber of columns
xThe matrix
Return:The trace (sum of the diagonal entries)

The trace function computes the trace of the input matrix

Example:

IMPORT STD;
STD.BLAS.Types.matrix_t x := [1.0, 2.0, 3.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0];
trace_of_x := STD.BLAS.trace(3,3,x); // the trace is 7