appliedtopology/javaplex

Retrieving to many basis elements for homology

PeterLeChuck opened this issue · 2 comments

The following program should return no 1-dim basis elements of homology. It works for cohomology.

public static void main(String[] args) {
    int prime=2;
    int d = 2;

    ExplicitSimplexStream stream = new ExplicitSimplexStream();
    stream.addVertex(0);
    stream.addVertex(1);
    stream.addVertex(2);
    int[][] edges = {{0,1},{1,2},{0,2}};
    for(int i = 0; i != edges.length; ++i){
        stream.addElement(edges[i]);
    }
    stream.addElement(new int[]{0,1,2});
    stream.finalizeStream();

    AbstractPersistenceBasisAlgorithm<Simplex, int[]> simplex_annotated_algorithm = new IntAbsoluteHomology(ModularIntField.getInstance(prime), Collections.reverseOrder(SimplexComparator.getInstance()), 0, d+1);
    AnnotatedBarcodeCollection<Double, int[]> annotated_intervals = simplex_annotated_algorithm.computeAnnotatedIntervals(stream);
    System.out.println("Homology basis for " + d + "-ball:");
    System.out.println(annotated_intervals);
}

Output:
Homology basis for 2-ball:
Dimension: 0
[0.0, infinity): [2]
Dimension: 1
[0.0, infinity): [1,2] + [0,2] + [0,1]

Why are you reversing the simplex comparator order? I'd expect this to compute some sort of relative homology the way it's setup. (see http://iopscience.iop.org/article/10.1088/0266-5611/27/12/124003/meta for why)

No reaction after feedback. Closing.