rm.discard.zeros {RMThreshold}R Documentation

Discard rows and columns from a matrix that exclusively contain zero-valued off-diagonal matrix elements

Description

The function removes those rows and columns from an input matrix that exclusively contain zero-valued off-diagonal elements.

Usage

 rm.discard.zeros(mat, tol = 0, silent = FALSE)

Arguments

mat

Input matrix (typically after using rm.denoise.mat)

tol

A (small) real number specifying a thresholf for removal of matrix elements (see 'Details').

silent

A logical variable that determines if the number of removed rows and columns is printed by the function or not.

Details

The diagonal of the matrix is not included when counting the zeros in a row/column, i.e. a row/column is actually removed if the diagonal element is the only non-zero element in that row/column. The tolerance tol specifies a threshold. Matrix elements below this threshold will be treated as if they were zero.

Value

A matrix with zero-valued rows/colums removed.

Author(s)

Uwe Menzel <uwemenzel@gmail.com>

See Also

Remove noise from a random matrix by applying a threshold: rm.denoise.mat

Examples


set.seed(777)
random.matrix <- create.rand.mat(size = 1000, distrib = "norm")$rand.matr
dim(random.matrix)

## After identification of a proper threshold:
cleaned.matrix <- rm.denoise.mat(random.matrix, threshold = 3.2, keep.diag = TRUE)	
cl2.matrix = rm.discard.zeros(cleaned.matrix)				
 

[Package RMThreshold version 1.1 Index]