betti_number: Safely compute the rank of a sparse matrix

View source: R/Betti.R

betti_numberR Documentation

Safely compute the rank of a sparse matrix

Description

This helper function wraps Matrix::rankMatrix() to safely handle empty matrices (i.e., with 0 rows or columns).

Usage

betti_number(simplices, bound_dim, tol = NULL)

Arguments

simplices

A list of simplices representing the simplicial complex.

bound_dim

The dimension of the boundary to compute the Betti number for.

tol

Optional numerical tolerance to pass to rankMatrix().

Value

An integer representing the rank of the matrix.

Examples

simplices <- list(c(1, 2), c(3, 4), c(2, 1, 3), c(4, 2))
betti_number(simplices, 0, tol=0.1)

SimplicialComplex documentation built on Nov. 5, 2025, 7:40 p.m.