Learn R Programming

SPA3G (version 1.0)

TRACE:

Returns trace of a square matrix

Description

TRACE calculates the trace of a square matrix and returns a scale value.

Usage

TRACE(M)

Arguments

M
Square matrix

Examples

Run this code

## The function is currently defined as
function (M) 
{
    return(sum(diag(M)))
  }

Run the code above in your browser using DataLab