# tr

From lasso2 v1.2-9
by Berwin Turlach

##### Trace of a Matrix

Calculates the trace of a matrix

- Keywords
- math

##### Usage

`tr(mat)`

##### Value

The trace of the matrix, i.e. the sum of its diagonal elements, is returned.

##### Examples

`tr(cbind(1,1:3,4:2)) # 5`

*Documentation reproduced from package lasso2, version 1.2-9, License: GPL version 2 or later*

### Community examples

Looks like there are no examples yet.