Ticket #10318: trac_10318-Composit.patch

File trac_10318-Composit.patch, 11.3 KB (added by John Cremona, 12 years ago)

Applies to 4.6.1.alpha2 + patch from #8807

  • sage/categories/pushout.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1290598229 0
    # Node ID 7a50578587b8ae5981666e4f3499b12bb8ea3047
    # Parent  8243d9435362db8b8b25a5c67ea9a9233ae25145
    #10318: change spelling of CompositConstructionFunctor to CompositeConstructionFunctor
    
    diff -r 8243d9435362 -r 7a50578587b8 sage/categories/pushout.py
    a b  
    1010    def __mul__(self, other):
    1111        if not isinstance(self, ConstructionFunctor) and not isinstance(other, ConstructionFunctor):
    1212            raise CoercionException, "Non-constructive product"
    13         return CompositConstructionFunctor(other, self)
     13        return CompositeConstructionFunctor(other, self)
    1414       
    1515    def pushout(self, other):
    1616        if self.rank > other.rank:
     
    4646        return [self]
    4747
    4848       
    49 class CompositConstructionFunctor(ConstructionFunctor):
     49class CompositeConstructionFunctor(ConstructionFunctor):
    5050    """
    5151    A Construction Functor composed by other Construction Functors
    5252
     
    5757
    5858    EXAMPLES::
    5959
    60         sage: from sage.categories.pushout import CompositConstructionFunctor
    61         sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     60        sage: from sage.categories.pushout import CompositeConstructionFunctor
     61        sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    6262        sage: F
    6363        Poly[y](FractionField(Poly[x](FractionField(...))))
    64         sage: F == CompositConstructionFunctor(*F.all)
     64        sage: F == CompositeConstructionFunctor(*F.all)
    6565        True
    6666        sage: F(GF(2)['t'])
    6767        Univariate Polynomial Ring in y over Fraction Field of Univariate Polynomial Ring in x over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 2 (using NTL)
     
    7272        """
    7373        TESTS::
    7474
    75             sage: from sage.categories.pushout import CompositConstructionFunctor
    76             sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     75            sage: from sage.categories.pushout import CompositeConstructionFunctor
     76            sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    7777            sage: F
    7878            Poly[y](FractionField(Poly[x](FractionField(...))))
    79             sage: F == CompositConstructionFunctor(*F.all)
     79            sage: F == CompositeConstructionFunctor(*F.all)
    8080            True
    8181
    8282        """
     
    8484        for c in args:
    8585            if isinstance(c, list):
    8686                self.all += c
    87             elif isinstance(c, CompositConstructionFunctor):
     87            elif isinstance(c, CompositeConstructionFunctor):
    8888                self.all += c.all
    8989            else:
    9090                self.all.append(c)
     
    9494        """
    9595        TESTS::
    9696
    97             sage: from sage.categories.pushout import CompositConstructionFunctor
    98             sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     97            sage: from sage.categories.pushout import CompositeConstructionFunctor
     98            sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    9999            sage: R.<a,b> = QQ[]
    100100            sage: f = R.hom([a+b, a-b])
    101101            sage: F(f) # indirect doctest
     
    118118        """
    119119        TESTS::
    120120       
    121             sage: from sage.categories.pushout import CompositConstructionFunctor
    122             sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     121            sage: from sage.categories.pushout import CompositeConstructionFunctor
     122            sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    123123            sage: R.<a,b> = QQ[]
    124124            sage: F(R) # indirect doctest
    125125            Univariate Polynomial Ring in y over Fraction Field of Univariate Polynomial Ring in x over Fraction Field of Multivariate Polynomial Ring in a, b over Rational Field
     
    133133        """
    134134        TESTS::
    135135
    136             sage: from sage.categories.pushout import CompositConstructionFunctor
    137             sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     136            sage: from sage.categories.pushout import CompositeConstructionFunctor
     137            sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    138138            sage: F == loads(dumps(F)) # indirect doctest
    139139            True
    140140
    141141        """
    142         if isinstance(other, CompositConstructionFunctor):
     142        if isinstance(other, CompositeConstructionFunctor):
    143143            return cmp(self.all, other.all)
    144144        else:
    145145            return cmp(type(self), type(other))
     
    150150
    151151        EXAMPLES::
    152152
    153             sage: from sage.categories.pushout import CompositConstructionFunctor
    154             sage: F1 = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0])
    155             sage: F2 = CompositConstructionFunctor(QQ.construction()[0],ZZ['y'].construction()[0])
     153            sage: from sage.categories.pushout import CompositeConstructionFunctor
     154            sage: F1 = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0])
     155            sage: F2 = CompositeConstructionFunctor(QQ.construction()[0],ZZ['y'].construction()[0])
    156156            sage: F1*F2
    157157            Poly[x](FractionField(Poly[y](FractionField(...))))
    158158
    159159        """
    160         if isinstance(self, CompositConstructionFunctor):
     160        if isinstance(self, CompositeConstructionFunctor):
    161161            all = [other] + self.all
    162162        else:
    163163            all = other.all + [self]
    164         return CompositConstructionFunctor(*all)
     164        return CompositeConstructionFunctor(*all)
    165165   
    166166    def __str__(self):
    167167        """
    168168        TESTS::
    169169
    170             sage: from sage.categories.pushout import CompositConstructionFunctor
    171             sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     170            sage: from sage.categories.pushout import CompositeConstructionFunctor
     171            sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    172172            sage: F     # indirect doctest
    173173            Poly[y](FractionField(Poly[x](FractionField(...))))
    174174
     
    180180       
    181181    def expand(self):
    182182        """
    183         Return expansion of a CompositConstructionFunctor.
     183        Return expansion of a CompositeConstructionFunctor.
    184184
    185185        NOTE:
    186186
     
    189189
    190190        EXAMPLES::
    191191
    192             sage: from sage.categories.pushout import CompositConstructionFunctor
    193             sage: F = CompositConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
     192            sage: from sage.categories.pushout import CompositeConstructionFunctor
     193            sage: F = CompositeConstructionFunctor(QQ.construction()[0],ZZ['x'].construction()[0],QQ.construction()[0],ZZ['y'].construction()[0])
    194194            sage: F
    195195            Poly[y](FractionField(Poly[x](FractionField(...))))
    196196            sage: prod(F.expand()) == F
     
    323323            if set(self.vars).intersection(other.vars):
    324324                raise CoercionException, "Overlapping variables (%s,%s)" % (self.vars, other.vars)
    325325            return MultiPolynomialFunctor(other.vars + self.vars, self.term_order)
    326         elif isinstance(other, CompositConstructionFunctor) \
     326        elif isinstance(other, CompositeConstructionFunctor) \
    327327              and isinstance(other.all[-1], MultiPolynomialFunctor):
    328             return CompositConstructionFunctor(other.all[:-1], self * other.all[-1])
     328            return CompositeConstructionFunctor(other.all[:-1], self * other.all[-1])
    329329        else:
    330             return CompositConstructionFunctor(other, self)
     330            return CompositeConstructionFunctor(other, self)
    331331
    332332    def merge(self, other):
    333333        """
     
    563563                OUTGENS = list(other._gens) + list(self._gens)
    564564            # the orders must coincide
    565565            if self._order != other._order:
    566                 return CompositConstructionFunctor(other, self)
     566                return CompositeConstructionFunctor(other, self)
    567567            # the implementations must coincide
    568568            if self._imple != other._imple:
    569                 return CompositConstructionFunctor(other, self)
     569                return CompositeConstructionFunctor(other, self)
    570570            return InfinitePolynomialFunctor(OUTGENS, self._order, self._imple)
    571571
    572572        # Polynomial Constructor
     
    625625            # ok, the overlap is fine, we will return something.
    626626            if RemainingVars: # we can only partially merge other into self
    627627                if len(RemainingVars)>1:
    628                     return CompositConstructionFunctor(MultiPolynomialFunctor(RemainingVars,term_order=other.term_order), self)
    629                 return CompositConstructionFunctor(PolynomialFunctor(RemainingVars[0]), self)
     628                    return CompositeConstructionFunctor(MultiPolynomialFunctor(RemainingVars,term_order=other.term_order), self)
     629                return CompositeConstructionFunctor(PolynomialFunctor(RemainingVars[0]), self)
    630630            return self
    631         return CompositConstructionFunctor(other, self)
     631        return CompositeConstructionFunctor(other, self)
    632632
    633633    def merge(self,other):
    634634        """
     
    665665        try:
    666666            OUT = self*other
    667667            # The following happens if "other" has the same order type etc.
    668             if not isinstance(OUT, CompositConstructionFunctor):
     668            if not isinstance(OUT, CompositeConstructionFunctor):
    669669                return OUT
    670670        except CoercionException:
    671671            pass
  • sage/rings/polynomial/infinite_polynomial_ring.py

    diff -r 8243d9435362 -r 7a50578587b8 sage/rings/polynomial/infinite_polynomial_ring.py
    a b  
    340340            return InfinitePolynomialRing(*key)
    341341        # By now, we have different unique keys, based on construction functors
    342342        C,R = key
    343         from sage.categories.pushout import CompositConstructionFunctor, InfinitePolynomialFunctor
    344         if isinstance(C,CompositConstructionFunctor):
     343        from sage.categories.pushout import CompositeConstructionFunctor, InfinitePolynomialFunctor
     344        if isinstance(C,CompositeConstructionFunctor):
    345345            F = C.all[-1]
    346346            if len(C.all)>1:
    347                 R = CompositConstructionFunctor(*C.all[:-1])(R)
     347                R = CompositeConstructionFunctor(*C.all[:-1])(R)
    348348        else:
    349349            F = C
    350350        if not isinstance(F, InfinitePolynomialFunctor):