Learn R Programming

GraphAlignment (version 1.36.0)

Trace: Calculate trace of a matrix

Description

Calculate the trace of a square matrix.

Usage

Trace(m)

Arguments

m
square matrix

Details

The return value is the trace of the input matrix.

Examples

Run this code
  m <- matrix(c(1, 0, 0, 1), 2, 2)
  Trace(m)

Run the code above in your browser using DataLab