Exemplo n.º 1
0
    def restrictToMultA(self, start, end):
        """Restrict actions to those with multiplicity in the interval
        (start, end). Here start and end specify points on the PMC. For example,
        start, end = 0, pmc.n-1 will not change the action. Returns the new type
        DA structure without changing the original structure.

        """
        translate_dict = dict()
        dastr = SimpleDAStructure(F2, self.algebra1, self.algebra2,
                                  self.side1, self.side2)
        for gen in self.generators:
            translate_dict[gen] = SimpleDAGenerator(
                dastr, gen.idem1, gen.idem2, gen.name)
            dastr.addGenerator(translate_dict[gen])

        mult_len = self.algebra1.pmc.n - 1
        for (gen_from, coeffs_a), target in self.da_action.items():
            total_mult = sumColumns([coeff.multiplicity for coeff in coeffs_a],
                                    mult_len)
            if all([total_mult[i] <= 0
                    for i in range(0, start) + range(end, mult_len)]):
                for (coeff_d, gen_to), ring_coeff in target.items():
                    dastr.addDelta(translate_dict[gen_from],
                                   translate_dict[gen_to],
                                   coeff_d, coeffs_a, ring_coeff)
        return dastr
Exemplo n.º 2
0
 def toStrWithMultA(self, mult_a):
     """Print all arrows with the given multiplicities on the D side."""
     result = "Type DA Structure.\n"
     for (gen_from, coeffs_a), target in self.da_action.items():
         total_mult = sumColumns([coeff.multiplicity for coeff in coeffs_a],
                                 len(mult_a))
         if mult_a == total_mult:
             result += "m(%s; %s) = %s\n" % (gen_from, coeffs_a, target)
     return result
Exemplo n.º 3
0
    def compare_arrow(arrow1, arrow2):
        gen_from1, coeffs_a1, coeff_d1, gen_to1 = arrow1
        gen_from2, coeffs_a2, coeff_d2, gen_to2 = arrow2
        def compare_mult(mult1, mult2):
            if sum(mult1) != sum(mult2):
                return sum(mult1) - sum(mult2)
            mult1, mult2 = list(reversed(mult1)), list(reversed(mult2))
            if mult1 < mult2:
                return -1
            if mult1 > mult2:
                return 1
            return 0

        mult_d1, mult_d2 = coeff_d1.multiplicity, coeff_d2.multiplicity
        if compare_mult(mult_d1, mult_d2) != 0:
            return compare_mult(mult_d1, mult_d2)
        if len(coeff_d1.strands) != len(coeff_d2.strands):
            return len(coeff_d1.strands) - len(coeff_d2.strands)

        mult_a1 = sumColumns([coeff.multiplicity for coeff in coeffs_a1], n1-1)
        mult_a2 = sumColumns([coeff.multiplicity for coeff in coeffs_a2], n2-1)
        return compare_mult(mult_a1, mult_a2)