trace: Matrix trace

Description Usage Arguments Details Value Note See Also Examples

Description

Sum of the main diagonal elements.

Usage

1
Trace(a)

Arguments

a

a square matrix

Details

Sums the elements of the main diagonal of areal or complrx square matrix.

Value

scalar value

Note

The corresponding function in Matlab/Octave is called trace(), but this in R has a different meaning.

See Also

Diag, diag

Examples

1
Trace(matrix(1:16, nrow=4, ncol=4))


Search within the pracma package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.