Skip to content

Commit b192330

Browse files
committed
Avoid non-invertible scaling and zero endomorphism
1 parent 209ae4c commit b192330

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ def rank(self):
18551855

18561856
def velu(self, isog):
18571857
r"""
1858-
Return a new Drinfeld module such that input is an
1858+
Return a new Drinfeld module such that ``isog`` defines an
18591859
isogeny to this module with domain ``self``; if no such isogeny
18601860
exists, raise an exception.
18611861
@@ -2018,11 +2018,19 @@ def hom(self, x, codomain=None):
20182018
Traceback (most recent call last):
20192019
...
20202020
ValueError: Ore polynomial does not define a morphism
2021+
2022+
Check that x = 0 (without specified codomain) gives the zero endomorphism::
2023+
2024+
sage: phi.hom(K.zero())
2025+
Endomorphism of Drinfeld module defined by ...
2026+
Defn: 0
20212027
"""
20222028
# When `x` is in the function ring (or something that coerces to it):
20232029
if self.function_ring().has_coerce_map_from(x.parent()):
20242030
return self.Hom(self)(x)
20252031
if codomain is None:
2032+
if x.is_zero():
2033+
return self.Hom(self)(0)
20262034
try:
20272035
codomain = self.velu(x)
20282036
except TypeError:

src/sage/rings/function_field/drinfeld_modules/morphism.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,11 @@ def __invert__(self):
536536
sage: K.<z> = Fq.extension(3)
537537
sage: coeffs = [z] + [K.random_element() for _ in range(10)]
538538
sage: phi = DrinfeldModule(A, coeffs)
539-
sage: f = phi.hom(K.random_element())
539+
sage: a = K.random_element()
540+
sage: while a.is_zero():
541+
....: a = K.random_element()
542+
sage: f = phi.hom(a)
540543
sage: g = ~f
541-
542544
sage: (f*g).is_identity()
543545
True
544546
sage: (g*f).is_identity()

0 commit comments

Comments
 (0)