Simplices

Ripserer.AbstractSimplexType
AbstractSimplex{D, T}

An abstract type for representing simplices. A simplex must have a diameter of type T, which is its birth time. The dimension must be encoded in the type as D and can be accessed by dim.

Interface

source
Ripserer.dimMethod
dim(::AbstractSimplex)
dim(::Type{<:AbstractSimplex})

Get the dimension of simplex i.e. the value of D.

dim(Simplex{2}((3, 2, 1), 3.2))

# output

2
source
Ripserer.diamMethod
diam(simplex::AbstractSimplex)

Get the diameter of simplex.

diam(Simplex{2}((3, 2, 1), 3.2))

# output

3.2
source
Base.signMethod
sign(simplex::AbstractSimplex)

Get the orientation of simplex. Returns -1 or 1.

sign(Simplex{2}((3, 2, 1), 3.2))

# output

+1
source
Base.:-Method
-(simplex::AbstractSimplex)

Reverse the simplex orientation.

-Simplex{2}((3, 2, 1), 3.2)

# output

2-dim Simplex(1, 1):
  -(3, 2, 1)
source
Ripserer.coface_typeMethod
coface_type(::AbstractSimplex)
coface_type(::Type{<:AbstractSimplex})

Get the type of simplex's coface. For a D-dimensional simplex, this is usually its D+1-dimensional counterpart. Only the method for the type needs to be implemented.

coface_type(Simplex{2}((3, 2, 1), 3.2))

# output

Simplex{3, Float64, Int}
source
Ripserer.verticesMethod
vertices(simplex::AbstractSimplex{dim})

Get the vertices of simplex. Returns NTuple{dim+1, Int}. In the algorithm, only the method for 2-simplices is actually used.

vertices(Simplex{2}((3, 2, 1), 3.2))

# output

(3, 2, 1)
source
Ripserer.coboundaryMethod
coboundary(filtration, simplex[, Val{all_cofaces}])

Iterate over the coboundary of simplex. Use the filtration to determine the diameters and validity of cofaces. Iterates values of the type coface_type(simplex). If all_cofaces is false, only return cofaces with vertices added to the beginning of vertex list.

filtration = RipsFiltration([0 1 1 1; 1 0 1 1; 1 1 0 1; 1 1 1 0])

for c in coboundary(filtration, Simplex{1}(2, 1))
    println(c)
end

# output

Simplex{2}(+(4, 3, 1), 1)
Simplex{2}(-(3, 2, 1), 1)
for c in coboundary(filtration, Simplex{1}(2, 1), Val(false))
    println(c)
end

# output

Simplex{2}(+(4, 3, 1), 1)
source
Ripserer.IndexedSimplexType
IndexedSimplex{D, T, I<:Integer} <: AbstractSimplex{D, T}

A refinement of AbstractSimplex. An indexed simplex is represented by its dimension, diameter and combinatorial index. It does not need to hold information about its the vertices it includes, since they can be recomputed from the index and dimension.

By defining the index, a default implementation of sign, isless, vertices and coboundary is provided.

Interface

source
Ripserer.indexMethod
index(vertices)

Calculate the index from tuple of vertices. The index is equal to

\[(i_d, i_{d-1}, ..., 1) \mapsto \sum_{k=1}^{d+1} \binom{i_k - 1}{k},\]

where $i_k$ are the simplex vertex indices.

source
Ripserer.SimplexType
Simplex{D, T, I} <: IndexedSimplex{D, T, I}

The vanilla simplex type represented by dimension D and index of type I and a diameter of type T.

Constructor

Simplex{D[, T, I]}(::I, ::T)

Examples

Simplex{2}(2, 1)

# output

2-dim Simplex{2}(2, 1):
  +(4, 2, 1)
Simplex{10}(Int128(-10), 1.0)

# output

4-dim Simplex{3}(1.0, 10, 2) with UInt128 index:
  -(12, 11, 10, 9, 8, 7, 6, 5, 4, 2, 1)
source
Ripserer.CubeletType
Cubelet{D, T, I} <: IndexedSimplex{D, T, I}

A Cubelet is similar to a Simplex, but it has 2^D vertices instead of D+1. Like in Simplex, the vertices are encoded from an index and dimension. Because a cubelet knows nothing about the image it came from, it returns linear indices from vertices.

The vertices should be neighboring indices, but this fact is not checked anywhere.

source