tr {lasso2}R Documentation

Trace of a Matrix

Description

Calculates the trace of a matrix

Usage

tr(mat)

Arguments

mat

a square matrix.

Value

The trace of the matrix, i.e. the sum of its diagonal elements, is returned.

Examples

tr(cbind(1,1:3,4:2)) # 5

[Package lasso2 version 1.2-20 Index]