within_diag: Sum of the Diagonal and Off-diagonals

View source: R/GridProcessing.R

within_diagR Documentation

Sum of the Diagonal and Off-diagonals

Description

Returns the sum of all cells on a grid's main diagonal (trace) and on its two off-diagonals.

Usage

within_diag(mat, col = 5)

Arguments

mat

a square matrix.

col

the number of columns of the matrix.

Value

The sum of the matrix's diagonal and two off-diagonals within one cell from the diagonal.


douglaswhitaker/GridItemTools documentation built on Aug. 2, 2022, 4:32 a.m.