Skip to content

Commit 283a86e

Browse files
committed
Check effective divisor degree depending on the model
1 parent 8a972c4 commit 283a86e

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/sage/rings/function_field/jacobian_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def __call__(self, x):
668668
if x in F.divisor_group():
669669
G = self.group()
670670
return G.point(x)
671-
raise ValueError(f"Cannot create a point of the Jacobian from {x}")
671+
raise ValueError(f"cannot create a point of the Jacobian from {x}")
672672

673673
def curve(self):
674674
"""

src/sage/rings/function_field/jacobian_hess.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def _element_constructor_(self, x):
606606
"""
607607
Construct an element of ``self`` from ``x``.
608608
609-
If ``x`` is an effective divisor, then it is assumed to of
609+
If ``x`` is an effective divisor, then it is assumed to be of
610610
degree `g`, the genus of the function field.
611611
612612
EXAMPLES::
@@ -634,9 +634,11 @@ def _element_constructor_(self, x):
634634
if x.degree() == 0:
635635
return self.point(x)
636636
if x.is_effective():
637+
if x.degree() != self._genus:
638+
raise ValueError(f"effective divisor is not of degree {self._genus}")
637639
return self.element_class(self, *self._get_dS_ds(x))
638640

639-
raise ValueError(f"Cannot construct a point from {x}")
641+
raise ValueError(f"cannot construct a point from {x}")
640642

641643
def _get_dS_ds(self, divisor):
642644
"""
@@ -805,6 +807,8 @@ def point(self, divisor):
805807
sage: G.point(p - b)
806808
[Place (y + 2, z + 1)]
807809
"""
810+
if divisor.degree() != 0:
811+
raise ValueError('divisor not of degree zero')
808812
c = divisor + self._base_div
809813
f = c.basis_function_space()[0]
810814
d = f.divisor() + c

src/sage/rings/function_field/jacobian_khuri_makdisi.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ def __init__(self, parent, function_field, base_div):
619619

620620
D0 = base_div
621621

622+
self._base_div_degree = base_div.degree()
622623
self._V_cache = 10*[None]
623624

624625
V_cache = self._V_cache
@@ -760,10 +761,12 @@ def _element_constructor_(self, x):
760761
if x.degree() == 0:
761762
return self.point(x)
762763
if x.is_effective():
764+
if x.degree() != self._base_div_degree:
765+
raise ValueError(f"effective divisor is not of degree {self._base_div_degree}")
763766
wd = self._wd_from_divisor(x)
764767
return self.element_class(self, wd)
765768

766-
raise ValueError(f"Cannot construct a point from {x}")
769+
raise ValueError(f"cannot construct a point from {x}")
767770

768771
def point(self, divisor):
769772
"""

0 commit comments

Comments
 (0)