tr: Sum of the diagonal elements of a square matrix

Description Usage Arguments Value Examples

Description

Sum of the diagonal elements of a square matrix

Usage

1
tr(x)

Arguments

x

A square matrix

Value

Sum of the diagonal elements of a square matrix.

Examples

1
2
x <- matrix(c(1:9), 3, 3)
tr(x)

onoshima/miscfunr documentation built on Dec. 22, 2021, 4:24 a.m.