Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sage/rings/function_field/jacobian_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def __init__(self, parent, function_field, base_div) -> None:
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
sage: J = C.jacobian(model='hess')
sage: G = J.group()
sage: TestSuite(G).run(skip=['_test_elements', '_test_pickling'])
sage: TestSuite(G).run()
"""
super().__init__(base=IntegerRing(), category=CommutativeAdditiveGroups())

Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/function_field/jacobian_hess.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, parent, dS, ds) -> None:
sage: G = C.jacobian(model='hess', base_div=b).group()
sage: pl = C([1,8,1]).place()
sage: p = G.point(pl - b)
sage: TestSuite(p).run(skip=['_test_category','_test_pickling'])
sage: TestSuite(p).run()
"""
super().__init__(parent)
self._data = (dS, ds)
Expand Down Expand Up @@ -570,7 +570,7 @@ def __init__(self, parent, function_field, base_div) -> None:
sage: b = C([0,1,0]).place()
sage: J = C.jacobian(model='hess', base_div=b)
sage: G = J.group()
sage: TestSuite(G).run(skip=['_test_elements', '_test_pickling'])
sage: TestSuite(G).run()
"""
super().__init__(parent, function_field, base_div)

Expand Down Expand Up @@ -876,7 +876,7 @@ def __init__(self, parent, function_field, base_div) -> None:
sage: b = C([0,1,0]).place()
sage: J = C.jacobian(model='hess', base_div=b)
sage: G = J.group()
sage: TestSuite(G).run(skip=['_test_elements','_test_pickling'])
sage: TestSuite(G).run()
"""
super().__init__(parent, function_field, base_div)

Expand Down Expand Up @@ -1023,7 +1023,7 @@ def __init__(self, function_field, base_div, **kwds) -> None:
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
sage: b = C([0,1,0]).place()
sage: J = C.jacobian(model='hess', base_div=b)
sage: TestSuite(J).run(skip=['_test_elements','_test_pickling'])
sage: TestSuite(J).run()
"""
super().__init__(function_field, base_div, **kwds)

Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/function_field/jacobian_khuri_makdisi.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(self, parent, w) -> None:
sage: G = J.group()
sage: pl = C([3,2,1]).place()
sage: p = G.point(pl - b)
sage: TestSuite(p).run(skip=['_test_category','_test_pickling'])
sage: TestSuite(p).run()
"""
super().__init__(parent)
w.set_immutable()
Expand Down Expand Up @@ -867,7 +867,7 @@ def __init__(self, parent, function_field, base_div) -> None:
sage: h = C.function(y/x).divisor_of_poles()
sage: J = C.jacobian(model='km_large', base_div=h)
sage: G = J.group()
sage: TestSuite(G).run(skip=['_test_elements', '_test_pickling'])
sage: TestSuite(G).run()
"""
super().__init__(parent, function_field, base_div)

Expand Down Expand Up @@ -988,7 +988,7 @@ def __init__(self, function_field, base_div, model, **kwds) -> None:
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
sage: J = C.jacobian(model='km_large')
sage: TestSuite(J).run(skip=['_test_elements', '_test_pickling'])
sage: TestSuite(J).run()

::

Expand Down
90 changes: 65 additions & 25 deletions src/sage/schemes/curves/projective_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@
from builtins import sum as add

from sage.categories.fields import Fields
from sage.categories.homset import hom, Hom, End
from sage.categories.homset import End, Hom, hom
from sage.categories.number_fields import NumberFields
from sage.libs.singular.function import singular_function, lib as singular_lib, get_printlevel, set_printlevel
from sage.libs.singular.function import get_printlevel, set_printlevel, singular_function
from sage.libs.singular.function import lib as singular_lib
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute
Expand All @@ -154,23 +155,22 @@
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.rational_field import RationalField
from sage.schemes.projective.projective_space import ProjectiveSpace, ProjectiveSpace_ring
from sage.schemes.projective.projective_subscheme import (AlgebraicScheme_subscheme_projective,
AlgebraicScheme_subscheme_projective_field)
from sage.schemes.projective.projective_subscheme import AlgebraicScheme_subscheme_projective, AlgebraicScheme_subscheme_projective_field

lazy_import('sage.interfaces.singular', 'singular')
lazy_import('sage.rings.number_field.number_field', 'NumberField')

from .curve import Curve_generic

from .point import (ProjectiveCurvePoint_field,
ProjectivePlaneCurvePoint_field,
ProjectivePlaneCurvePoint_finite_field,
IntegralProjectiveCurvePoint,
IntegralProjectiveCurvePoint_finite_field,
IntegralProjectivePlaneCurvePoint,
IntegralProjectivePlaneCurvePoint_finite_field)

from .closed_point import IntegralProjectiveCurveClosedPoint
from .curve import Curve_generic
from .point import (
IntegralProjectiveCurvePoint,
IntegralProjectiveCurvePoint_finite_field,
IntegralProjectivePlaneCurvePoint,
IntegralProjectivePlaneCurvePoint_finite_field,
ProjectiveCurvePoint_field,
ProjectivePlaneCurvePoint_field,
ProjectivePlaneCurvePoint_finite_field,
)


class ProjectiveCurve(Curve_generic, AlgebraicScheme_subscheme_projective):
Expand Down Expand Up @@ -1449,7 +1449,7 @@ def ordinary_model(self):
+ (1/16*a + 1/16)*x*y*z^2 + (3/16*a + 3/16)*y^2*z^2
+ (-3/16*a - 1/4)*y*z^3 + (1/16*a + 3/32)*z^4)
"""
from sage.rings.qqbar import number_field_elements_from_algebraics, QQbar
from sage.rings.qqbar import QQbar, number_field_elements_from_algebraics

def extension(self):
# helper function for extending the base field
Expand All @@ -1459,13 +1459,12 @@ def extension(self):
K = number_field_elements_from_algebraics(L)[0]
if isinstance(K, RationalField):
return F.embeddings(F)[0]
elif isinstance(F, RationalField):
return F.embeddings(K)[0]
else:
if isinstance(F, RationalField):
return F.embeddings(K)[0]
else:
# make sure the defining polynomial variable names are the same for K, N
N = NumberField(K.defining_polynomial().parent()(F.defining_polynomial()), str(K.gen()))
return N.composite_fields(K, both_maps=True)[0][1]*F.embeddings(N)[0]
# make sure the defining polynomial variable names are the same for K, N
N = NumberField(K.defining_polynomial().parent()(F.defining_polynomial()), str(K.gen()))
return N.composite_fields(K, both_maps=True)[0][1]*F.embeddings(N)[0]
if self.base_ring() not in NumberFields():
raise NotImplementedError("the base ring of this curve must be a number field")
if not self.is_irreducible():
Expand Down Expand Up @@ -2374,8 +2373,12 @@ def random_element(self):
sage: P in C
True
"""
from sage.schemes.elliptic_curves.ell_finite_field import EllipticCurve_finite_field
from sage.schemes.hyperelliptic_curves.hyperelliptic_finite_field import HyperellipticCurve_finite_field
from sage.schemes.elliptic_curves.ell_finite_field import (
EllipticCurve_finite_field,
)
from sage.schemes.hyperelliptic_curves.hyperelliptic_finite_field import (
HyperellipticCurve_finite_field,
)
if not isinstance(self, (EllipticCurve_finite_field, HyperellipticCurve_finite_field)):
raise NotImplementedError("only implemented for elliptic and hyperelliptic curves over finite fields")

Expand Down Expand Up @@ -2417,17 +2420,54 @@ def __init__(self, A, f):
True
"""
super().__init__(A, f)

ideal = self.defining_ideal()
gs = self.ambient_space().gens()
for i in range(self.ngens()):
if gs[i] not in ideal:
self._open_affine = self.affine_patch(i)
self._open_affine_index = i
break
else:
raise ValueError("no projective curve defined")

@lazy_attribute
def _open_affine(self):
r"""
An affine patch of the curve.

TESTS::

sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
sage: C._open_affine
Affine Plane Curve over Finite Field of size 7 defined by -y^2*z - 2*z^3 + 1
"""
return self.affine_patch(self._open_affine_index)

def __getstate__(self):
r"""
Remove some attributes that cause issues before pickling.
These are easily recomputed anyway.

TESTS::

sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
sage: C._open_affine is not None
True
sage: C._map_from_function_field is not None
True
sage: loaded = loads(dumps(C))
sage: loaded == C
True
sage: loaded._open_affine == C._open_affine
True
"""
state = super().__getstate__()
# We don't use del in case these properties haven't been accessed and cached yet
state.pop('_open_affine', None)
state.pop('_map_from_function_field', None)
return state

def function_field(self):
"""
Return the function field of this curve.
Expand Down
Loading