Simplex Interface

Ripserer.AbstractSimplex — Type
AbstractSimplex{D, T, I} <: AbstractVector{I}

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.

The simplex is expected to act like an array of indices of type I, but this is not actually needed for the main algorithm.

Interface

source
Ripserer.dim — Method
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.diam — Method
diam(simplex::AbstractSimplex)

Get the diameter of simplex.

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

# output

3.2
source
Base.sign — Method
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_type — Method
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.face_type — Method
face_type(::AbstractSimplex)
face_type(::Type{<:AbstractSimplex})

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

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

# output

Simplex{1, Float64, Int}
source
Ripserer.vertices — Method
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-element StaticArrays.SArray{Tuple{3},Int64,1,3} with indices SOneTo(3):
 3
 2
 1
source
Ripserer.coboundary — Method
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 = Rips([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

2-dim Simplex(1, 1):
  +[4, 3, 1]
source
Ripserer.boundary — Method
boundary(filtration, simplex[, Val{all_cofaces}])

Iterate over the boundary of simplex. Use the filtration to determine the diameters and validity of cofaces. Iterates values of the type face_type(simplex).

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

for f in boundary(filtration, Simplex{2}(2, 1))
    println(f)
end

# output

Simplex{2}(+[2, 1], 1)
Simplex{2}(-[4, 1], 1)
Simplex{2}(+[4, 2], 1)
source
Ripserer.IndexedSimplex — Type
IndexedSimplex{D, T, I<:Integer} <: AbstractSimplex{D, T, I}

A refinement of AbstractSimplex. An indexed simplex is represented by its dimension, diameter and combinatorial index of type I. It does not need to hold information about 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.index — Method
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