Skip to content

Commit a1e4409

Browse files
author
Matthias Koeppe
committed
sage.rings.finite_rings: ./sage -fixdoctests --only-tags
1 parent d1f5704 commit a1e4409

File tree

3 files changed

+88
-86
lines changed

3 files changed

+88
-86
lines changed

src/sage/rings/finite_rings/hom_finite_field.pyx

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# sage.doctest: optional - sage.rings.finite_rings
12
"""
23
Finite field morphisms
34
@@ -13,8 +14,8 @@ EXAMPLES::
1314
1415
Construction of an embedding::
1516
16-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
17-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
17+
sage: k.<t> = GF(3^7)
18+
sage: K.<T> = GF(3^21)
1819
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K)); f
1920
Ring morphism:
2021
From: Finite Field in t of size 3^7
@@ -44,8 +45,8 @@ map which is the inverse of `f` on the image of `f`::
4445
4546
There is no embedding of `GF(5^6)` into `GF(5^11)`::
4647
47-
sage: k.<t> = GF(5^6) # optional - sage.rings.finite_rings
48-
sage: K.<T> = GF(5^11) # optional - sage.rings.finite_rings
48+
sage: k.<t> = GF(5^6)
49+
sage: K.<T> = GF(5^11)
4950
sage: FiniteFieldHomomorphism_generic(Hom(k, K))
5051
Traceback (most recent call last):
5152
...
@@ -54,7 +55,7 @@ There is no embedding of `GF(5^6)` into `GF(5^11)`::
5455
5556
Construction of Frobenius endomorphisms::
5657
57-
sage: k.<t> = GF(7^14) # optional - sage.rings.finite_rings
58+
sage: k.<t> = GF(7^14)
5859
sage: Frob = k.frobenius_endomorphism(); Frob
5960
Frobenius endomorphism t |--> t^7 on Finite Field in t of size 7^14
6061
sage: Frob(t)
@@ -125,8 +126,8 @@ cdef class SectionFiniteFieldHomomorphism_generic(Section):
125126
TESTS::
126127
127128
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
128-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
129-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
129+
sage: k.<t> = GF(3^7)
130+
sage: K.<T> = GF(3^21)
130131
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
131132
sage: g = f.section()
132133
sage: g(f(t^3+t^2+1))
@@ -153,8 +154,8 @@ cdef class SectionFiniteFieldHomomorphism_generic(Section):
153154
EXAMPLES::
154155
155156
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
156-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
157-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
157+
sage: k.<t> = GF(3^7)
158+
sage: K.<T> = GF(3^21)
158159
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
159160
sage: g = f.section()
160161
sage: g._repr_()
@@ -170,8 +171,8 @@ cdef class SectionFiniteFieldHomomorphism_generic(Section):
170171
EXAMPLES::
171172
172173
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
173-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
174-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
174+
sage: k.<t> = GF(3^7)
175+
sage: K.<T> = GF(3^21)
175176
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
176177
sage: g = f.section()
177178
sage: g._latex_()
@@ -188,8 +189,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
188189
TESTS::
189190
190191
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
191-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
192-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
192+
sage: k.<t> = GF(3^7)
193+
sage: K.<T> = GF(3^21)
193194
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
194195
sage: TestSuite(f).run()
195196
@@ -199,16 +200,16 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
199200
TESTS::
200201
201202
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
202-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
203-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
203+
sage: k.<t> = GF(3^7)
204+
sage: K.<T> = GF(3^21)
204205
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K)); f
205206
Ring morphism:
206207
From: Finite Field in t of size 3^7
207208
To: Finite Field in T of size 3^21
208209
Defn: t |--> T^20 + 2*T^18 + T^16 + 2*T^13 + T^9 + 2*T^8 + T^7 + T^6 + T^5 + T^3 + 2*T^2 + T
209210
210-
sage: k.<t> = GF(3^6) # optional - sage.rings.finite_rings
211-
sage: K.<t> = GF(3^9) # optional - sage.rings.finite_rings
211+
sage: k.<t> = GF(3^6)
212+
sage: K.<t> = GF(3^9)
212213
sage: FiniteFieldHomomorphism_generic(Hom(k, K))
213214
Traceback (most recent call last):
214215
...
@@ -249,8 +250,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
249250
TESTS::
250251
251252
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
252-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
253-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
253+
sage: k.<t> = GF(3^7)
254+
sage: K.<T> = GF(3^21)
254255
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
255256
sage: g = copy(f)
256257
sage: g.section()(g(t)) == f.section()(f(t))
@@ -282,8 +283,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
282283
EXAMPLES::
283284
284285
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
285-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
286-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
286+
sage: k.<t> = GF(3^7)
287+
sage: K.<T> = GF(3^21)
287288
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
288289
sage: f._latex_()
289290
'\\Bold{F}_{3^{7}} \\hookrightarrow \\Bold{F}_{3^{21}}'
@@ -295,8 +296,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
295296
TESTS::
296297
297298
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
298-
sage: k.<t> = GF(3^3) # optional - sage.rings.finite_rings
299-
sage: K.<T> = GF(3^9) # optional - sage.rings.finite_rings
299+
sage: k.<t> = GF(3^3)
300+
sage: K.<T> = GF(3^9)
300301
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
301302
sage: f(t)
302303
2*T^6 + 2*T^4 + T^2 + T
@@ -323,8 +324,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
323324
EXAMPLES::
324325
325326
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
326-
sage: k.<t> = GF(3^3) # optional - sage.rings.finite_rings
327-
sage: K.<T> = GF(3^9) # optional - sage.rings.finite_rings
327+
sage: k.<t> = GF(3^3)
328+
sage: K.<T> = GF(3^9)
328329
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
329330
sage: f.is_injective()
330331
True
@@ -340,8 +341,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
340341
EXAMPLES::
341342
342343
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
343-
sage: k.<t> = GF(3^3) # optional - sage.rings.finite_rings
344-
sage: K.<T> = GF(3^9) # optional - sage.rings.finite_rings
344+
sage: k.<t> = GF(3^3)
345+
sage: K.<T> = GF(3^9)
345346
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
346347
sage: f.is_surjective()
347348
False
@@ -364,8 +365,8 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
364365
EXAMPLES::
365366
366367
sage: from sage.rings.finite_rings.hom_finite_field import FiniteFieldHomomorphism_generic
367-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
368-
sage: K.<T> = GF(3^21) # optional - sage.rings.finite_rings
368+
sage: k.<t> = GF(3^7)
369+
sage: K.<T> = GF(3^21)
369370
sage: f = FiniteFieldHomomorphism_generic(Hom(k, K))
370371
sage: g = f.section(); g
371372
Section of Ring morphism:
@@ -395,7 +396,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
395396
396397
EXAMPLES::
397398
398-
sage: k.<t> = GF(3^7) # optional - sage.rings.finite_rings
399+
sage: k.<t> = GF(3^7)
399400
sage: K.<T>, f = k.extension(3, map=True)
400401
sage: b = f(t^2); b
401402
2*T^20 + 2*T^19 + T^18 + T^15 + 2*T^14 + 2*T^13 + 2*T^12 + T^8 + 2*T^6 + T^5 + 2*T^4 + T^3 + 2*T^2 + T
@@ -417,7 +418,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
417418
418419
TESTS::
419420
420-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
421+
sage: k.<t> = GF(5^3)
421422
sage: Frob = k.frobenius_endomorphism()
422423
sage: embed = Frob.fixed_field()[1]
423424
sage: hash(embed) # random
@@ -431,7 +432,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
431432
432433
TESTS::
433434
434-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
435+
sage: k.<t> = GF(5^3)
435436
sage: Frob = k.frobenius_endomorphism()
436437
sage: embed = Frob.fixed_field()[1]
437438
sage: embed.__reduce__() # indirect doctest
@@ -459,7 +460,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens):
459460
460461
TESTS::
461462
462-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
463+
sage: k.<t> = GF(5^3)
463464
sage: Frob = k.frobenius_endomorphism()
464465
sage: embed = Frob.fixed_field()[1]
465466
sage: f = loads(dumps(embed))
@@ -481,7 +482,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
481482
482483
TESTS::
483484
484-
sage: k.<a> = GF(7^11) # optional - sage.rings.finite_rings
485+
sage: k.<a> = GF(7^11)
485486
sage: Frob = k.frobenius_endomorphism(5)
486487
sage: TestSuite(Frob).run()
487488
@@ -506,7 +507,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
506507
TESTS::
507508
508509
sage: from sage.rings.finite_rings.hom_finite_field import FrobeniusEndomorphism_finite_field
509-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
510+
sage: k.<t> = GF(5^3)
510511
sage: FrobeniusEndomorphism_finite_field(k)
511512
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^3
512513
sage: FrobeniusEndomorphism_finite_field(k, 2)
@@ -543,7 +544,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
543544
544545
EXAMPLES::
545546
546-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
547+
sage: k.<t> = GF(5^3)
547548
sage: Frob = k.frobenius_endomorphism(); Frob
548549
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^3
549550
@@ -567,7 +568,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
567568
568569
EXAMPLES::
569570
570-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
571+
sage: k.<t> = GF(5^3)
571572
sage: Frob = k.frobenius_endomorphism(); Frob
572573
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^3
573574
@@ -590,7 +591,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
590591
591592
EXAMPLES::
592593
593-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
594+
sage: k.<t> = GF(5^3)
594595
sage: Frob = k.frobenius_endomorphism()
595596
sage: Frob._latex_()
596597
't \\mapsto t^{5}'
@@ -612,7 +613,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
612613
"""
613614
TESTS::
614615
615-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
616+
sage: k.<t> = GF(5^3)
616617
sage: Frob = k.frobenius_endomorphism()
617618
sage: Frob(t)
618619
2*t^2 + 4*t + 4
@@ -631,7 +632,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
631632
632633
EXAMPLES::
633634
634-
sage: k.<t> = GF(5^12) # optional - sage.rings.finite_rings
635+
sage: k.<t> = GF(5^12)
635636
sage: Frob = k.frobenius_endomorphism()
636637
sage: Frob.order()
637638
12
@@ -654,7 +655,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
654655
655656
EXAMPLES::
656657
657-
sage: k.<t> = GF(5^12) # optional - sage.rings.finite_rings
658+
sage: k.<t> = GF(5^12)
658659
sage: Frob = k.frobenius_endomorphism()
659660
sage: Frob.power()
660661
1
@@ -672,7 +673,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
672673
673674
EXAMPLES::
674675
675-
sage: k.<t> = GF(5^12) # optional - sage.rings.finite_rings
676+
sage: k.<t> = GF(5^12)
676677
sage: Frob = k.frobenius_endomorphism(); Frob
677678
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^12
678679
sage: Frob^2
@@ -694,7 +695,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
694695
695696
EXAMPLES::
696697
697-
sage: k.<a> = GF(7^11) # optional - sage.rings.finite_rings
698+
sage: k.<a> = GF(7^11)
698699
sage: f = k.frobenius_endomorphism(5)
699700
sage: (f.inverse() * f).is_identity()
700701
True
@@ -707,7 +708,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
707708
708709
EXAMPLES::
709710
710-
sage: k.<t> = GF(5^12) # optional - sage.rings.finite_rings
711+
sage: k.<t> = GF(5^12)
711712
sage: f = k.frobenius_endomorphism(); f
712713
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^12
713714
sage: g = k.frobenius_endomorphism(2); g
@@ -745,7 +746,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
745746
746747
EXAMPLES::
747748
748-
sage: k.<t> = GF(5^6) # optional - sage.rings.finite_rings
749+
sage: k.<t> = GF(5^6)
749750
sage: f = k.frobenius_endomorphism(2)
750751
sage: kfixed, embed = f.fixed_field()
751752
sage: kfixed
@@ -778,7 +779,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
778779
779780
EXAMPLES::
780781
781-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
782+
sage: k.<t> = GF(5^3)
782783
sage: Frob = k.frobenius_endomorphism()
783784
sage: Frob.is_injective()
784785
True
@@ -793,7 +794,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
793794
794795
EXAMPLES::
795796
796-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
797+
sage: k.<t> = GF(5^3)
797798
sage: Frob = k.frobenius_endomorphism()
798799
sage: Frob.is_surjective()
799800
True
@@ -807,7 +808,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
807808
808809
EXAMPLES::
809810
810-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
811+
sage: k.<t> = GF(5^3)
811812
sage: Frob = k.frobenius_endomorphism()
812813
sage: Frob.is_identity()
813814
False
@@ -822,7 +823,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
822823
823824
EXAMPLES::
824825
825-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
826+
sage: k.<t> = GF(5^3)
826827
sage: Frob = k.frobenius_endomorphism()
827828
sage: hash(Frob) # random
828829
383183030479672104
@@ -835,7 +836,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic):
835836
836837
TESTS::
837838
838-
sage: k.<t> = GF(5^3) # optional - sage.rings.finite_rings
839+
sage: k.<t> = GF(5^3)
839840
sage: Frob = k.frobenius_endomorphism(2)
840841
sage: Frob
841842
Frobenius endomorphism t |--> t^(5^2) on Finite Field in t of size 5^3

src/sage/rings/finite_rings/hom_prime_finite_field.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ cdef class FiniteFieldHomomorphism_prime(FiniteFieldHomomorphism_generic):
5454
sage: from sage.rings.finite_rings.hom_prime_finite_field import FiniteFieldHomomorphism_prime
5555
sage: k = GF(3)
5656
sage: K.<T> = GF(3^4) # optional - sage.rings.finite_rings
57-
sage: f = FiniteFieldHomomorphism_prime(Hom(k, K)); f
57+
sage: f = FiniteFieldHomomorphism_prime(Hom(k, K)); f # optional - sage.rings.finite_rings
5858
Ring morphism:
5959
From: Finite Field of size 3
6060
To: Finite Field in T of size 3^4
6161
Defn: 1 |--> 1
6262
6363
sage: k.<t> = GF(3^2) # optional - sage.rings.finite_rings
6464
sage: K.<T> = GF(3^4) # optional - sage.rings.finite_rings
65-
sage: f = FiniteFieldHomomorphism_prime(Hom(k, K)); f
65+
sage: f = FiniteFieldHomomorphism_prime(Hom(k, K)); f # optional - sage.rings.finite_rings
6666
Traceback (most recent call last):
6767
...
6868
TypeError: The domain is not a finite prime field
@@ -82,7 +82,7 @@ cdef class FiniteFieldHomomorphism_prime(FiniteFieldHomomorphism_generic):
8282
sage: from sage.rings.finite_rings.hom_prime_finite_field import FiniteFieldHomomorphism_prime
8383
sage: k = GF(3)
8484
sage: K.<t> = GF(3^5) # optional - sage.rings.finite_rings
85-
sage: f = FiniteFieldHomomorphism_prime(Hom(k, K))
85+
sage: f = FiniteFieldHomomorphism_prime(Hom(k, K)) # optional - sage.rings.finite_rings
8686
sage: a = f(4); a
8787
1
8888
sage: a.parent()

0 commit comments

Comments
 (0)