Opened 7 years ago
Closed 7 years ago
#16401 closed enhancement (fixed)
Use FiniteFieldHomomorphism_prime for embeddings of GF(p)
Reported by: | pbruin | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-6.3 |
Component: | finite rings | Keywords: | finite field homomorphism |
Cc: | caruso, jpflori | Merged in: | |
Authors: | Peter Bruin | Reviewers: | Jean-Pierre Flori |
Report Upstream: | N/A | Work issues: | |
Branch: | 7c1595e (Commits, GitHub, GitLab) | Commit: | 7c1595e5f5aa47b6511cc29a1ec66cff34d9a57e |
Dependencies: | Stopgaps: |
Description
Embeddings of finite fields currently do not have consistent types:
sage: F = GF(5) sage: F2 = GF(5^2, conway=True, prefix='z') sage: F4 = GF(5^4, conway=True, prefix='z') sage: f = F2.coerce_map_from(F); f Conversion map: From: Finite Field of size 5 To: Finite Field in z2 of size 5^2 sage: type(f) <type 'sage.structure.coerce_maps.DefaultConvertMap_unique'> sage: g = F4.coerce_map_from(F2); g Ring morphism: From: Finite Field in z2 of size 5^2 To: Finite Field in z4 of size 5^4 Defn: z2 |--> z4^3 + z4^2 + z4 + 3 sage: type(g) <type 'sage.rings.finite_rings.hom_finite_field.FiniteFieldHomomorphism_generic'>
The purpose of this ticket is to make the construction of f
use FiniteFieldHomomorphism_prime
. This will give us more functionality, in particular sections of such embeddings.
Change History (6)
comment:1 Changed 7 years ago by
- Branch set to u/pbruin/16401-hom_prime_finite_field
- Commit set to 7c1595e5f5aa47b6511cc29a1ec66cff34d9a57e
- Status changed from new to needs_review
comment:2 follow-up: ↓ 3 Changed 7 years ago by
comment:3 in reply to: ↑ 2 Changed 7 years ago by
Replying to jpflori:
Any reason for
--- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -267,8 +267,6 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): sage: f(a*b) == f(a) * f(b) True """ - if not self.domain().has_coerce_map_from(x.parent()): - raise TypeError("%s does not coerce to %s" % (x, self.domain())) return x.polynomial()(self.im_gens()[0])
This is the single-underscore _call_()
; if I understand correctly, the double-underscore __call__()
will have done the work to coerce x
into the domain, or to raise an error if this is not possible.
comment:4 Changed 7 years ago by
That's what I would say as well (reminds me of a recent discussion about single vs double underscores on sage-devel).
comment:5 Changed 7 years ago by
- Reviewers set to Jean-Pierre Flori
- Status changed from needs_review to positive_review
Looks good to me. Sorry for the delay.
comment:6 Changed 7 years ago by
- Branch changed from u/pbruin/16401-hom_prime_finite_field to 7c1595e5f5aa47b6511cc29a1ec66cff34d9a57e
- Resolution set to fixed
- Status changed from positive_review to closed
Any reason for
Do you expect an error to be raised when the polynomial is evaluated?