SimplexIndexing

org.appliedtopology.tda4j.SimplexIndexing
See theSimplexIndexing companion object
open class SimplexIndexing(val vertexCount: Int)

Attributes

Companion
object
Experimental
true
Source
SimplexIndexing.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

class CofacetCursor(startIndex: Long, vertices: Array[Int], allCofacets: Boolean)

A cursor over the cofacets of a simplex that allocates nothing per step: read vertex (the added vertex) and index (the cofacet's index) as often as needed, then advance().

A cursor over the cofacets of a simplex that allocates nothing per step: read vertex (the added vertex) and index (the cofacet's index) as often as needed, then advance().

Attributes

Source
SimplexIndexing.scala
Supertypes
class Object
trait Matchable
class Any
class FacetCursor(startIndex: Long, vertices: Array[Int])

A hasNext/vertex/index/advance() cursor over tau's facets, mirroring CofacetCursor above -- vertex is the vertex REMOVED to produce the facet at index. _index is iiB + iA (the OLD iA, before this step's own update), not iiB + iiA -- easy to invert by mistake, so kept exactly. Decodes tau via decodeToArray, not apply(...).toSeq.sorted (a Simplex[Int] decode followed by a redundant re-sort of an already-sorted SortedSet).

A hasNext/vertex/index/advance() cursor over tau's facets, mirroring CofacetCursor above -- vertex is the vertex REMOVED to produce the facet at index. _index is iiB + iA (the OLD iA, before this step's own update), not iiB + iiA -- easy to invert by mistake, so kept exactly. Decodes tau via decodeToArray, not apply(...).toSeq.sorted (a Simplex[Int] decode followed by a redundant re-sort of an already-sorted SortedSet).

Attributes

Source
SimplexIndexing.scala
Supertypes
class Object
trait Matchable
class Any
class SparseCofacetCursor(startIndex: Long, vertices: Array[Int], allCofacets: Boolean, lists: NeighbourLists)

The cofacets of a simplex whose added vertex is a neighbour of every one of its vertices: the same cofacets, in the same order (vertex, and so index, strictly decreasing) and with the same indices as CofacetCursor, but found by intersecting the vertices' neighbour lists instead of trying every vertex. maxDistance is the largest distance from the added vertex to the simplex's vertices, read from the lists; position is the number of the simplex's vertices below the added one.

The cofacets of a simplex whose added vertex is a neighbour of every one of its vertices: the same cofacets, in the same order (vertex, and so index, strictly decreasing) and with the same indices as CofacetCursor, but found by intersecting the vertices' neighbour lists instead of trying every vertex. maxDistance is the largest distance from the added vertex to the simplex's vertices, read from the lists; position is the number of the simplex's vertices below the added one.

Attributes

Source
SimplexIndexing.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

final def apply(n: Long, d: Int, upperAccum: Simplex[Int] = ...): Simplex[Int]

The nth subset of size d of the vertices (a (d-1)-simplex) in the combinatorial number system. For n beyond vertexCount choose d the result is not a subset of size d.

The nth subset of size d of the vertices (a (d-1)-simplex) in the combinatorial number system. For n beyond vertexCount choose d the result is not a subset of size d.

Attributes

Source
SimplexIndexing.scala
def apply(simplex: Simplex[Int]): Long

The index of simplex in the combinatorial number system.

The index of simplex in the combinatorial number system.

Attributes

Source
SimplexIndexing.scala
def cofacetCursor(index: Long, size: Int, allCofacets: Boolean = ...): CofacetCursor

Attributes

Source
SimplexIndexing.scala
def cofacetCursor(index: Long, vertices: Array[Int], allCofacets: Boolean): CofacetCursor

cofacetCursor for a caller that has decoded the simplex already: vertices are the simplex at index, ascending (the cursor reads, never changes, the array).

cofacetCursor for a caller that has decoded the simplex already: vertices are the simplex at index, ascending (the cursor reads, never changes, the array).

Attributes

Source
SimplexIndexing.scala
def cofacetIterator(simplex: Simplex[Int]): Iterator[Long]

Attributes

Source
SimplexIndexing.scala
def cofacetIterator(index: Long, size: Int, allCofacets: Boolean = ...): Iterator[Long]

Attributes

Source
SimplexIndexing.scala
def cofacetIteratorWithVertex(index: Long, size: Int, allCofacets: Boolean = ...): Iterator[(Int, Long)]

Same enumeration as cofacetIterator, but also yields the INSERTED vertex alongside each cofacet index -- needed by a packed (index-only) reduction that has no materialized Simplex[Int] to recover it from afterward ((tau.underlying diff sigma.underlying).head, coboundaryOf's own approach, requires decoding tau). Now a thin Iterator[(Int, Long)] wrapper over CofacetCursor above, kept because cofacetIterator below and SimplexIndexingSpec's own Iterator-based assertions still go through it -- new call sites use cofacetCursor directly.

Same enumeration as cofacetIterator, but also yields the INSERTED vertex alongside each cofacet index -- needed by a packed (index-only) reduction that has no materialized Simplex[Int] to recover it from afterward ((tau.underlying diff sigma.underlying).head, coboundaryOf's own approach, requires decoding tau). Now a thin Iterator[(Int, Long)] wrapper over CofacetCursor above, kept because cofacetIterator below and SimplexIndexingSpec's own Iterator-based assertions still go through it -- new call sites use cofacetCursor directly.

Attributes

Source
SimplexIndexing.scala
def decodeToArray(n0: Long, size: Int): Array[Int]

Same decode as apply(n, size), but returns the vertex set as a plain sorted Array[Int] instead of a Simplex[Int]/SortedSet[Int] -- for callers (PackedRipserCohomologyEngine.sparseCofacets/coboundaryOf/ zeroPivotCofacet) that only ever wanted si(index, size).underlying.toArray and threw the decoded Simplex away immediately afterward. apply's own upperAccum + (id + d) builds the result via size separate persistent-tree insertions (each an O(log size) allocation this throwaway value never needs). This method performs the identical searchRow/binomialEntry arithmetic as apply -- a direct transcription of the same three base cases and recursive step -- but writes each vertex into a pre-sized Array[Int] and sorts once at the end (java.util.Arrays.sort, in-place, zero allocation) instead. Verified against apply directly (same vertex set, for every (index, size) pair the recursion can reach) in SimplexIndexingSpec's property test; apply itself is left unchanged, so any future divergence between the two shows up as a test failure.

Same decode as apply(n, size), but returns the vertex set as a plain sorted Array[Int] instead of a Simplex[Int]/SortedSet[Int] -- for callers (PackedRipserCohomologyEngine.sparseCofacets/coboundaryOf/ zeroPivotCofacet) that only ever wanted si(index, size).underlying.toArray and threw the decoded Simplex away immediately afterward. apply's own upperAccum + (id + d) builds the result via size separate persistent-tree insertions (each an O(log size) allocation this throwaway value never needs). This method performs the identical searchRow/binomialEntry arithmetic as apply -- a direct transcription of the same three base cases and recursive step -- but writes each vertex into a pre-sized Array[Int] and sorts once at the end (java.util.Arrays.sort, in-place, zero allocation) instead. Verified against apply directly (same vertex set, for every (index, size) pair the recursion can reach) in SimplexIndexingSpec's property test; apply itself is left unchanged, so any future divergence between the two shows up as a test failure.

apply's own Simplex[Int]-returning callers are NOT switched to this method: building a SortedSet[Int] from an already-sorted array is not obviously cheaper than apply's own incremental construction (TreeSet has no exposed O(n) bulk-build-from-sorted-input path), so there's no clear win, only a different allocation shape -- left alone rather than "fixed" without a measurement to justify it.

Attributes

Source
SimplexIndexing.scala
def facetCursor(index: Long, size: Int): FacetCursor

Attributes

Source
SimplexIndexing.scala
def facetCursor(index: Long, vertices: Array[Int]): FacetCursor

facetCursor for a caller that has decoded the simplex already: vertices are the simplex at index, ascending (the cursor reads, never changes, the array).

facetCursor for a caller that has decoded the simplex already: vertices are the simplex at index, ascending (the cursor reads, never changes, the array).

Attributes

Source
SimplexIndexing.scala
def facetIterator(index: Long, size: Int): Iterator[Long]

Now a thin Iterator[Long] wrapper over FacetCursor above, kept for SimplexIndexingSpec's own Iterator-based assertions -- new call sites use facetCursor directly.

Now a thin Iterator[Long] wrapper over FacetCursor above, kept for SimplexIndexingSpec's own Iterator-based assertions -- new call sites use facetCursor directly.

Attributes

Source
SimplexIndexing.scala
def sparseCofacetCursor(index: Long, vertices: Array[Int], allCofacets: Boolean, lists: NeighbourLists): SparseCofacetCursor

Attributes

Source
SimplexIndexing.scala
def topCofacetIterator(simplex: Simplex[Int]): Iterator[Long]

Attributes

Source
SimplexIndexing.scala

Concrete fields

val vertexCount: Int

Attributes

Source
SimplexIndexing.scala