Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #19946: fix _pushout_ for cartesian product of growth groups
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Jan 26, 2016
1 parent 1961f94 commit 1fc00c7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/sage/rings/asymptotic/growth_group_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,11 +692,17 @@ def _pushout_(self, other):
Growth Group QQ^x * x^QQ
sage: cm.common_parent(GrowthGroup('QQ^x * x^ZZ'), GrowthGroup('ZZ^x * x^QQ'))
Growth Group QQ^x * x^QQ
::
sage: pushout(GrowthGroup('QQ^n * n^QQ'), GrowthGroup('SR^n'))
Growth Group SR^n * n^QQ
"""
from growth_group import GenericGrowthGroup, AbstractGrowthGroupFunctor
from misc import merge_overlapping
from misc import underlying_class

Sfactors = self.cartesian_factors()
if isinstance(other, GenericProduct):
Ofactors = other.cartesian_factors()
elif isinstance(other, GenericGrowthGroup):
Expand Down Expand Up @@ -759,7 +765,7 @@ def next(self):
self.factors = tuple()

from itertools import groupby
S = it(groupby(self.cartesian_factors(), key=lambda k: k.variable_names()))
S = it(groupby(Sfactors, key=lambda k: k.variable_names()))
O = it(groupby(Ofactors, key=lambda k: k.variable_names()))

newS = []
Expand All @@ -786,9 +792,9 @@ def next(self):

assert(len(newS) == len(newO))

if (len(self.cartesian_factors()) == len(newS) and
len(other.cartesian_factors()) == len(newO)):
# We had already all factors in each of the self and
if (len(Sfactors) == len(newS) and
len(Ofactors) == len(newO)):
# We had already all factors in each of self and
# other, thus splitting it in subproblems (one for
# each factor) is the strategy to use. If a pushout is
# possible :func:`sage.categories.pushout.pushout`
Expand Down

0 comments on commit 1fc00c7

Please sign in to comment.