tr function

Trace of a matrix.

Trace of a matrix.

Compute the trace of a square matrix.

tr(X)

Arguments

  • X: Numeric: A square matrix.

Details

This computes the sum of the diagonal elements of a square matrix.

Returns

  • numeric: A real number.

Author(s)

Cedric E. Ginestet cedric.ginestet@kcl.ac.uk