Public API
Ripserer
Ripserer.ripserer
— Functionripserer(dists::AbstractMatrix; kwargs...)
ripserer(points; metric=Distances.Euclidean(), births, kwargs...)
ripserer(filtration::AbstractFiltration; kwargs...)
Compute the persistent homology of metric space represented by dists
, points
and metric
or a Ripserer.AbstractFiltration
.
If using points, points
must be an array of bitstypes, such as NTuple
s or SVector
s.
Keyoword Arguments
dim_max
: compute persistent homology up to this dimension. Defaults to1
.modulus
: compute persistent homology with coefficients in the prime field of integers modmodulus
. Defaults to2
.field_type
: use this type of field of coefficients. Defaults toRipserer.Mod
{modulus}
.threshold
: compute persistent homology up to diameter smaller than threshold. For non-sparse Rips filtrations, it defaults to radius of input space.cutoff
: only keep intervals withpersistence(interval) > cutoff
. Defaults to0
.reps
: iftrue
, return representative cocycles along with persistence intervals. Defaults tofalse
.progress
: Iftrue
, show a progress bar. Defaults tofalse
.metric
: when calculating persistent homology from points, any metric fromDistances.jl
can be used. Defaults toDistances.Euclidean()
.cohomology
: if set tofalse
, compute persistent homology instead of cohomology. This is much slower and gives the same result, but may give more informative representatives whenreps
is set totrue
. Currently unable to compute infinite intervals in dimensions higher than 0. Defaults tofalse
.
Ripserer.Rips
— TypeRips{I, T} <: AbstractRipsFiltration{T, Simplex}
This type represents a filtration of Vietoris-Rips complexes. Diagonal items are treated as vertex birth times.
Constructors
Rips(distance_matrix; threshold=default_rips_threshold(dist))
Rips(points; metric=Euclidean(), threshold=default_rips_threshold(dist))
Rips{I}(args...)
:I
sets the size of integer used to represent simplices.
Ripserer.SparseRips
— TypeSparseRips{I, T} <: AbstractRipsFiltration{T, Simplex}
This type represents a filtration of Vietoris-Rips complexes. The distance matrix will be converted to a sparse matrix with all values greater than threshold deleted. Off-diagonal zeros in the matrix are treated as missing
. Diagonal items are treated as vertex birth times.
Constructor
SparseRips{I}(distance_matrix; threshold=nothing)
SparseRips(distance_matrix; threshold=nothing)
:I
sets the integer size used to represent simplices.
Ripserer.Cubical
— TypeCubical{T, N} <: AbstractFiltration{T, <:Cubelet{0, T}}
Cubical
is used to compute sublevel persistent homology on N
-dimensional images, which are of type AbstractArray{T, N}
.
Constructor
Cubical(::AbstractArray{T, N})
Ripserer.Mod
— TypeMod{M} <: Integer
Representation of finite field $\mathbb{Z}_M$, integers modulo small, prime M
. Supports integer arithmetic and can be converted to integer with Int
.
Simplices
Ripserer.Simplex
— TypeSimplex{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):
-Int128[12, 11, 10, 9, 8, 7, 6, 5, 4, 2, 1]
Ripserer.Cubelet
— TypeCubelet{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.
Ripserer.vertices
— Functionvertices(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
vertices(index::I, ::Val{N})
Get the vertices of simplex represented by index. Returns NTuple{N, I}
. For regular simplices, N
should be equal to dim+1
!
Ripserer.dim
— Functiondim(::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
Persistence Diagrams
See also: PersistenceDiagrams.jl API. Ripserer reexports the following:
PersistenceDiagrams.birth
PersistenceDiagrams.death
PersistenceDiagrams.persistence
PersistenceDiagrams.representative
PersistenceDiagrams.birth_simplex
PersistenceDiagrams.death_simplex
PersistenceDiagrams.barcode