tr function

Trace of a matrix.