Calculate the trace of a square matrix.
Trace(m)
m
The return value is the trace of the input matrix.
m <- matrix(c(1, 0, 0, 1), 2, 2) Trace(m)