Calculates the trace of a square matrix.

tr(x, ...)

Arguments

x

Square numeric matrix

...

Additional arguments to lower level functions

Value

numeric

See also

Author

Klaus K. Holst

Examples


tr(diag(1:5))
#> [1] 15