tr: Matrix Trace

View source: R/tr.R

trR Documentation

Matrix Trace

Description

Computes the trace of a square numeric matrix A.

Usage

tr(A)

Arguments

A

Square matrix.

Note

If the argument is not a square numeric matrix, the function presents an error and terminates.

See Also

Other matrix: special.matrix, vec()

Examples

A <- matrix(seq(1, 16, 1), nrow = 4, byrow = TRUE)
A
tr(A)
tr(I(3))

matrixNormal documentation built on Sept. 16, 2022, 5:07 p.m.