Skip to content

topology · Barcode

13 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.

Worked example

The complete checked program See a one-cycle appear and die in a filtered triangle uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""See a one-cycle appear and die in a filtered triangle."""

from noether.numthy import FiniteField
from noether.topology import FilteredComplex


def main() -> None:
    filtration = FilteredComplex(
        [
            ([0], 0.0),
            ([1], 0.0),
            ([2], 0.0),
            ([0, 1], 1.0),
            ([0, 2], 1.0),
            ([1, 2], 2.0),
            ([0, 1, 2], 3.0),
        ]
    )
    filtration.verify()
    barcode = filtration.persistent_homology(ring=FiniteField.prime(2))
    assert (1, 2.0, 3.0) in barcode
    assert barcode.betti_at(2.5) == [1, 1]
    print(f"barcode: {barcode.bars}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/24_homology_and_persistence.py.

topology.Barcode

Persistent-homology intervals carrying their exact coefficient field.

Barcode(bars: list[tuple[int, float, float | None]], ring: RationalField | FiniteField)

noether::topology::Barcode · Direct Rust declaration

pub struct Barcode<R: Field> { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_persistence_facade.py:11 · validation/unit/topology/test_persistence_facade.py:111 · validation/unit/topology/test_persistence_facade.py:115 · validation/unit/topology/test_persistence_facade.py:122 · validation/unit/topology/test_persistence_facade.py:126 · validation/unit/topology/test_persistence_facade.py:130

topology.Barcode.__getitem__

Return the entry selected by the supplied index.

(self, index: int) -> tuple[int, float, float | None]

noether::topology::Barcode · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

topology.Barcode.__iter__

Iterate over the canonical finite contents of this object.

(self) -> Iterator[tuple[int, float, float | None]]

noether::topology::Barcode · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

topology.Barcode.__len__

Return the number of stored items in this object.

(self) -> int

noether::topology::Barcode · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_filtration_builders.py:109 · validation/unit/topology/test_filtration_builders.py:14

topology.Barcode.bars

Canonically ordered (dimension, birth, death) intervals.

Detailed contract

Canonically ordered (dimension, birth, death) intervals.

(self) -> list[tuple[int, float, float | None]]

noether::topology::Barcode::bars · Direct Rust declaration

pub fn bars(&self) -> &[(usize, f64, Option<f64>)]
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: examples/24_homology_and_persistence.py:25 · validation/unit/topology/test_acceptance_workload.py:34 · validation/unit/topology/test_persistence_facade.py:119

topology.Barcode.betti_at

Betti numbers at one finite filtration value.

(self, value: float) -> list[int]

noether::topology::Barcode::betti_at · Direct Rust declaration

pub fn betti_at(&self, value: f64) -> Result<Vec<usize>, TopologyError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: examples/24_homology_and_persistence.py:24 · validation/unit/topology/test_acceptance_workload.py:36 · validation/unit/topology/test_persistence_facade.py:66 · validation/unit/topology/test_persistence_facade.py:78 · validation/unit/topology/test_persistence_facade.py:79 · validation/unit/topology/test_persistence_facade.py:80

topology.Barcode.bottleneck_distance

Bottleneck distance, with dimensions and coefficient context checked.

Detailed contract

Bottleneck distance to other, respecting homological dimensions. Intervals may match the diagonal but never an interval in another dimension. Different coefficient contexts are rejected: comparing intervals over F_2 with intervals over F_3 would compare answers to different mathematical questions.

(self, other: Barcode) -> float

noether::topology::Barcode::bottleneck_distance · Direct Rust declaration

pub fn bottleneck_distance(&self, other: &Self) -> Result<f64, TopologyError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_acceptance_workload.py:37 · validation/unit/topology/test_persistence_facade.py:117 · validation/unit/topology/test_persistence_facade.py:124 · validation/unit/topology/test_persistence_facade.py:126

topology.Barcode.dimensions

Homological dimensions carrying at least one interval.

Detailed contract

Dimensions carrying at least one interval, in increasing order.

(self) -> list[int]

noether::topology::Barcode::dimensions · Direct Rust declaration

pub fn dimensions(&self) -> Vec<usize>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: examples/34_finite_group_cohomology.py:19 · examples/39_kahler_differentials.py:35 · validation/unit/topology/test_persistence_facade.py:63 · validation/parity/commalg/test_intersection_theory_sage_parity.py:113 · validation/parity/commalg/test_intersection_theory_sage_parity.py:120 · validation/parity/commalg/test_intersection_theory_sage_parity.py:132

topology.Barcode.essential

Essential intervals, whose death is None.

Detailed contract

Essential intervals, whose death is None.

(self) -> list[tuple[int, float, float | None]]

noether::topology::Barcode::essential · Direct Rust declaration

pub fn essential(&self) -> Vec<(usize, f64, Option<f64>)>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_persistence_facade.py:64

topology.Barcode.field

Coefficient field used for this computation.

(self) -> RationalField | FiniteField

noether::topology::Barcode::field · Direct Rust declaration

pub fn field(&self) -> &R
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: examples/08_finite_field_extensions.py:10 · examples/08_finite_field_extensions.py:11 · examples/08_finite_field_extensions.py:12 · examples/08_finite_field_extensions.py:13 · examples/08_finite_field_extensions.py:14 · examples/08_finite_field_extensions.py:3

topology.Barcode.in_dimension

Restrict to one homological dimension.

Detailed contract

Intervals in one homological dimension, retaining the field context.

(self, dimension: int) -> Barcode

noether::topology::Barcode::in_dimension · Direct Rust declaration

pub fn in_dimension(&self, dimension: usize) -> Self
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_persistence_facade.py:119

topology.Barcode.lifetimes

Interval lengths, with None for essential classes.

Detailed contract

Interval lengths, with None for essential classes.

(self) -> list[float | None]

noether::topology::Barcode::lifetimes · Direct Rust declaration

pub fn lifetimes(&self) -> Vec<Option<f64>>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_persistence_facade.py:65

topology.Barcode.wasserstein_distance

Wasserstein distance, with dimensions and coefficient context checked.

Detailed contract

power-Wasserstein distance to other, respecting dimensions. power must be finite and at least one. Costs from separate dimensions are combined by the same L^power norm used within each diagram.

(self, other: Barcode, *, power: float=2.0) -> float

noether::topology::Barcode::wasserstein_distance · Direct Rust declaration

pub fn wasserstein_distance( &self, other: &Self, power: f64, ) -> Result<f64, TopologyError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, geom-core, m4rst, m4rste
GIL attached / bounded
Semantic ID noether/topology/Barcode@1

Executable usage: validation/unit/topology/test_acceptance_workload.py:38 · validation/unit/topology/test_persistence_facade.py:118 · validation/unit/topology/test_persistence_facade.py:128