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

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
xcaruso committed May 8, 2020
1 parent 98e29e7 commit 52932e0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

# Ore Polynomial Rings
from sage.rings.polynomial.ore_polynomial_ring import OrePolynomialRing
from sage.rings.polynomial.skew_polynomial_ring import SkewPolynomialRing
SkewPolynomialRing = OrePolynomialRing

# Evaluation of cyclotomic polynomials
from sage.rings.polynomial.cyclotomic import cyclotomic_value
Expand Down
11 changes: 6 additions & 5 deletions src/sage/rings/polynomial/ore_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,20 @@ def __classcall_private__(cls, base_ring, twist=None, names=None, sparse=False):
if derivation is None and morphism is None:
return PolynomialRing(base_ring, names, sparse)

from sage.rings.polynomial import skew_polynomial_ring
constructors = [ ]
if derivation is None:
if base_ring in Fields():
try:
order = morphism.order()
if order is not Infinity:
if base_ring.is_finite():
constructors.append(sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing_finite_field)
constructors.append(skew_polynomial_ring.SkewPolynomialRing_finite_field)
else:
constructors.append(sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing_finite_order)
constructors.append(skew_polynomial_ring.SkewPolynomialRing_finite_order)
except (AttributeError, NotImplementedError):
pass
constructors.append(sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing)
constructors.append(skew_polynomial_ring.SkewPolynomialRing)

for constructor in constructors:
try:
Expand Down Expand Up @@ -431,15 +432,15 @@ def twisting_morphism(self, n=1):
sage: S.twisting_morphism(-1)
Traceback (most recent call last):
...
NotImplementedError: inversion of the twist map Ring endomorphism of Univariate Polynomial Ring in t over Rational Field
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Univariate Polynomial Ring in t over Rational Field
Defn: t |--> t + 1
"""
if self._morphism is not None:
try:
return self._morphism ** n
except TypeError as e:
if n < 0:
raise NotImplementedError("inversion of the twisting morphism %s" % self._map)
raise NotImplementedError("inversion of the twisting morphism %s" % self._morphism)
else:
raise ValueError("Unexpected error in iterating the twisting morphism: %s", e)

Expand Down
36 changes: 18 additions & 18 deletions src/sage/rings/polynomial/skew_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: a.left_power_mod(100,modulus)
(4*t^2 + t + 1)*x^2 + (t^2 + 4*t + 1)*x + 3*t^2 + 3*t
"""
cdef OrePolynomial_generic_dense r
cdef SkewPolynomial_generic_dense r
if not isinstance(exp, Integer):
try:
exp = Integer(exp)
Expand Down Expand Up @@ -192,7 +192,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: a.right_power_mod(100,modulus)
(2*t^2 + 3)*x^2 + (t^2 + 4*t + 2)*x + t^2 + 2*t + 1
"""
cdef OrePolynomial_generic_dense r
cdef SkewPolynomial_generic_dense r
if not isinstance(exp, Integer):
try:
exp = Integer(exp)
Expand Down Expand Up @@ -366,7 +366,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
...
TypeError: 1/t fails to convert into the map's domain Univariate Polynomial Ring in t over Rational Field, but a `pushforward` method is not properly implemented
"""
cdef RingHomomorphism sigma = self._parent.twist_morphism()
cdef RingHomomorphism sigma = self._parent.twisting_morphism()
cdef list coefficients = self.list()
cdef RingElement ret = self.base_ring().zero()
cdef RingElement a = eval_pt
Expand Down Expand Up @@ -404,7 +404,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: b = a.conjugate(-1)
Traceback (most recent call last):
...
NotImplementedError: inversion of the twist map Ring endomorphism of Univariate Polynomial Ring in t over Rational Field
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Univariate Polynomial Ring in t over Rational Field
Defn: t |--> t + 1
Here is a working example::
Expand All @@ -419,7 +419,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: u*y == y*v
True
"""
r = self._new_c([self._parent.twist_morphism(n)(x) for x in self.list()],
r = self._new_c([self._parent.twisting_morphism(n)(x) for x in self.list()],
self._parent, 0)
return r

Expand Down Expand Up @@ -481,8 +481,8 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
return self._parent.zero()
cdef list x = (<SkewPolynomial_generic_dense>self)._coeffs
cdef Py_ssize_t i
twist_morphism = self._parent._map
r = self._new_c([ (twist_morphism**i)(right)*x[i] for i from 0 <= i < len(x) ],
twisting_morphism = self._parent._morphism
r = self._new_c([ (twisting_morphism**i)(right)*x[i] for i from 0 <= i < len(x) ],
self._parent, 0)
return r

Expand Down Expand Up @@ -557,9 +557,9 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
for k from 0 <= k <= dx+dy:
start = 0 if k <= dy else k-dy
end = k if k <= dx else dx
sum = x[start] * parent.twist_morphism(start)(y[k-start])
sum = x[start] * parent.twisting_morphism(start)(y[k-start])
for i from start < i <= end:
sum += x[i] * parent.twist_morphism(i)(y[k-i])
sum += x[i] * parent.twisting_morphism(i)(y[k-i])
coeffs.append(sum)
r = self._new_c(coeffs, parent, 0)
return r
Expand Down Expand Up @@ -588,16 +588,16 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
elif d1 >= 0:
for k from d1 < k <= d1+d2:
start = 0 if k <= d2 else k-d2
sum = x[start] * parent.twist_morphism(start)(y[k-start])
sum = x[start] * parent.twisting_morphism(start)(y[k-start])
for i from start < i <= d1:
sum += x[i] * parent.twist_morphism(i)(y[k-i])
sum += x[i] * parent.twisting_morphism(i)(y[k-i])
x.append(sum)
for k from d1 >= k >= 0:
start = 0 if k <= d2 else k-d2
end = k if k <= d1 else d1
sum = x[start] * parent.twist_morphism(start)(y[k-start])
sum = x[start] * parent.twisting_morphism(start)(y[k-start])
for i from start < i <= end:
sum += x[i] * parent.twist_morphism(i)(y[k-i])
sum += x[i] * parent.twisting_morphism(i)(y[k-i])
x[k] = sum

cdef void _inplace_pow(self, Py_ssize_t n):
Expand Down Expand Up @@ -645,11 +645,11 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
parent = self._parent
for i from da-db >= i >= 0:
try:
c = parent.twist_morphism(-db)(inv*a[i+db])
c = parent.twisting_morphism(-db)(inv*a[i+db])
for j from 0 <= j < db:
a[i+j] -= b[j] * parent.twist_morphism(j)(c)
a[i+j] -= b[j] * parent.twisting_morphism(j)(c)
except Exception:
raise NotImplementedError("inversion of the twist map %s" % parent.twist_morphism())
raise NotImplementedError("inversion of the twist map %s" % parent.twisting_morphism())
q.append(c)
q.reverse()
return (self._new_c(q, parent), self._new_c(a[:db], parent, 1))
Expand All @@ -675,9 +675,9 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
cdef list q = [ ]
parent = self._parent
for i from da-db >= i >= 0:
c = parent.twist_morphism(i)(inv) * a[i+db]
c = parent.twisting_morphism(i)(inv) * a[i+db]
for j from 0 <= j < db:
a[i+j] -= c * parent.twist_morphism(i)(b[j])
a[i+j] -= c * parent.twisting_morphism(i)(b[j])
q.append(c)
q.reverse()
return (self._new_c(q, parent), self._new_c(a[:db], parent, 1))
6 changes: 3 additions & 3 deletions src/sage/rings/polynomial/skew_polynomial_finite_order.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense):
pol.append(l[k])
M.append(Polk(pol))
for i from 0 <= i <= d:
l[i] = self._parent.twist_morphism()(l[i])
l[i] = self._parent.twisting_morphism()(l[i])
return matrix(Polk, r, r, M)


Expand Down Expand Up @@ -216,12 +216,12 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense):
True
"""
order = self.parent()._order
twist_morphism = self.parent().twist_morphism()
twisting_morphism = self.parent().twisting_morphism()
coeffs = [ ]
for i in range(0, self.degree()+1, order):
tr = c = self._coeffs[i]
for _ in range(order-1):
tr = c + twist_morphism(tr)
tr = c + twisting_morphism(tr)
coeffs.append(tr)
if var is False:
return tuple(coeffs)
Expand Down
26 changes: 12 additions & 14 deletions src/sage/rings/polynomial/skew_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _base_ring_to_fraction_field(S):
else:
Q = R.fraction_field()
gens = R.gens()
sigmaS = S.twist_map()
sigmaS = S.twisting_morphism()
# try:
sigmaQ = Q.hom([Q(sigmaS(g)) for g in gens])
return Q[S.variable_name(), sigmaQ]
Expand Down Expand Up @@ -132,7 +132,7 @@ def _minimal_vanishing_polynomial(R, eval_pts):
if e.is_zero():
return R.one()
else:
return R.gen() - R.twist_map()(e) / e
return R.gen() - R.twisting_morphism()(e) / e
else:
t = l // 2
A = eval_pts[:t]
Expand Down Expand Up @@ -222,7 +222,7 @@ def __init__(self, base_ring, morphism, derivation, name, sparse, category=None)
- ``base_ring`` -- a commutative ring
- ``twist_map`` -- an automorphism of the base ring
- ``twisting_morphism`` -- an automorphism of the base ring
- ``name`` -- string or list of strings representing the name of
the variables of ring
Expand All @@ -245,6 +245,7 @@ def __init__(self, base_ring, morphism, derivation, name, sparse, category=None)
if derivation is not None:
raise NotImplementedError
if self.Element is None:
import sage.rings.polynomial.skew_polynomial_element
self.Element = sage.rings.polynomial.skew_polynomial_element.SkewPolynomial_generic_dense
OrePolynomialRing.__init__(self, base_ring, morphism, None, name, sparse, category)

Expand All @@ -255,7 +256,7 @@ def minimal_vanishing_polynomial(self, eval_pts):
The degree of the vanishing polynomial is at most the length of
``eval_pts``. Equality holds if and only if the elements of ``eval_pts``
are linearly independent over the fixed field of ``self.twist_map()``.
are linearly independent over the fixed field of ``self.twisting_morphism()``.
- ``eval_pts`` -- list of evaluation points which are linearly
independent over the fixed field of the twist map of the associated
Expand Down Expand Up @@ -298,10 +299,10 @@ def lagrange_polynomial(self, points):
More precisely, given `n` pairs `(x_1, y_1), ..., (x_n, y_n) \in R^2`,
where `R` is ``self.base_ring()``, compute a skew polynomial `p(x)` such
that `p(x_i) = y_i` for each `i`, under the condition that the `x_i` are
linearly independent over the fixed field of ``self.twist_map()``.
linearly independent over the fixed field of ``self.twisting_morphism()``.
If the `x_i` are linearly independent over the fixed field of
``self.twist_map()`` then such a polynomial is guaranteed to exist.
``self.twisting_morphism()`` then such a polynomial is guaranteed to exist.
Otherwise, it might exist depending on the `y_i`, but the algorithm used
in this implementation does not support that, and so an error is always
raised.
Expand All @@ -310,7 +311,7 @@ def lagrange_polynomial(self, points):
- ``points`` -- a list of pairs ``(x_1, y_1),..., (x_n, y_n)`` of
elements of the base ring of ``self``. The `x_i` should be linearly
independent over the fixed field of ``self.twist_map()``.
independent over the fixed field of ``self.twisting_morphism()``.
OUTPUT:
Expand All @@ -335,7 +336,7 @@ def lagrange_polynomial(self, points):
True
If the `x_i` are linearly dependent over the fixed field of
``self.twist_map()``, then an error is raised::
``self.twisting_morphism()``, then an error is raised::
sage: T.lagrange_polynomial([ (t, 1), (2*t, 3) ])
Traceback (most recent call last):
Expand Down Expand Up @@ -819,10 +820,7 @@ def _new_retraction_map(self, seed=None):
"""
k = self.base_ring()
base = k.base_ring()
(kfixed, embed) = self._maps[1].fixed_field()
section = embed.section()
if not kfixed.has_coerce_map_from(base):
raise NotImplementedError("No coercion map from %s to %s" % (base, kfixed))
section = self._embed_constants.section()
if seed is None:
seed = k.random_element()
self._seed_retraction = seed
Expand All @@ -832,11 +830,11 @@ def _new_retraction_map(self, seed=None):
x = elt
tr = elt
for _ in range(1, self._order):
x = self._map(x)
x = self._morphism(x)
tr += x
elt *= k.gen()
trace.append(section(tr))
self._matrix_retraction = MatrixSpace(kfixed, 1, k.degree())(trace)
self._matrix_retraction = MatrixSpace(self._constants, 1, k.degree())(trace)

def _retraction(self, x, newmap=False, seed=None):
"""
Expand Down

0 comments on commit 52932e0

Please sign in to comment.