#21106: class for flattening polynomial rings over polynomial rings
-------------------------------------+-------------------------------------
Reporter: bhutz | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: sage-7.3
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: Ben Hutz, Vincent | Reviewers:
Delecroix |
Report Upstream: N/A | Work issues:
Branch: u/bhutz/flatten | Commit:
| cf97fed2b1dba25909f952e899e2256a87b092d5
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
Here is a recursive version of `_call_` that seems to be a little bit
faster
{{{
def _call2_(self, p):
r"""
TESTS::
sage: R = QQ['x']['y']['s','t']
sage: p = R('s*x + y*t + x^2*s + 1 + t')
sage: f = FlatteningMorphism(R)
sage: f._call2_(p)
x^2*s + x*s + y*t + t + 1
"""
p = {(): p}
for ring in self._intermediate_rings:
new_p = {}
if is_PolynomialRing(ring):
for mon,pp in p.iteritems():
assert pp.parent() == ring
for i,j in pp.dict().iteritems():
new_p[(i,)+(mon)] = j
elif is_MPolynomialRing(ring):
for mon,pp in p.iteritems():
assert pp.parent() == ring
for mmon,q in pp.dict().iteritems():
new_p[tuple(mmon)+mon] = q
else:
raise RuntimeError
p = new_p
return self.codomain()(p)
}}}
--
Ticket URL: <https://trac.sagemath.org/ticket/21106#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.