matrixcalc (version 1.0-6)

matrix.trace: The trace of a matrix

Description

This function returns the trace of a given square numeric matrix.

Usage

matrix.trace(x)

Value

A numeric value which is the sum of the values on the diagonal.

Arguments

x

a matrix

Author

Frederick Novomestky fnovomes@poly.edu

References

Bellman, R. (1987). Matrix Analysis, Second edition, Classics in Applied Mathematics, Society for Industrial and Applied Mathematics.

Examples

Run this code
A <- matrix( seq( 1, 16, 1 ), nrow=4, byrow=TRUE )
matrix.trace( A )

Run the code above in your browser using DataLab