Learn R Programming

JPEN (version 1.0)

tr: Trace of matrix

Description

Returns the trace of a matrix

Usage

tr(A)

Arguments

A
A is the input matrix.

Value

Trace of input matrix.

Details

Returns the trace (sum of diagonal elements )of input matrix).

References

A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf

Examples

Run this code
p=10;n=100;Sig=diag(p);
y=rmvnorm(n,mean=rep(0,p),sigma=Sig);
S=var(y);
tr(S);

Run the code above in your browser using DataLab