示例#1
0
        def hasDifferential(gen_from, gen_to):
            """Determine whether there is a differential between two generators
            of the large chain complex.

            """
            left_from, right_from = gen_from
            left_to, right_to = gen_to
            mult_left_from, mult_left_to = \
                left_from.multiplicity, left_to.multiplicity
            diff = [a-b for a, b in zip(mult_left_from, mult_left_to)]
            if all([n == 0 for n in diff]):
                if left_from == left_to and right_to in right_from.diff():
                    return True
                if right_from == right_to and left_from in left_to.diff():
                    return True
            elif all([n == 0 or n == 1 for n in diff]):
                pos_one = [i for i in range(len(diff)) if diff[i] == 1]
                start, end = pos_one[0], pos_one[-1]+1
                if pos_one == range(start, end):
                    st_move = Strands(self.pmc, [(start, end)])
                    if not st_move.rightCompatible(left_to.getLeftIdem()):
                        return False
                    left_move = StrandDiagram(
                        self.pmc_alg, None, st_move, left_to.getLeftIdem())
                    if not st_move.rightCompatible(right_from.getLeftIdem()):
                        return False
                    right_move = StrandDiagram(
                        self.pmc_alg, None, st_move, right_from.getLeftIdem())
                    return left_move * left_to == 1*left_from and \
                        right_move * right_from == 1*right_to
            else:
                return False
示例#2
0
    def _StrandsFromChords(self, chord1, chord2):
        """Create strand objects from lists of chords. Points in chord2 are
        reversed (refer to the opposite pmc).

        """
        chord1 = [(self.to_s[p], self.to_s[q]) for p, q in chord1]
        chord_small = Strands(self.small_pmc, chord1)
        chord2 = [(p, q) for p, q in chord2]
        chord_large = Strands(self.large_pmc, chord2)
        if self.side == LEFT:
            return (chord_large, chord_small.opp())
        else:
            return (chord_small, chord_large.opp())