rm.discard.zeros: Discard rows and columns from a matrix that exclusively...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
 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

1
2
3
4
5
6
7
8
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)				
 

RMThreshold documentation built on May 2, 2019, 8:51 a.m.