chalc.morphisms.types

Augmented persistence modules and 6-packs of persistence modules.

Classes

AugmentedPersistenceModule

An \(\mathbb{R}\)-indexed persistence module of \(\mathbb{N}\)-graded vector spaces.

SixPack

6-pack of persistence modules.

SixPackMorphisms

Natural maps between persistence modules, with one-dimensional int64 support arrays.

SixPackPairings

Birth-death pairings for persistence modules in a 6-pack.

SixPackRepresentatives

Representative cycles for persistence modules, with one-dimensional int64 support arrays.

Module Contents

class AugmentedPersistenceModule(
intervals: collections.abc.Mapping[int, int | None] | None = None,
entrance_times: collections.abc.Sequence[float] | numpy.ndarray[tuple[int], numpy.dtype[numpy.floating]] = (),
degrees: collections.abc.Mapping[int, int] | None = None,
)

An \(\mathbb{R}\)-indexed persistence module of \(\mathbb{N}\)-graded vector spaces.

The module is augmented with (1) a choice of interval basis, where each interval is a pairing between a generator and a relation, (2) a strict linear ordering of the set of all generators and relations, which is compatible with their entrance times.

In particular, each interval is uniquely identified by the integer index of its generator, and distinct integer indices may correspond to elements that have the same entrance time.

__bool__() → bool

Check if the persistence module is non-empty.

__eq__(other: object) → bool

Check if two persistence modules are equal.

__len__() → int

Return the number of features in the module.

property degrees: types.MappingProxyType[int, int]

Return the degrees of interval endpoints.

property entrance_times: numpy.ndarray[tuple[int], numpy.dtype[numpy.float64]]

Return all entrance times of generators/relations in the persistence module.

The entrance times are sorted by generator/relation index.

interval(birth_index: int | numpy.integer) → tuple[float, float]

Return the interval with the given birth index.

intervals(degrees: int | numpy.integer) → numpy.ndarray[tuple[int, Literal[2]], numpy.dtype[numpy.float64]]
intervals(degrees: collections.abc.Sequence[int] | IndexArray | None = ...) → dict[int, numpy.ndarray[tuple[int, Literal[2]], numpy.dtype[numpy.float64]]]

Get the interval decomposition of the persistence module.

Parameters:

degrees – Degrees in which the intervals are desired. If a list is provided then a list of matrices is returned, with the order of matrices respecting the order of entries of degree. If degree is not provided then the returned matrix will contain intervals features from all degrees from zero to max(self.degrees).

Returns:

An \(m \times 2\) matrix whose rows are the endpoints of intervals in the interval decomposition, or a dictionary of such matrices indexed by degree. The rows are sorted by generator index. Degenerate intervals (having zero persistence) are not removed.

nonempty_degrees() → IndexArray

Return all inhabited degrees in the persistence module.

property pairings: types.MappingProxyType[int, int | None]

Get the birth-death pairing indices for this module.

to_hdf5(file: h5py.Group, *, pairings: collections.abc.Mapping[int, int | None] | None = None) → None

Save interval pairings, endpoint entrance times, and interval degrees.

Infinite deaths are stored as -1. Degrees are stored in pairing row order. By default, pairings use this module’s endpoint indices. An enclosing 6-pack can supply its original pairings instead, in the same interval order.

class SixPack(
*,
pairings: SixPackPairings | None = None,
entrance_times: collections.abc.Sequence[float] | numpy.ndarray[tuple[int], numpy.dtype[numpy.floating]] = (),
degrees: collections.abc.Sequence[int] | numpy.ndarray[tuple[int], numpy.dtype[numpy.integer]] = (),
representatives: SixPackRepresentatives | None = None,
morphisms: SixPackMorphisms | None = None,
)

6-pack of persistence modules.

__bool__() → bool

Check whether any persistence module in the 6-pack is non-trivial.

__eq__(other: object) → bool

Check equality of 6-packs.

Checks if all the persistence modules in the 6-packs are equal, with identical interval endpoint metadata.

__iter__() → collections.abc.Iterator[tuple[PersistenceModuleName, AugmentedPersistenceModule]]

Iterate over the persistence modules in the 6-pack.

property codomain: AugmentedPersistenceModule

Codomain persistence module.

property cokernel: AugmentedPersistenceModule

Cokernel persistence module.

property domain: AugmentedPersistenceModule

Domain persistence module.

classmethod from_hdf5(file: h5py.Group) → SixPack

Load modules, raw pairings, and optional representatives and maps.

Consumer metadata is ignored and initialized to None. Malformed datasets raise RuntimeError.

property image: AugmentedPersistenceModule

Image persistence module.

property kernel: AugmentedPersistenceModule

Kernel persistence module.

max_nonempty_degree() → int

Get the maximum degree of all features in all persistence modules in the 6-pack.

Returns -1 if all persistence modules in the 6-pack are trivial.

classmethod module_names() → tuple[PersistenceModuleName, ...]

Return all six persistence module names in iteration order.

property morphisms: SixPackMorphisms | None

Natural morphisms between modules in the 6-pack.

property pairings: SixPackPairings

Birth-death pairings defining the 6-pack.

property relative: AugmentedPersistenceModule

Relative persistence module.

property representatives: SixPackRepresentatives | None

Representative cycles for intervals in the modules in the 6-pack.

to_hdf5(file: h5py.Group) → None

Save modules, raw pairings, and optional representatives and maps.

Each module stores its own endpoint times and interval degrees. Representatives and maps use the same module-local indices as in memory. Consumer metadata is not serialized; consumers may store it separately in the same file or group.

class SixPackMorphisms

Natural maps between persistence modules, with one-dimensional int64 support arrays.

__eq__(other: object) → bool

Compare the sparse support arrays by value.

codomain_to_cokernel: dict[int, IndexArray]

Epimorphism of codomain onto cokernel.

domain_to_codomain: dict[int, IndexArray]

Domain to codomain map.

domain_to_image: dict[int, IndexArray]

Epimorphism of domain onto image.

image_to_codomain: dict[int, IndexArray]

Monomorphism of the image into the codomain.

kernel_to_domain: dict[int, IndexArray]

Monomorphism of kernel into the domain.

class SixPackPairings

Birth-death pairings for persistence modules in a 6-pack.

codomain: dict[int, int | None]

Codomain pairings.

cokernel: dict[int, int | None]

Cokernel pairings.

domain: dict[int, int | None]

Domain pairings.

image: dict[int, int | None]

Image pairings.

kernel: dict[int, int | None]

Kernel pairings.

relative: dict[int, int | None]

Relative pairings.

class SixPackRepresentatives

Representative cycles for persistence modules, with one-dimensional int64 support arrays.

__eq__(other: object) → bool

Compare the sparse support arrays by value.

codomain: dict[int, IndexArray]

Codomain representatives.

cokernel: dict[int, IndexArray]

Cokernel representatives.

domain: dict[int, IndexArray]

Domain representatives.

image: dict[int, IndexArray]

Image representatives.

kernel: dict[int, IndexArray]

Kernel representatives.

relative: dict[int, tuple[IndexArray, IndexArray]]

Relative representatives.

A representative of an interval in the relative diagram of a map \(f: A \to B\) is a pair of chains \((a, b)\) such that \(f(a) = db\).