Last data update: 2014.03.03

R: Matrix trace
trR Documentation

Matrix trace

Description

Calculates the trace of a matrix

Usage

tr(M)

Arguments

M

a matrix

Value

returns the sum of the diagonal elements

Author(s)

Michael Friendly

Examples

M <- matrix(sample(1:9), 3,3)
tr(M)

Results