PackedChain

org.appliedtopology.tda4j.PackedChain
final class PackedChain[CellT, CoefficientT](val keys: Array[Int], val coefficients: Array[AnyRef], val decoder: CellDecoder[CellT])(order: Ordering[CellT], field: is[CoefficientT, Field]) extends Chain[CellT, CoefficientT]

A chain stored packed, as the grid engines store representatives: keys(i) is a cell's key, which decoder turns into the cell, and coefficients(i) its coefficient. The keys are distinct and their cells ascending under the chain's order; every coefficient is nonzero. Nothing else is stored: reading the chain decodes its cells afresh (nothing is cached, so reading it does not make it bigger), and arithmetic on it gives a heap chain. The decoder and the order are kept by every chain they serve, so they must hold only what they need, never an engine.

Attributes

Experimental
true
Source
Chain.scala
Graph
Supertypes
class Chain[CellT, CoefficientT]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def entryIterator: Iterator[(CellT, CoefficientT)]

The stored entries: a cell can appear more than once (arithmetic may be deferred), or with a zero total. The one member a storage must implement.

The stored entries: a cell can appear more than once (arithmetic may be deferred), or with a zero total. The one member a storage must implement.

Attributes

Definition Classes
Source
Chain.scala
override def isZero(): Boolean

Attributes

Definition Classes
Source
Chain.scala
override def leadingTerm: (Option[CellT], CoefficientT)

The leading term: the least cell and its coefficient, (None, zero) for the zero chain.

The leading term: the least cell and its coefficient, (None, zero) for the zero chain.

Attributes

Definition Classes
Source
Chain.scala
override def rawEntries: Seq[(CellT, CoefficientT)]

The stored entries without collapsing: arithmetic is deferred, so a cell can appear more than once (a + a as two (a, 1) pairs) or with a zero total. Cheap; use terms for one coefficient per cell.

The stored entries without collapsing: arithmetic is deferred, so a cell can appear more than once (a + a as two (a, 1) pairs) or with a zero total. Cheap; use terms for one coefficient per cell.

Attributes

Definition Classes
Source
Chain.scala
override def terms: Seq[(CellT, CoefficientT)]

The terms of the chain: each cell with its (nonzero) coefficient, once, in cell order.

The terms of the chain: each cell with its (nonzero) coefficient, once, in cell order.

Attributes

Definition Classes
Source
Chain.scala

Inherited methods

final def cellOrdering: Ordering[CellT]

The order the chain is kept in: its leading term is the least cell under it.

The order the chain is kept in: its leading term is the least cell under it.

Attributes

Inherited from:
Chain
Source
Chain.scala
def cells: Seq[CellT]

The cells with a nonzero coefficient, in cell order.

The cells with a nonzero coefficient, in cell order.

Attributes

Inherited from:
Chain
Source
Chain.scala
final def coefficientField: is[CoefficientT, Field]

The field of the coefficients.

The field of the coefficients.

Attributes

Inherited from:
Chain
Source
Chain.scala
def collapseAll()(using fr: is[CoefficientT, Field]): Unit

Merges the stored entries of every cell and drops the zero ones. Nothing to do by default (see collapseHead).

Merges the stored entries of every cell and drops the zero ones. Nothing to do by default (see collapseHead).

Attributes

Inherited from:
Chain
Source
Chain.scala
def collapseHead(): Unit

Merges the stored entries of the least cell, dropping it if they sum to zero. Nothing to do by default, since the default terms merges as it reads; a storage that keeps merged state (the heap) overrides it.

Merges the stored entries of the least cell, dropping it if they sum to zero. Nothing to do by default, since the default terms merges as it reads; a storage that keeps merged state (the heap) overrides it.

Attributes

Inherited from:
Chain
Source
Chain.scala
override def equals(obj: Any): Boolean

Equality as formal sums: every cell has the same coefficient in both, by the field's own equality (a field element can have several representations), whatever the order or the storage. Collapses both. Assumes obj has the same cell and coefficient types (only Chain is checked at runtime). Consistent with hashCode.

Equality as formal sums: every cell has the same coefficient in both, by the field's own equality (a field element can have several representations), whatever the order or the storage. Collapses both. Assumes obj has the same cell and coefficient types (only Chain is checked at runtime). Consistent with hashCode.

Attributes

Definition Classes
Chain -> Any
Inherited from:
Chain
Source
Chain.scala
override def hashCode: Int

Consistent with equals, so chains can be keys of a hash set or map: it hashes each cell with a nonzero coefficient together with the field's Field.hash of that coefficient, blind to the order and the storage. Collapses the chain, as equals does. Over a field that compares within a tolerance (Field.DoubleApproximated) only the cells are hashed; a field of your own that keeps the default Field.hash is hashed by its cells too.

Consistent with equals, so chains can be keys of a hash set or map: it hashes each cell with a nonzero coefficient together with the field's Field.hash of that coefficient, blind to the order and the storage. Collapses the chain, as equals does. Over a field that compares within a tolerance (Field.DoubleApproximated) only the cells are hashed; a field of your own that keeps the default Field.hash is hashed by its cells too.

Attributes

Definition Classes
Chain -> Any
Inherited from:
Chain
Source
Chain.scala
final def isPacked: Boolean

Whether the terms are stored packed (a PackedChain: decoded when read).

Whether the terms are stored packed (a PackedChain: decoded when read).

Attributes

Inherited from:
Chain
Source
Chain.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Chain -> Any
Inherited from:
Chain
Source
Chain.scala

Concrete fields

val coefficients: Array[AnyRef]

Attributes

Source
Chain.scala
val decoder: CellDecoder[CellT]

Attributes

Source
Chain.scala
val keys: Array[Int]

Attributes

Source
Chain.scala