# tr

From lasso2 v1.2-0
by Martin Maechler

##### 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-0, License: GPL version 2 or later*

### Community examples

Looks like there are no examples yet.