R/convenience.R
tr.Rd
Sum of diagonal elements of a matrix.
tr(x)
A matrix.
The sum of the diagonal elements of x.
x
tr(ones(5, 10)) #> [1] 5 x <- replicate(1000, tr(rand(25, 25))) hist(x)