Skip to content

Commit e270c79

Browse files
author
Matthias Koeppe
committed
PolynomialFunctor: Keep track of implementation
1 parent 0c92baa commit e270c79

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/sage/categories/pushout.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ class PolynomialFunctor(ConstructionFunctor):
833833
"""
834834
rank = 9
835835

836-
def __init__(self, var, multi_variate=False, sparse=False):
836+
def __init__(self, var, multi_variate=False, sparse=False, implementation=None):
837837
"""
838838
TESTS::
839839
@@ -857,6 +857,7 @@ def __init__(self, var, multi_variate=False, sparse=False):
857857
self.var = var
858858
self.multi_variate = multi_variate
859859
self.sparse = sparse
860+
self.implementation = implementation
860861

861862
def _apply_functor(self, R):
862863
"""
@@ -870,7 +871,10 @@ def _apply_functor(self, R):
870871
871872
"""
872873
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
873-
return PolynomialRing(R, self.var, sparse=self.sparse)
874+
kwds = {}
875+
if self.implementation:
876+
kwds['implementation'] = self.implementation
877+
return PolynomialRing(R, self.var, sparse=self.sparse, **kwds)
874878

875879
def _apply_functor_to_morphism(self, f):
876880
"""

src/sage/rings/polynomial/polynomial_ring.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ def flattening_morphism(self):
619619
return IdentityMorphism(self)
620620

621621
def construction(self):
622+
"""
623+
Return the construction functor.
624+
"""
622625
return categories.pushout.PolynomialFunctor(self.variable_name(), sparse=self.__is_sparse), self.base_ring()
623626

624627
def completion(self, p, prec=20, extras=None):
@@ -1951,6 +1954,15 @@ def _repr_(self):
19511954
s = PolynomialRing_commutative._repr_(self)
19521955
return s + self._implementation_repr
19531956

1957+
def construction(self):
1958+
"""
1959+
Return the construction functor.
1960+
"""
1961+
implementation = None
1962+
if 'NTL' in self._implementation_repr:
1963+
implementation = 'NTL'
1964+
return categories.pushout.PolynomialFunctor(self.variable_name(), sparse=self.is_sparse(),
1965+
implementation=implementation), self.base_ring()
19541966

19551967
class PolynomialRing_field(PolynomialRing_integral_domain,
19561968
ring.PrincipalIdealDomain):

0 commit comments

Comments
 (0)