This function outputs the indices of one triangle (the lower one by default) of an input square matrix. It is used by simMat and, for large matrices, makes it faster than e.g. with lower.tri or upper.tri.
Usage
triMatInd(mat, lower = TRUE, list = FALSE)
Arguments
mat
a square matrix.
lower
logical indicating whether the indices should correspond to the lower triangle. The default is TRUE; FALSE produces the upper triangle indices.
list
logical indicating whether the results should be output as a list instead of a matrix. The default is FALSE.
Value
The indices (row, column) of the elements of the matrix that belong to the requested triangle.