# tr

From matlib v0.9.2
by Michael Friendly

##### Trace of a Matrix

Calculates the trace of a square numeric matrix, i.e., the sum of its diagonal elements

##### Usage

`tr(X)`

##### Arguments

- X
a numeric matrix

##### Value

a numeric value, the sum of `diag(X)`

##### Examples

```
# NOT RUN {
X <- matrix(1:9, 3, 3)
tr(X)
# }
```

*Documentation reproduced from package matlib, version 0.9.2, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.