Skip to content

Commit 1333d0f

Browse files
committed
fix suggested details and a few more
1 parent f1913ab commit 1333d0f

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

src/sage/rings/rational.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,8 +2043,8 @@ cdef class Rational(sage.structure.element.FieldElement):
20432043
3.1415094339622641509433962264150943396226415094339622641509
20442044
"""
20452045
d = self.denominator()
2046-
_, d = d.val_unit(2)
2047-
_, d = d.val_unit(5)
2046+
d = d.val_unit(2)[1]
2047+
d = d.val_unit(5)[1]
20482048
from sage.rings.finite_rings.integer_mod import Mod
20492049
return Mod(10, d).multiplicative_order()
20502050

src/sage/rings/ring_extension.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ class RingExtensionFactory(UniqueFactory):
479479
sage: RingExtension.create_object((8,9,0), key, **extra_args)
480480
Rational Field over its base
481481
"""
482-
defining_morphism, _, _ = key
482+
defining_morphism = key[0]
483483
constructors = extra_args['constructors']
484484
if len(constructors) == 0:
485485
raise NotImplementedError("no constructor available for this extension")

src/sage/rings/ring_extension_morphism.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ cdef class MapRelativeRingToFreeModule(Map):
836836
from sage.rings.ring_extension import common_base
837837
base = common_base(K, L, False)
838838
EK, iK, _ = K.free_module(base, map=True)
839-
_, _, jL = L.free_module(base, map=True)
839+
jL = L.free_module(base, map=True)[2]
840840

841841
self._dimK = EK.dimension()
842842
self._iK = iK

src/sage/rings/tate_algebra_ideal.pyx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class TateAlgebraIdeal(Ideal_generic):
390390
if self.ring().base_ring().is_field():
391391
return self
392392
gb = self.groebner_basis()
393-
gens = [ g.monic() for g in gb ]
393+
gens = [g.monic() for g in gb]
394394
return self.ring().ideal(gens)
395395

396396

@@ -432,14 +432,14 @@ def groebner_basis_buchberger(I, prec, py_integral):
432432
...0000000001*x^2*y + ...1210121020 + O(3^10 * <x, y>),
433433
...000000001*y^2 + ...210121020*x + O(3^9 * <x, y>)]
434434
"""
435-
cdef list gb, rgb, indices, S = [ ]
435+
cdef list gb, rgb, indices, S = []
436436
cdef int i, j, l
437437
cdef TateAlgebraTerm ti, tj, t
438438
cdef TateAlgebraElement f, g, r, s
439439
cdef bint do_reduce = True
440440
cdef bint integral = py_integral
441441

442-
gb = [ ]
442+
gb = []
443443
l = 0
444444
for f in I.gens():
445445
if not f:
@@ -550,9 +550,10 @@ def groebner_basis_buchberger(I, prec, py_integral):
550550
rgb[i] = g._positive_lshift_c(1)
551551
_, rgb[i] = g._quo_rem_c(rgb, False, True, True)
552552
else:
553-
rgb = [ g.monic() for g in rgb ]
553+
rgb = [g.monic() for g in rgb]
554554
else:
555-
rgb = [ g * base(g.leading_coefficient().unit_part()).inverse_of_unit() for g in rgb ]
555+
rgb = [g * base(g.leading_coefficient().unit_part()).inverse_of_unit()
556+
for g in rgb]
556557

557558
rgb.sort(reverse=True)
558559
return rgb
@@ -638,7 +639,7 @@ cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElemen
638639
cdef dict coeffs = { }
639640
cdef TateAlgebraElement f
640641
cdef TateAlgebraTerm lt, factor
641-
cdef list ltds = [ (<TateAlgebraElement>(d[1]))._terms_c()[0] for d in sgb ]
642+
cdef list ltds = [(<TateAlgebraElement>(d[1]))._terms_c()[0] for d in sgb]
642643
cdef list terms = v._terms_c()
643644
cdef int index = 0
644645
cdef int i
@@ -711,7 +712,7 @@ cdef TateAlgebraElement reduce(gb, TateAlgebraElement v, stopval):
711712
cdef dict coeffs = { }
712713
cdef TateAlgebraElement f
713714
cdef TateAlgebraTerm lt, factor
714-
cdef list ltds = [ (<TateAlgebraElement>d)._terms_c()[0] for d in gb ]
715+
cdef list ltds = [(<TateAlgebraElement>d)._terms_c()[0] for d in gb]
715716
cdef list terms = v._terms_c()
716717
cdef int index = 0
717718
cdef int i
@@ -854,7 +855,7 @@ def groebner_basis_pote(I, prec, verbose=0):
854855
cdef TateAlgebraTerm term_one = I.ring().monoid_of_terms().one()
855856
cdef bint integral = not I.ring().base_ring().is_field()
856857

857-
gb = [ ]
858+
gb = []
858859

859860
for f in sorted(I.gens()):
860861
sig_check()
@@ -869,10 +870,10 @@ def groebner_basis_pote(I, prec, verbose=0):
869870
print("new generator: %s + ..." % f.leading_term())
870871
# Initial strong Grobner basis:
871872
# we add signatures
872-
sgb = [ (None, g) for g in gb if g ]
873+
sgb = [(None, g) for g in gb if g]
873874
# We compute initial J-pairs
874875
p = (term_one, f.add_bigoh(prec))
875-
Jpairs = [ ]
876+
Jpairs = []
876877
for P in sgb:
877878
sig_check()
878879
J = Jpair(p, P)
@@ -881,7 +882,7 @@ def groebner_basis_pote(I, prec, verbose=0):
881882
sgb.append(p)
882883

883884
# For the syzygy criterium
884-
gb0 = [ g.leading_term() for g in gb ]
885+
gb0 = [g.leading_term() for g in gb]
885886

886887
if verbose > 1:
887888
print("%s initial J-pairs" % len(Jpairs))
@@ -1003,7 +1004,7 @@ def groebner_basis_pote(I, prec, verbose=0):
10031004
print("| %s" % g)
10041005

10051006
if not integral:
1006-
gb = [ f.monic() for f in gb ]
1007+
gb = [f.monic() for f in gb]
10071008
gb.sort(reverse=True)
10081009
return gb
10091010

@@ -1098,9 +1099,9 @@ def groebner_basis_vapote(I, prec, verbose=0, interrupt_red_with_val=False, inte
10981099
cdef list terms
10991100
cdef bint do_reduce, integral
11001101
term_one = I.ring().monoid_of_terms().one()
1101-
gb = [ ]
1102+
gb = []
11021103

1103-
gens = [ ]
1104+
gens = []
11041105
for f in I.gens():
11051106
if f:
11061107
val = f.valuation()
@@ -1155,18 +1156,18 @@ def groebner_basis_vapote(I, prec, verbose=0, interrupt_red_with_val=False, inte
11551156

11561157
# Initial strong Grobner basis:
11571158
# we add signatures
1158-
sgb = [ (None, g) for g in gb if g ]
1159+
sgb = [(None, g) for g in gb if g]
11591160
# We compute initial J-pairs
11601161
p = (term_one, f.add_bigoh(prec))
1161-
Jpairs = [ ]
1162+
Jpairs = []
11621163
for P in sgb:
11631164
J = Jpair(p, P)
11641165
if J is not None:
11651166
heappush(Jpairs, J)
11661167
sgb.append(p)
11671168

11681169
# For the syzygy criterium
1169-
gb0 = [ g.leading_term() for g in gb ]
1170+
gb0 = [g.leading_term() for g in gb]
11701171

11711172
if verbose > 1:
11721173
print("%s initial J-pairs" % len(Jpairs))
@@ -1254,8 +1255,8 @@ def groebner_basis_vapote(I, prec, verbose=0, interrupt_red_with_val=False, inte
12541255
sgb.append(p)
12551256

12561257
# We forget signatures
1257-
# gb = [ v.monic() for (s,v) in sgb ]
1258-
gb = [ v for (s,v) in sgb ]
1258+
# gb = [v.monic() for s, v in sgb]
1259+
gb = [v for s, v in sgb]
12591260
if verbose > 1:
12601261
print("%s elements in GB before minimization" % len(gb))
12611262
if verbose > 3:
@@ -1297,7 +1298,7 @@ def groebner_basis_vapote(I, prec, verbose=0, interrupt_red_with_val=False, inte
12971298
for g in gb:
12981299
print("| %s" % g)
12991300
if not integral:
1300-
gb = [ f.monic() for f in gb ]
1301+
gb = [f.monic() for f in gb]
13011302
gb.sort(reverse=True)
13021303

13031304
return gb

0 commit comments

Comments
 (0)