Learn R Programming

TDAvec (version 0.1.41)

computeTropicalCoordinates: Compute Tropical Coordinates from a Persistence Diagram

Description

For a given persistence diagram \(D=\{(b_i,d_i)\}_{i=1}^N\) (corresponding to a specified homological dimension), computeTropicalCoordinates() computes the following seven tropical coordinates based on the lifespans (or persistence) \(\lambda_i = d_i - b_i\):

  • \(F_1 = \max_i \lambda_i\).

  • \(F_2 = \max_{i<j} (\lambda_i+\lambda_j)\).

  • \(F_3 = \max_{i<j<k} (\lambda_i+\lambda_j+\lambda_k)\).

  • \(F_4 = \max_{i<j<k<l} (\lambda_i+\lambda_j+\lambda_k+\lambda_l)\).

  • \(F_5 = \sum_i \lambda_i\).

  • \(F_6 = \sum_i \min(r \lambda_i, b_i)\), where \(r\) is a positive integer.

  • \(F_7 = \sum_j \big(\max_i(\min(r \lambda_i, b_i)+\lambda_i) - (\min(r \lambda_j, b_j)+\lambda_j)\big)\).

Points in \(D\) with infinite death values are ignored.

Usage

computeTropicalCoordinates(D, homDim, r = 1)

Value

A (named) numeric vector \((F_1, F_2, F_3, F_4, F_5, F_6, F_7)\).

Arguments

D

a persistence diagram: a matrix with three columns containing the homological dimension, birth and death values respectively.

homDim

the homological dimension (0 for \(H_0\), 1 for \(H_1\), etc.). Rows in D are filtered based on this value.

r

a positive integer used to compute \(F_6\) and \(F_7\). Default is 1.

Author

Umar Islambekov

Details

The function extracts rows from D where the first column equals homDim, and computes the seven tropical coordinates based on the filtered data. If D does not contain any points corresponding to homDim, a vector of zeros is returned.

References

1. Kališnik, S., (2019). Tropical coordinates on the space of persistence barcodes. Foundations of Computational Mathematics, 19(1), pp.101-129.

2. Ali, D., Asaad, A., Jimenez, M.J., Nanda, V., Paluzo-Hidalgo, E. and Soriano-Trigueros, M., (2023). A survey of vectorization methods in topological data analysis. IEEE Transactions on Pattern Analysis and Machine Intelligence.

Examples

Run this code
N <- 100 # The number of points to sample

set.seed(123) # Set a random seed for reproducibility

# Sample N points uniformly from the unit circle and add Gaussian noise
theta <- runif(N, min = 0, max = 2 * pi)
X <- cbind(cos(theta), sin(theta)) + rnorm(2 * N, mean = 0, sd = 0.2)

# Compute the persistence diagram using the Rips filtration built on top of X
# The 'threshold' parameter specifies the maximum distance for building simplices
D <- TDAstats::calculate_homology(X, threshold = 2)

# Compute tropical coordinates for homological dimension H_0
computeTropicalCoordinates(D, homDim = 0)

# Compute tropical coordinates for homological dimension H_1
computeTropicalCoordinates(D, homDim = 1)

Run the code above in your browser using DataLab