prune_zero_tail: Prune tail made of zeros

View source: R/utils.R

prune_zero_tailR Documentation

Prune tail made of zeros

Description

Given a diagonal matrix which is supposed to have no non-zero entry in the diagonal after the first one (if any) the function returns the diagonal (sub-)matrix without the columns and the row corresponding to the zero-entries in the diagonal (if any).

Usage

prune_zero_tail(diag_mat)

Arguments

diag_mat

a diagonal matrix which must satisfy the following property: in the diagonal, every element after a zero is a zero.

Value

a diagonal matrix without zeros in the diagonal, composed by the first rows and columns of the original matrix with non zeros in the diagonal (which are also the only ones)

Examples

diag_mat <- diag(c(1, 2, 3, 0, 0, 0, 0))
prune_zero_tail(diag_mat)

CrossClustering documentation built on May 29, 2024, 9:22 a.m.