tr: Matrix trace methods.

View source: R/tr.R

trR Documentation

Matrix trace methods.

Description

Methods to efficiently calculate a matrix trace depending on the class of matrix.

Usage

tr(X, ...)

## Default S3 method:
tr(X, ...)

## S3 method for class 'dgCMatrix'
tr(X, ...)

## S3 method for class 'dsCMatrix'
tr(X, ...)

Arguments

X

A matrix.

...

Additional arguments.

Value

A numeric value for the sum of the diagonal elements.

Methods (by class)

  • tr(default): Default method

  • tr(dgCMatrix): Method for matrix X of class Matrix:::dgCMatrix

  • tr(dsCMatrix): Method for matrix X of class Matrix:::dsCMatrix

Author(s)

matthewwolak@gmail.com


matthewwolak/gremlin documentation built on Nov. 12, 2024, 10:56 a.m.