Esempio n. 1
0
    def simplify(self, cancellation_constraint = None):
        """Simplify a type DD structure using cancellation lemma.

        cancellation_constraint is a function from two generators to boolean,
        stating whether they can be cancelled.

        """
        # Simplification is best done in terms of coefficients
        # Build dictionary of coefficients
        arrows = dict()
        for gen in self.generators:
            arrows[gen] = dict()
        bialgebra = TensorDGAlgebra((self.algebra1, self.algebra2))
        for gen in self.generators:
            for (AGen1, AGen2, MGen), coeff in self.delta_map[gen].items():
                if MGen not in arrows[gen]:
                    arrows[gen][MGen] = E0
                arrows[gen][MGen] += TensorGenerator(
                    (AGen1, AGen2), bialgebra) * coeff

        arrows = simplifyComplex(
            arrows, default_coeff = E0,
            cancellation_constraint = cancellation_constraint)

        # Now rebuild the type DD structure
        self.generators = set()
        self.delta_map = dict()
        for x in arrows:
            self.generators.add(x)
            self.delta_map[x] = E0
            for y, coeff in arrows[x].items():
                for (a1, a2), ring_coeff in coeff.items():
                    target_gen = TensorGenerator((a1, a2, y), self.AAtensorM)
                    self.delta_map[x] += ring_coeff * target_gen
Esempio n. 2
0
    def simplify(self, cancellation_constraint = None):
        """Simplify a type D structure using cancellation lemma."""
        # Simplification is best done in terms of coefficients
        # Build dictionary of coefficients
        arrows = dict()
        for gen in self.generators:
            arrows[gen] = dict()
        for gen in self.generators:
            for (AGen, MGen), coeff in self.delta_map[gen].items():
                if MGen not in arrows[gen]:
                    arrows[gen][MGen] = E0
                arrows[gen][MGen] += AGen * coeff

        arrows = simplifyComplex(
            arrows, E0,
            cancellation_constraint = cancellation_constraint)

        # Now rebuild the type D structure
        self.generators = set()
        self.delta_map = dict()
        for x in arrows:
            self.generators.add(x)
            self.delta_map[x] = E0
            for y, coeff in arrows[x].items():
                self.delta_map[x] += coeff * y

        # This is a good place to simplify gradings
        if hasattr(self, "gr_set"):
            new_gr_set = self.gr_set.simplifiedSet()
            for gen in self.generators:
                self.grading[gen] = self.gr_set.simplifiedElt(self.grading[gen])
            self.gr_set = new_gr_set
Esempio n. 3
0
    def simplify(self, cancellation_constraint=None):
        """Simplify a type D structure using cancellation lemma."""
        # Simplification is best done in terms of coefficients
        # Build dictionary of coefficients
        arrows = dict()
        for gen in self.generators:
            arrows[gen] = dict()
        for gen in self.generators:
            for (AGen, MGen), coeff in self.delta_map[gen].items():
                if MGen not in arrows[gen]:
                    arrows[gen][MGen] = E0
                arrows[gen][MGen] += AGen * coeff

        arrows = simplifyComplex(
            arrows, E0, cancellation_constraint=cancellation_constraint)

        # Now rebuild the type D structure
        self.generators = set()
        self.delta_map = dict()
        for x in arrows:
            self.generators.add(x)
            self.delta_map[x] = E0
            for y, coeff in arrows[x].items():
                self.delta_map[x] += coeff * y

        # This is a good place to simplify gradings #CB and remove
        if hasattr(self, "gr_set"):
            new_gr_set = self.gr_set.simplifiedSet()
            for gen in self.generators:
                self.grading[gen] = self.gr_set.simplifiedElt(
                    self.grading[gen])
            self.gr_set = new_gr_set