tr {OpenMx}R Documentation

trace

Description

This function returns the trace of an n-by-n square matrix x, defined to be the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right).

Usage

tr(x)

Arguments

x

an input matrix. Must be square

Details

The input matrix must be square.

See Also

vech, rvectorize, cvectorize

Examples


tr(matrix(1:9, 3, 3))
tr(matrix(1:12, 3, 4))



[Package OpenMx version 2.2.6 Index]