FilteredSimplicialSetStream

org.appliedtopology.tda4j.streams.FilteredSimplicialSetStream
See theFilteredSimplicialSetStream companion object
class FilteredSimplicialSetStream[G](sset: FiniteSimplicialSet[G], val filtrationValue: PartialFunction[G, Double])(using x$3: is[G, OrderedCell]) extends StratifiedCellStream[G, Double]

A FiniteSimplicialSet with a real, caller-supplied filtration -- unlike SimplicialSetStream (every generator at filtration 0, ordinary homology only), this is a genuine StratifiedCellStream[G, Double], so it plugs into CellularPersistenceInChunksContext/PersistenceInChunksContext as well as CellularHomologyContext. filtrationValue is defined only on generators (never on arbitrary, possibly degenerate SSetElements) -- correct because every engine here only ever queries a stream's filtrationValue on the actual CellT values it iterates, and SimplicialSetStream/this class both only ever iterate generators, never degenerate elements (finiteSimplicialSetIsOrderedCell.boundary resolves degeneracy internally via faces, without the engine ever seeing an SSetElement directly).

iterateDimension sorts each dimension's bucket by filtrationOrdering.reverse -- oldest first, the SAME Ordering object reversed, not an independently-built comparator -- matching the established convention this codebase has broken and fixed three separate times when two independently-tie-broken orders disagreed (see CLAUDE.md). Positional index within PersistenceInChunksContext's allCells (built by dimension-major concatenation of iterateDimension's buckets) stands in for chunk-boundary/local-reduction "how old is this cell" logic, so a bucket sorted any other way corrupts chunking even though it would still look like a valid total order in isolation -- FilteredSimplicialSetStreamSpec asserts this directly rather than only checking the resulting barcode.

Attributes

Companion
object
Experimental
true
Graph
Supertypes
trait StratifiedCellStream[G, Double]
trait CellStream[G, Double]
trait IterableOnce[G]
trait Filtration[G, Double]
trait Filterable[Double]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def iterateDimension: PartialFunction[Int, Iterator[G]]

Contract .iterator below relies on: the domain must be contiguous starting at 0 -- defined for 0, 1, ..., k for some k (or empty, or all of the non-negative integers), never with a gap. .iterator stops at the first dimension this is undefined for, so a non-contiguous domain (defined at d but not at d - 1) would silently truncate iteration instead of skipping the gap. Every implementation in this codebase already satisfies this (a simplicial complex can't have a d-simplex without its (d-1)-dimensional faces, so "no cells at d" implies "no cells at any dimension beyond d" too); a new implementation must preserve it.

Contract .iterator below relies on: the domain must be contiguous starting at 0 -- defined for 0, 1, ..., k for some k (or empty, or all of the non-negative integers), never with a gap. .iterator stops at the first dimension this is undefined for, so a non-contiguous domain (defined at d but not at d - 1) would silently truncate iteration instead of skipping the gap. Every implementation in this codebase already satisfies this (a simplicial complex can't have a d-simplex without its (d-1)-dimensional faces, so "no cells at d" implies "no cells at any dimension beyond d" too); a new implementation must preserve it.

Attributes

Definition Classes

Inherited methods

override def iterator: Iterator[G]

Dimension-major: all of dimension d before any of dimension d + 1.

Dimension-major: all of dimension d before any of dimension d + 1.

MUST NOT be implemented as Iterator.from(0).filter(iterateDimension.isDefinedAt)....fold(...) (a real, confirmed bug this replaced -- see .claude/WORKLOG-cohomology.md): Iterator.filter on an infinite source can never prove "no more matches ahead", so once past the last dimension iterateDimension is defined for, it spins forever searching for a d that will never come -- and Int silently wrapping from Int.MaxValue to Int.MinValue after ~2^31 iterations can eventually feed a huge negative d straight to iterateDimension instead, surfacing as a BinomialCoefficient range exception rather than a hang. .takeWhile instead stops at the first d this is undefined for and never asks about any d beyond it, relying on exactly the contiguous-domain contract documented on iterateDimension above.

Attributes

Definition Classes
StratifiedCellStream -> IterableOnce
Inherited from:
StratifiedCellStream
def knownSize: Int

The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

Attributes

Inherited from:
IterableOnce
def stepper[S <: Stepper[_]](implicit shape: StepperShape[G, S]): S

Returns a scala.collection.Stepper for the elements of this collection.

Returns a scala.collection.Stepper for the elements of this collection.

The Stepper enables creating a Java stream to operate on the collection, see scala.jdk.StreamConverters. For collections holding primitive values, the Stepper can be used as an iterator which doesn't box the elements.

The implicit scala.collection.StepperShape parameter defines the resulting Stepper type according to the element type of this collection.

  • For collections of Int, Short, Byte or Char, an scala.collection.IntStepper is returned
  • For collections of Double or Float, a scala.collection.DoubleStepper is returned
  • For collections of Long a scala.collection.LongStepper is returned
  • For any other element type, an scala.collection.AnyStepper is returned

Note that this method is overridden in subclasses and the return type is refined to S with EfficientSplit, for example scala.collection.IndexedSeqOps.stepper. For Steppers marked with scala.collection.Stepper.EfficientSplit, the converters in scala.jdk.StreamConverters allow creating parallel streams, whereas bare Steppers can be converted only to sequential streams.

Type parameters

S

the type of the returned Stepper, determined by the implicit StepperShape

Attributes

Inherited from:
IterableOnce

Concrete fields

override val filtrationOrdering: Ordering[G]
val filtrationValue: PartialFunction[G, Double]

Exports

Defined exports

def largest: Double
Exported from Filterable
def smallest: Double
Exported from Filterable