Simplex Interface
Ripserer.AbstractSimplex — TypeAbstractSimplex{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
AbstractSimplex{D}(::SVector{<:Any, <:Integer}, ::T)diam(::AbstractSimplex)Base.sign(::AbstractSimplex)Base.:-(::AbstractSimplex)Base.isless(::AbstractSimplex, ::AbstractSimplex)vertices(::AbstractSimplex)coface_type(::AbstractSimplex)coboundary(::Any, ::AbstractSimplex)face_type(::AbstractSimplex)- only required for homology.boundary(::Any, ::AbstractSimplex)- only required for homology.
Ripserer.dim — Methoddim(::AbstractSimplex)
dim(::Type{<:AbstractSimplex})Get the dimension of simplex i.e. the value of D.
dim(Simplex{2}((3, 2, 1), 3.2))
# output
2Ripserer.diam — Methoddiam(simplex::AbstractSimplex)Get the diameter of simplex.
diam(Simplex{2}((3, 2, 1), 3.2))
# output
3.2Base.sign — Methodsign(simplex::AbstractSimplex)Get the orientation of simplex. Returns -1 or 1.
sign(Simplex{2}((3, 2, 1), 3.2))
# output
+1Base.:- — Method-(simplex::AbstractSimplex)Reverse the simplex orientation.
-Simplex{2}((3, 2, 1), 3.2)
# output
2-dim Simplex(1, 1):
-[3, 2, 1]Ripserer.coface_type — Methodcoface_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}Ripserer.face_type — Methodface_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}Ripserer.vertices — Methodvertices(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
Ripserer.coboundary — Methodcoboundary(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]Ripserer.boundary — Methodboundary(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)Ripserer.IndexedSimplex — TypeIndexedSimplex{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
IndexedSimplex{D[, T, I]}(index::I, diam::T)- constructor.IndexedSimplex{D[, T, I]}(vertices::NTuple{D+1, I}, diam::T)- constructor.diam(::AbstractSimplex)coface_type(::AbstractSimplex)index(::IndexedSimplex)
Ripserer.index — Methodindex(vertices)Calculate the index from tuple of vertices. The index is equal to
where $i_k$ are the simplex vertex indices.