edu.stanford.math.plex
public class Chain extends java.lang.Object
Chain
instance is an element of the module constructed by
taking formal sums of ring elements times simplices. In our case the
ring will always be a field, so the module is a vector space where the
basis elements are indexed by simplices. The dimension of the space of
chains is huge, so instead of making vectors of length the dimension of
the space, we use a sparse representation with (sorted) Simplex[] arrays
and corresponding int[] coefficient arrays. Addition and finding the
coefficient of the largest (non-zero) basis element are the most
important in persistence calculations, and this representation is suited
to these operations.
See Persistence, and references therein for the real story.
Persistence
Constructor and Description |
---|
Chain(int modulus) |
Chain(int modulus,
int[] cvec,
Simplex[] elts) |
Chain(int modulus,
int coeff,
Simplex elt) |
Modifier and Type | Method and Description |
---|---|
Chain |
add(Chain x,
int c)
Add one chain to another.
|
protected static int[] |
alternatingCoefficients(int mod,
int len) |
protected static void |
chain_sort(Simplex[] b,
int[] c) |
int |
coefficientOf(Simplex s) |
boolean |
equals(Chain c)
Chain equals implementation.
|
Chain |
filter(java.util.List<Simplex> simplexList) |
Chain |
filter(SimplexTable simplexList)
Filter simplices.
|
int |
HashCode()
Because we override equals, we also need to override HashCode.
|
boolean |
isZero() |
static boolean |
isZero(Chain c) |
int |
maxC()
Return the coefficient of the largetst basis element.
|
Simplex |
maxS()
Return the largest basis element.
|
protected Chain |
mergeBasisElts(Simplex[] first,
int[] fc,
Simplex[] second,
int[] sc,
int c) |
protected static Chain |
normalize(Simplex[] s,
int[] c,
int p) |
int |
rewriteModP(int elt)
Rewrite an element in Z/p from the representation in the interval [0,p) to
the representation in (-p/2,p/2).
|
protected static boolean |
s_and_c_okay(Simplex[] s,
int[] c,
int p) |
java.lang.String |
toString()
Represent a Chain as a String.
|
static Chain |
zero(int modulus) |
public Chain(int modulus, int[] cvec, Simplex[] elts)
public Chain(int modulus)
public Chain(int modulus, int coeff, Simplex elt)
public Simplex maxS()
public int maxC()
public static Chain zero(int modulus)
public static boolean isZero(Chain c)
public boolean isZero()
protected Chain mergeBasisElts(Simplex[] first, int[] fc, Simplex[] second, int[] sc, int c)
public Chain add(Chain x, int c)
x
- the chain to addc
- a coefficient to apply to the argument chain before adding.protected static void chain_sort(Simplex[] b, int[] c)
protected static int[] alternatingCoefficients(int mod, int len)
public int rewriteModP(int elt)
elt
- Elementpublic java.lang.String toString()
toString
in class java.lang.Object
public Chain filter(SimplexTable simplexList)
This function also gets used to replace generated (and thus filtration agnostic) simplices by the singleton instances equipped with the correct filtration index.
simplexList
- The list of simplices onto which the chain is projectedpublic int coefficientOf(Simplex s)
public boolean equals(Chain c)
c
- Chain to comparepublic int HashCode()
protected static boolean s_and_c_okay(Simplex[] s, int[] c, int p)