Skip to content

Commit

Permalink
Cleanup (#58)
Browse files Browse the repository at this point in the history
* export fewer things, docs updates.

* document homology

* update tests
  • Loading branch information
mtsch authored Jun 16, 2020
1 parent 2775cb2 commit 09ca41e
Show file tree
Hide file tree
Showing 17 changed files with 202 additions and 122 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Ripserer"
uuid = "aa79e827-bd0b-42a8-9f10-2b302677a641"
authors = ["mtsch <matijacufar@gmail.com>"]
version = "0.9.0"
version = "0.10.0"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand Down
26 changes: 17 additions & 9 deletions docs/src/api/filtrations.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
# Filtrations
# Filtration Interface

```@docs
AbstractFiltration
Ripserer.AbstractFiltration
```

```@docs
n_vertices(::AbstractFiltration)
Ripserer.n_vertices(::Ripserer.AbstractFiltration)
```

```@docs
edges(::AbstractFiltration)
Ripserer.edges(::Ripserer.AbstractFiltration)
```

```@docs
diam(::AbstractFiltration, ::Any)
Ripserer.diam(::Ripserer.AbstractFiltration, ::Any)
```

```@docs
diam(::AbstractFiltration, ::AbstractSimplex, ::Any, ::Any)
Ripserer.diam(::Ripserer.AbstractFiltration, ::Ripserer.AbstractSimplex, ::Any, ::Any)
```

```@docs
birth(::AbstractFiltration, ::Any)
Ripserer.birth(::Ripserer.AbstractFiltration, ::Any)
```

```@docs
threshold(::AbstractFiltration)
Ripserer.threshold(::Ripserer.AbstractFiltration)
```

```@docs
AbstractFlagFiltration
Ripserer.simplex_type
```

```@docs
Ripserer.AbstractRipsFiltration
```

```@docs
Ripserer.dist
```
60 changes: 59 additions & 1 deletion docs/src/api/ripserer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Ripserer
# Public API

## Ripserer

```@docs
ripserer
Expand All @@ -15,3 +17,59 @@ SparseRips
```@docs
Cubical
```

```@docs
Mod
```

## Simplices

```@docs
Simplex
```

```@docs
Cubelet
```

```@docs
vertices
```

```@docs
dim
```

## Persistence Diagrams

See also: [PersistenceDiagrams.jl
API](https://mtsch.github.io/PersistenceDiagrams.jl/dev/api/diagrams/). Ripserer reexports
the following:

```
PersistenceDiagrams.birth
```

```
PersistenceDiagrams.death
```

```
PersistenceDiagrams.persistence
```

```
PersistenceDiagrams.representative
```

```
PersistenceDiagrams.birth_simplex
```

```
PersistenceDiagrams.death_simplex
```

```
PersistenceDiagrams.barcode
```
34 changes: 13 additions & 21 deletions docs/src/api/simplices.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,49 @@
# Simplices
# Simplex Interface

```@docs
AbstractSimplex
Ripserer.AbstractSimplex
```

```@docs
dim(::AbstractSimplex)
dim(::Ripserer.AbstractSimplex)
```

```@docs
diam(::AbstractSimplex)
diam(::Ripserer.AbstractSimplex)
```

```@docs
Base.sign(::AbstractSimplex)
Base.sign(::Ripserer.AbstractSimplex)
```

```@docs
Base.:-(::AbstractSimplex)
Base.:-(::Ripserer.AbstractSimplex)
```

```@docs
coface_type(::AbstractSimplex)
Ripserer.coface_type(::Ripserer.AbstractSimplex)
```

```@docs
face_type(::AbstractSimplex)
Ripserer.face_type(::Ripserer.AbstractSimplex)
```

```@docs
vertices(::AbstractSimplex)
vertices(::Ripserer.AbstractSimplex)
```

```@docs
coboundary(::Any, ::AbstractSimplex)
Ripserer.coboundary(::Any, ::Ripserer.AbstractSimplex)
```

```@docs
boundary(::Any, ::AbstractSimplex)
Ripserer.boundary(::Any, ::Ripserer.AbstractSimplex)
```

```@docs
IndexedSimplex
Ripserer.IndexedSimplex
```

```@docs
index(::AbstractSimplex)
```

```@docs
Simplex
```

```@docs
Cubelet
Ripserer.index(::Ripserer.AbstractSimplex)
```
9 changes: 4 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ benchmarking on my computer or a CI system to be too unreliable.

## Extending

Ripserer is designed to be easily extended with new simplex or filtration types. The
interfaces are specified in the docstrings for `AbstractSimplex` and
`AbstractFiltration`. Also see the [Filtrations](@ref) and [Simplices](@ref) API sections
for more info. To see an example of an extension, check out the implementation of cubical
simplices and filtrations in
Ripserer is designed to be easily extended with new simplex or filtration types. See the
[Filtration Interface](@ref) and [Simplex Interface](@ref) API sections for more info. To
see an example of an extension, check out the implementation of cubical simplices and
filtrations in
[`src/cubical.jl`](https://github.com/mtsch/Ripserer.jl/blob/master/src/cubical.j).

If you have written an extension or have trouble implementing one, please open a pull
Expand Down
12 changes: 3 additions & 9 deletions src/Ripserer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,12 @@ using TupleTools
# reexporting basics these makes Ripserer usable without having to import another package.
import PersistenceDiagrams: birth, threshold
export
PersistenceDiagram, PersistenceInterval, RepresentativeInterval,
birth, death, persistence, representative, birth_simplex, death_simplex, barcode

export
Mod,
AbstractSimplex, diam, coface_type, face_type, vertices, coboundary, boundary, dim,
IndexedSimplex, index, Simplex,
AbstractFiltration, n_vertices, edges, threshold,
AbstractFlagFiltration, Rips, SparseRips,
Cubelet, Cubical,
simplex, coefficient,
ripserer
Mod, Simplex, Cubelet, vertices, diam, dim, threshold, simplex, coefficient,
Rips, SparseRips, Cubical, ripserer


include("primefield.jl")

Expand Down
29 changes: 15 additions & 14 deletions src/abstractfiltration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
A filtration is used to find the edges in filtration and to determine diameters of
simplices.
`T` is the distance type, accessible by `dist_type` and S is the edge type, accesible by
`vertex_type`.
`T` is the distance type, accessible by `dist_type` and `S` is the simplex type.
# Interface
* [`n_vertices(::AbstractFiltration)`](@ref)
* [`edges(::AbstractFiltration)`](@ref)
* [`diam(::AbstractFiltration, vertices)`](@ref)
* [`diam(::AbstractFiltration, ::AbstractSimplex, ::Any, ::Any)`](@ref) - only used for
`Simplex`.
* [`diam(::AbstractFiltration, ::AbstractSimplex, ::Any, ::Any)`](@ref) - only used when
[`simplex_type`](@ref) is an [`IndexedSimplex`](@ref).
* [`birth(::AbstractFiltration, v)`](@ref) - optional, defaults to returning `zero(T)`.
* [`threshold(::AbstractFiltration)`](@ref) - optional, defaults to returning `missing`.
* [`simplex_type(::AbstractFiltration, dim)`](@ref)
Expand All @@ -25,9 +24,9 @@ function Base.show(io::IO, flt::AbstractFiltration)
end

"""
simplex_type(::AbstractFiltration, dim)
simplex_type(::AbstractFiltration, d)
Return the `dim`-dimensional simplex in the filtration.
Return the `d`-dimensional simplex type in the filtration.
"""
simplex_type(::AbstractFiltration, dim)

Expand All @@ -46,30 +45,32 @@ n_vertices(::AbstractFiltration)
edges(filtration::AbstractFiltration)
Get edges in distance matrix in `filtration`, sorted by decresing length and increasing
combinatorial index. Edges should be of type `edge_type(filtration)`.
combinatorial index. Edges should be of type [`simplex_type`](@ref)(filtration, 1)`.
"""
edges(::AbstractFiltration)

"""
diam(flt::AbstractFiltration, vertices)
diam(::AbstractFiltration, vertices)
Get the diameter of list of vertices i.e. diameter of simplex with `vertices`. Retrun
`missing` if `vertices` do not form a valid simplex.
Get the diameter of a simplex with the vertex set `vertices`. Should return `missing` if
`vertices` do not form a valid simplex.
"""
diam(::AbstractFiltration, ::Any)

"""
diam(flt::AbstractFiltration, simplex, vertices, vertex)
diam(::AbstractFiltration, simplex, vertices, new_vertex)
Get the diameter of coface of a `Simplex` that is formed by adding `vertex` to `vertices`.
Return `missing` if new simplex is not valid.
Get the diameter of coface of a `Simplex` that is formed by adding `new_vertex` to
`vertices`. Should return `missing` if new simplex is not valid.
This functions is used with the [`coboundary`](@ref) function for [`IndexedSimplex`](@ref)
"""
diam(::AbstractFiltration, ::AbstractSimplex, ::Any, ::Any)

"""
birth(::AbstractFiltration, v)
Get the birth time of vertex `v`.
Get the birth time of vertex `v` in filtration. Defaults to 0.
"""
birth(::AbstractFiltration{T}, _) where T = zero(T)

Expand Down
Loading

2 comments on commit 09ca41e

@mtsch
Copy link
Owner Author

@mtsch mtsch commented on 09ca41e Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/16454

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.0 -m "<description of version>" 09ca41e920aa2bca6a56495a5b847edba2d894b8
git push origin v0.10.0

Please sign in to comment.