tr function

Trace of a Matrix

Trace of a Matrix

Takes the traces of a matrix by extracting the diagonal entries and then summing over.

tr(x)

Arguments

  • x: Square matrix (QxQQ x Q)

Returns

Returns a single-value double.

Examples

# Identity Matrix of size 4, gives trace of 4. tr(diag(4))

See Also

logdet, fillout

  • Maintainer: James Balamuta
  • License: MIT + file LICENSE
  • Last published: 2020-10-31