This function checks whether each row of a sparse matrix sums to 1,
within a specified numeric tolerance. This is useful for confirming
that a matrix is suitable for diffusion or spillover operations.
Usage
is_row_normalized(W, tolerance = 1e-06, verbose = TRUE)
Arguments
- W
A sparse matrix of class `dgCMatrix`.
- tolerance
Numeric. Acceptable deviation from 1 for each row sum (default = 1e-6).
- verbose
Logical. If TRUE, prints the number of rows failing the check.
Value
Logical. TRUE if all rows sum to 1 within the specified tolerance, FALSE otherwise.
Examples
if (FALSE) { # \dontrun{
is_row_normalized(W)
} # }