r = Matrices.trace(A);
This function computes the trace, i.e., the sum of the elements in the diagonal of matrix A.
A = [1, 3; 2, 1]; r = trace(A); results in: r = 2.0
function trace extends Modelica.Icons.Function; input Real A[:, size(A, 1)] "Square matrix A"; output Real result "Trace of A"; end trace;