Skip to contents

Calculates and returns the trace of a square matrix.

Usage

tr(x)

Arguments

x

A matrix that is square e.g. \(N \times N\)

Value

A matrix with circles imprinted within its dimensions.

Author

James Balamuta

Examples

# I_2 matrix
tr(diag(2))
#> [1] 2