Learn R Programming

KMDA (version 1.0)

tr: Trace of A Matrix

Description

This function calculates the trace of a given numeric square matrix. This function should not be called directly in this package. It is called by other functions like dscore and sscore.

Usage

tr(X)

Arguments

X
A square matrix

Value

  • A numeric value which is the sum of the values on the diagnonal.

See Also

dscore, sscore

Examples

Run this code
A=matrix(seq(1:9),nrow=3,ncol=3)
	tr(A)

Run the code above in your browser using DataLab