traceReturn the trace of matrix A, i.e., the sum of the diagonal elements |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
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
A |
Type: Real[:,size(A, 1)] Description: Square matrix A |
---|
result |
Type: Real Description: Trace of A |
---|