Learn R Programming

lava (version 1.4.1)

tr: Trace operator

Description

Calculates the trace of a square matrix.

Usage

tr(A)

Arguments

A
Square numeric matrix

Value

  • numeric

See Also

crossprod, tcrossprod

Examples

Run this code
tr(diag(1:5))

Run the code above in your browser using DataLab