passagemath-ntl 10.6.38__cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-ntl might be problematic. Click here for more details.
- passagemath_ntl/__init__.py +3 -0
- passagemath_ntl-10.6.38.dist-info/METADATA +122 -0
- passagemath_ntl-10.6.38.dist-info/RECORD +162 -0
- passagemath_ntl-10.6.38.dist-info/WHEEL +6 -0
- passagemath_ntl-10.6.38.dist-info/top_level.txt +3 -0
- passagemath_ntl.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
- passagemath_ntl.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
- passagemath_ntl.libs/libmpfi-ad12a86d.so.0.0.0 +0 -0
- passagemath_ntl.libs/libmpfr-9d41ebf1.so.6.2.1 +0 -0
- passagemath_ntl.libs/libntl-1bc30f7e.so.45.0.0 +0 -0
- sage/all__sagemath_ntl.py +7 -0
- sage/libs/all__sagemath_ntl.py +3 -0
- sage/libs/mpfi/__init__.pxd +287 -0
- sage/libs/mpfi/types.pxd +10 -0
- sage/libs/ntl/GF2.pxd +18 -0
- sage/libs/ntl/GF2E.pxd +28 -0
- sage/libs/ntl/GF2EX.pxd +12 -0
- sage/libs/ntl/GF2X.pxd +81 -0
- sage/libs/ntl/ZZ.pxd +93 -0
- sage/libs/ntl/ZZX.pxd +85 -0
- sage/libs/ntl/ZZ_p.pxd +28 -0
- sage/libs/ntl/ZZ_pE.pxd +37 -0
- sage/libs/ntl/ZZ_pEX.pxd +106 -0
- sage/libs/ntl/ZZ_pX.pxd +122 -0
- sage/libs/ntl/__init__.py +4 -0
- sage/libs/ntl/all.py +72 -0
- sage/libs/ntl/conversion.pxd +106 -0
- sage/libs/ntl/convert.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/convert.pxd +7 -0
- sage/libs/ntl/convert.pyx +38 -0
- sage/libs/ntl/decl.pxi +18 -0
- sage/libs/ntl/error.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/error.pyx +63 -0
- sage/libs/ntl/lzz_p.pxd +20 -0
- sage/libs/ntl/lzz_pX.pxd +59 -0
- sage/libs/ntl/mat_GF2.pxd +30 -0
- sage/libs/ntl/mat_GF2E.pxd +30 -0
- sage/libs/ntl/mat_ZZ.pxd +59 -0
- sage/libs/ntl/misc.pxi +33 -0
- sage/libs/ntl/ntl_GF2.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_GF2.pxd +5 -0
- sage/libs/ntl/ntl_GF2.pyx +281 -0
- sage/libs/ntl/ntl_GF2E.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_GF2E.pxd +8 -0
- sage/libs/ntl/ntl_GF2E.pyx +488 -0
- sage/libs/ntl/ntl_GF2EContext.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_GF2EContext.pxd +9 -0
- sage/libs/ntl/ntl_GF2EContext.pyx +134 -0
- sage/libs/ntl/ntl_GF2EX.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_GF2EX.pxd +10 -0
- sage/libs/ntl/ntl_GF2EX.pyx +251 -0
- sage/libs/ntl/ntl_GF2X.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_GF2X.pxd +5 -0
- sage/libs/ntl/ntl_GF2X.pyx +771 -0
- sage/libs/ntl/ntl_GF2X_linkage.pxi +404 -0
- sage/libs/ntl/ntl_ZZ.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ.pxd +7 -0
- sage/libs/ntl/ntl_ZZ.pyx +541 -0
- sage/libs/ntl/ntl_ZZX.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZX.pxd +7 -0
- sage/libs/ntl/ntl_ZZX.pyx +1206 -0
- sage/libs/ntl/ntl_ZZ_p.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ_p.pxd +10 -0
- sage/libs/ntl/ntl_ZZ_p.pyx +509 -0
- sage/libs/ntl/ntl_ZZ_pContext.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ_pContext.pxd +22 -0
- sage/libs/ntl/ntl_ZZ_pContext.pyx +201 -0
- sage/libs/ntl/ntl_ZZ_pE.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ_pE.pxd +11 -0
- sage/libs/ntl/ntl_ZZ_pE.pyx +349 -0
- sage/libs/ntl/ntl_ZZ_pEContext.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ_pEContext.pxd +23 -0
- sage/libs/ntl/ntl_ZZ_pEContext.pyx +226 -0
- sage/libs/ntl/ntl_ZZ_pEX.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ_pEX.pxd +10 -0
- sage/libs/ntl/ntl_ZZ_pEX.pyx +1255 -0
- sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi +420 -0
- sage/libs/ntl/ntl_ZZ_pX.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_ZZ_pX.pxd +17 -0
- sage/libs/ntl/ntl_ZZ_pX.pyx +1532 -0
- sage/libs/ntl/ntl_lzz_p.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_lzz_p.pxd +8 -0
- sage/libs/ntl/ntl_lzz_p.pyx +440 -0
- sage/libs/ntl/ntl_lzz_pContext.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_lzz_pContext.pxd +7 -0
- sage/libs/ntl/ntl_lzz_pContext.pyx +137 -0
- sage/libs/ntl/ntl_lzz_pX.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_lzz_pX.pxd +10 -0
- sage/libs/ntl/ntl_lzz_pX.pyx +902 -0
- sage/libs/ntl/ntl_mat_GF2.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_mat_GF2.pxd +8 -0
- sage/libs/ntl/ntl_mat_GF2.pyx +612 -0
- sage/libs/ntl/ntl_mat_GF2E.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_mat_GF2E.pxd +10 -0
- sage/libs/ntl/ntl_mat_GF2E.pyx +752 -0
- sage/libs/ntl/ntl_mat_ZZ.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/ntl/ntl_mat_ZZ.pxd +6 -0
- sage/libs/ntl/ntl_mat_ZZ.pyx +1523 -0
- sage/libs/ntl/ntl_tools.pxd +3 -0
- sage/libs/ntl/ntlwrap.h +53 -0
- sage/libs/ntl/ntlwrap_impl.h +743 -0
- sage/libs/ntl/types.pxd +157 -0
- sage/libs/ntl/vec_GF2.pxd +26 -0
- sage/libs/ntl/vec_GF2E.pxd +2 -0
- sage/matrix/all__sagemath_ntl.py +1 -0
- sage/matrix/matrix_modn_dense_double.pxd +10 -0
- sage/matrix/matrix_modn_dense_float.pxd +9 -0
- sage/matrix/matrix_modn_dense_template.pxi +3257 -0
- sage/matrix/matrix_modn_dense_template_header.pxi +15 -0
- sage/matrix/matrix_modn_sparse.pxd +8 -0
- sage/misc/all__sagemath_ntl.py +1 -0
- sage/rings/all__sagemath_ntl.py +7 -0
- sage/rings/bernmm.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/bernmm.pyx +161 -0
- sage/rings/bernoulli_mod_p.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/bernoulli_mod_p.pyx +313 -0
- sage/rings/finite_rings/all__sagemath_ntl.py +1 -0
- sage/rings/finite_rings/finite_field_ntl_gf2e.py +305 -0
- sage/rings/finite_rings/residue_field_ntl_gf2e.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/finite_rings/residue_field_ntl_gf2e.pyx +140 -0
- sage/rings/padics/all__sagemath_ntl.py +5 -0
- sage/rings/padics/padic_ZZ_pX_CA_element.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/padics/padic_ZZ_pX_CA_element.pxd +25 -0
- sage/rings/padics/padic_ZZ_pX_CA_element.pyx +2368 -0
- sage/rings/padics/padic_ZZ_pX_CR_element.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/padics/padic_ZZ_pX_CR_element.pxd +33 -0
- sage/rings/padics/padic_ZZ_pX_CR_element.pyx +3277 -0
- sage/rings/padics/padic_ZZ_pX_FM_element.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/padics/padic_ZZ_pX_FM_element.pxd +12 -0
- sage/rings/padics/padic_ZZ_pX_FM_element.pyx +1739 -0
- sage/rings/padics/padic_ZZ_pX_element.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/padics/padic_ZZ_pX_element.pxd +6 -0
- sage/rings/padics/padic_ZZ_pX_element.pyx +919 -0
- sage/rings/padics/padic_ext_element.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/padics/padic_ext_element.pxd +38 -0
- sage/rings/padics/padic_ext_element.pyx +512 -0
- sage/rings/padics/pow_computer_ext.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/padics/pow_computer_ext.pxd +107 -0
- sage/rings/padics/pow_computer_ext.pyx +2401 -0
- sage/rings/polynomial/all__sagemath_ntl.py +1 -0
- sage/rings/polynomial/evaluation_ntl.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/evaluation_ntl.pxd +7 -0
- sage/rings/polynomial/evaluation_ntl.pyx +70 -0
- sage/rings/polynomial/polynomial_gf2x.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_gf2x.pxd +10 -0
- sage/rings/polynomial/polynomial_gf2x.pyx +364 -0
- sage/rings/polynomial/polynomial_integer_dense_ntl.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_integer_dense_ntl.pxd +8 -0
- sage/rings/polynomial/polynomial_integer_dense_ntl.pyx +1128 -0
- sage/rings/polynomial/polynomial_modn_dense_ntl.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_modn_dense_ntl.pxd +36 -0
- sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +2049 -0
- sage/rings/polynomial/polynomial_template.pxi +842 -0
- sage/rings/polynomial/polynomial_template_header.pxi +11 -0
- sage/rings/polynomial/polynomial_zz_pex.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_zz_pex.pxd +12 -0
- sage/rings/polynomial/polynomial_zz_pex.pyx +778 -0
- sage/rings/real_mpfi.pxd +50 -0
- sage/schemes/all__sagemath_ntl.py +1 -0
- sage/schemes/hyperelliptic_curves/all__sagemath_ntl.py +1 -0
- sage/schemes/hyperelliptic_curves/hypellfrob.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/schemes/hyperelliptic_curves/hypellfrob.pyx +252 -0
sage/rings/real_mpfi.pxd
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-ntl
|
|
2
|
+
from sage.libs.mpfr.types cimport mpfr_prec_t
|
|
3
|
+
from sage.libs.mpfi.types cimport mpfi_t
|
|
4
|
+
|
|
5
|
+
from sage.rings.ring cimport Field
|
|
6
|
+
cimport sage.rings.abc
|
|
7
|
+
from sage.structure.element cimport RingElement
|
|
8
|
+
|
|
9
|
+
from sage.rings.rational cimport Rational
|
|
10
|
+
from sage.rings.real_mpfr cimport RealField_class
|
|
11
|
+
|
|
12
|
+
cdef class RealIntervalFieldElement(RingElement) # forward decl
|
|
13
|
+
|
|
14
|
+
cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
|
|
15
|
+
cdef mpfr_prec_t _prec
|
|
16
|
+
cdef bint sci_not
|
|
17
|
+
# Cache RealField instances for the lower, upper, and middle bounds.
|
|
18
|
+
# These have the same precision as the interval field;
|
|
19
|
+
# __lower_field rounds down, __upper_field rounds up.
|
|
20
|
+
# These fields with their roundings are not used for computation
|
|
21
|
+
# in this module, but they do affect the printing and the return
|
|
22
|
+
# values of lower() and upper(). Consider a 3-bit
|
|
23
|
+
# interval containing exactly the floating-point number 1.25.
|
|
24
|
+
# In round-to-nearest or round-down, this prints as 1.2; in round-up,
|
|
25
|
+
# this prints as 1.3. The straightforward options, then, are to
|
|
26
|
+
# print this interval as [1.2 ... 1.2] (which does not even contain
|
|
27
|
+
# the true value, 1.25), or to print it as [1.2 ... 1.3] (which
|
|
28
|
+
# gives the impression that the upper and lower bounds are not
|
|
29
|
+
# equal, even though they really are). Neither of these is very
|
|
30
|
+
# satisfying, but I have chosen the latter for now.
|
|
31
|
+
cdef RealField_class __lower_field
|
|
32
|
+
cdef RealField_class __middle_field
|
|
33
|
+
cdef RealField_class __upper_field
|
|
34
|
+
cdef object _multiplicative_order
|
|
35
|
+
|
|
36
|
+
cdef inline RealIntervalFieldElement _new(self):
|
|
37
|
+
"""Return a new real interval with parent ``self``."""
|
|
38
|
+
t = <type>self.element_class
|
|
39
|
+
return <RealIntervalFieldElement>(t.__new__(t, self))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
cdef class RealIntervalFieldElement(RingElement):
|
|
43
|
+
cdef mpfi_t value
|
|
44
|
+
|
|
45
|
+
cdef inline RealIntervalFieldElement _new(self):
|
|
46
|
+
"""Return a new real interval with same parent as ``self``."""
|
|
47
|
+
return (<RealIntervalField_class>self._parent)._new()
|
|
48
|
+
cdef RealIntervalFieldElement abs(RealIntervalFieldElement self)
|
|
49
|
+
cdef Rational _simplest_rational_helper(self)
|
|
50
|
+
cpdef _str_question_style(self, int base, int error_digits, e, bint prefer_sci)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-ntl
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-ntl
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-ntl
|
|
2
|
+
# distutils: language = c++
|
|
3
|
+
# distutils: sources = sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp
|
|
4
|
+
# distutils: depends = sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.h
|
|
5
|
+
# distutils: include_dirs = sage/libs/ntl/ sage/schemes/hyperelliptic_curves/hypellfrob/ NTL_INCDIR
|
|
6
|
+
# distutils: libraries = gmp NTL_LIBRARIES
|
|
7
|
+
# distutils: extra_compile_args = NTL_CFLAGS
|
|
8
|
+
# distutils: library_dirs = NTL_LIBDIR
|
|
9
|
+
# distutils: extra_link_args = NTL_LIBEXTRA
|
|
10
|
+
# sage.doctest: needs sage.libs.ntl sage.modules sage.rings.padics sage.schemes
|
|
11
|
+
|
|
12
|
+
r"""
|
|
13
|
+
Frobenius on Monsky-Washnitzer cohomology of a hyperelliptic curve
|
|
14
|
+
|
|
15
|
+
This module provides :func:`hypellfrob`, that is a wrapper for the ``matrix()``
|
|
16
|
+
function in ``hypellfrob.cpp``.
|
|
17
|
+
|
|
18
|
+
``hypellfrob.cpp`` is a C++ program for computing the zeta function of a
|
|
19
|
+
hyperelliptic curve over a largish prime finite field, based on the method
|
|
20
|
+
described in the paper [Harv2007]_. More precisely, it computes the matrix of
|
|
21
|
+
Frobenius on the Monsky-Washnitzer cohomology of the curve; the zeta function
|
|
22
|
+
can be recovered via the characteristic polynomial of the matrix.
|
|
23
|
+
|
|
24
|
+
AUTHORS:
|
|
25
|
+
|
|
26
|
+
- David Harvey (2007-05): initial version
|
|
27
|
+
- David Harvey (2007-12): rewrote for ``hypellfrob`` version 2.0
|
|
28
|
+
- Alex J. Best (2018-02): added wrapper
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
# *****************************************************************************
|
|
32
|
+
# Copyright (C) 2007 David Harvey <dmharvey@math.harvard.edu>
|
|
33
|
+
# William Stein <wstein@gmail.com>
|
|
34
|
+
#
|
|
35
|
+
# This program is free software: you can redistribute it and/or modify
|
|
36
|
+
# it under the terms of the GNU General Public License as published by
|
|
37
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
38
|
+
# (at your option) any later version.
|
|
39
|
+
# https://www.gnu.org/licenses/
|
|
40
|
+
# *****************************************************************************
|
|
41
|
+
|
|
42
|
+
from cysignals.signals cimport sig_on, sig_off
|
|
43
|
+
from libcpp.vector cimport vector
|
|
44
|
+
|
|
45
|
+
from sage.libs.ntl.ntl_ZZ_pContext import ZZ_pContext_factory
|
|
46
|
+
from sage.libs.ntl.all import ZZ, ZZX
|
|
47
|
+
from sage.matrix.constructor import Matrix
|
|
48
|
+
from sage.rings.padics.factory import Qp
|
|
49
|
+
from sage.rings.big_oh import O as big_oh
|
|
50
|
+
from sage.arith.misc import is_prime
|
|
51
|
+
|
|
52
|
+
from sage.libs.ntl.ntl_ZZ_p cimport ntl_ZZ_p
|
|
53
|
+
from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
|
|
54
|
+
from sage.libs.ntl.ntl_ZZX cimport ntl_ZZX
|
|
55
|
+
from sage.libs.ntl.ntl_mat_ZZ cimport ntl_mat_ZZ
|
|
56
|
+
from sage.libs.ntl.ntl_ZZ_pContext cimport (ntl_ZZ_pContext_class,
|
|
57
|
+
ntl_ZZ_pContext_factory)
|
|
58
|
+
|
|
59
|
+
from sage.libs.ntl.conversion cimport set_ntl_matrix_modn_dense
|
|
60
|
+
|
|
61
|
+
include "sage/libs/ntl/decl.pxi"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
cdef extern from "hypellfrob.h":
|
|
65
|
+
int hypellfrob_matrix "hypellfrob::matrix" (mat_ZZ_c output, ZZ_c p,
|
|
66
|
+
int N, ZZX_c Q)
|
|
67
|
+
void interval_products_wrapper \
|
|
68
|
+
"hypellfrob::hypellfrob_interval_products_wrapper" \
|
|
69
|
+
(mat_ZZ_p_c &output, const mat_ZZ_p_c &M0, const mat_ZZ_p_c &M1,
|
|
70
|
+
const vector[ZZ_c] target)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def interval_products(M0, M1, target):
|
|
74
|
+
r"""
|
|
75
|
+
Given matrices `M(t)` with entries linear in `t` over `\ZZ/N\ZZ` and a list
|
|
76
|
+
of integers `a_0 < b_0 \le a_1 < b_1 \le \cdots \le a_n < b_n`, compute the
|
|
77
|
+
matrices `\prod_{t = a_i + 1}^{b_i} M(t)` for `i = 0` to `n`.
|
|
78
|
+
|
|
79
|
+
INPUT:
|
|
80
|
+
|
|
81
|
+
- ``M0``, ``M1`` -- matrices over `\ZZ/N\ZZ`, so that `M(t) = M_0 + M_1t`
|
|
82
|
+
- ``target`` -- list of integers `a_0, b_0, \dots, a_n, b_n`
|
|
83
|
+
|
|
84
|
+
ALGORITHM:
|
|
85
|
+
|
|
86
|
+
Described in [Harv2007]_, Theorem 10. Based on the work of Bostan-Gaudry-Schost
|
|
87
|
+
[BGS2007]_.
|
|
88
|
+
|
|
89
|
+
EXAMPLES::
|
|
90
|
+
|
|
91
|
+
sage: from sage.schemes.hyperelliptic_curves.hypellfrob import interval_products
|
|
92
|
+
sage: interval_products(Matrix(Integers(9), 2,2, [1,0,1,0]),
|
|
93
|
+
....: Matrix(Integers(9), 2, 2, [1, 1, 0, 2]),[0,2,2,4])
|
|
94
|
+
[
|
|
95
|
+
[7 8] [5 4]
|
|
96
|
+
[5 1], [2 7]
|
|
97
|
+
]
|
|
98
|
+
sage: [prod(Matrix(Integers(9), 2, 2, [t + 1, t, 1, 2*t])
|
|
99
|
+
....: for t in range(2*i + 1, 2*i + 1 + 2)) for i in range(2)]
|
|
100
|
+
[
|
|
101
|
+
[7 8] [5 4]
|
|
102
|
+
[5 1], [2 7]
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
An example with larger modulus::
|
|
106
|
+
|
|
107
|
+
sage: interval_products(Matrix(Integers(3^8), 1, 1, [1]),
|
|
108
|
+
....: Matrix(Integers(3^8), 1, 1, [1]), [2,4])
|
|
109
|
+
[[20]]
|
|
110
|
+
sage: [prod(Matrix(Integers(3^8), 1, 1, [t + 1]) for t in range(3,5))]
|
|
111
|
+
[[20]]
|
|
112
|
+
|
|
113
|
+
An even larger modulus::
|
|
114
|
+
|
|
115
|
+
sage: interval_products(Matrix(Integers(3^18), 1, 1, [1]),
|
|
116
|
+
....: Matrix(Integers(3^18), 1, 1, [1]), [2,4])
|
|
117
|
+
[[20]]
|
|
118
|
+
sage: [prod(Matrix(Integers(3^18), 1, 1, [t + 1]) for t in range(3,5))]
|
|
119
|
+
[[20]]
|
|
120
|
+
"""
|
|
121
|
+
# Sage objects that wrap the NTL objects
|
|
122
|
+
cdef mat_ZZ_p_c mm0, mm1
|
|
123
|
+
cdef mat_ZZ_p_c out
|
|
124
|
+
cdef vector[ZZ_c] targ
|
|
125
|
+
cdef ntl_ZZ_pContext_class c = \
|
|
126
|
+
(<ntl_ZZ_pContext_factory>ZZ_pContext_factory).make_c(
|
|
127
|
+
ntl_ZZ(M0.base_ring().characteristic()))
|
|
128
|
+
cdef long dim = M0.nrows()
|
|
129
|
+
sig_on()
|
|
130
|
+
c.restore_c()
|
|
131
|
+
sig_off()
|
|
132
|
+
set_ntl_matrix_modn_dense(mm0, c, M0)
|
|
133
|
+
set_ntl_matrix_modn_dense(mm1, c, M1)
|
|
134
|
+
sig_on()
|
|
135
|
+
for t in target:
|
|
136
|
+
targ.push_back(ntl_ZZ(t).x)
|
|
137
|
+
numintervals = len(target)/2
|
|
138
|
+
out.SetDims(dim, dim*numintervals)
|
|
139
|
+
|
|
140
|
+
interval_products_wrapper(out, mm0, mm1, targ)
|
|
141
|
+
sig_off()
|
|
142
|
+
|
|
143
|
+
R = M0.matrix_space()
|
|
144
|
+
mats = [R(0) for k in range(numintervals)]
|
|
145
|
+
cdef ntl_ZZ_p tmp
|
|
146
|
+
tmp = ntl_ZZ_p(modulus=c)
|
|
147
|
+
for k in range(numintervals):
|
|
148
|
+
for j in range(dim):
|
|
149
|
+
for i in range(dim):
|
|
150
|
+
sig_on()
|
|
151
|
+
tmp.x = out.get(j, i + dim * k)
|
|
152
|
+
sig_off()
|
|
153
|
+
mats[k][j, i] = tmp._integer_()
|
|
154
|
+
|
|
155
|
+
return mats
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def hypellfrob(p, N, Q):
|
|
159
|
+
r"""
|
|
160
|
+
Compute the matrix of Frobenius acting on the Monsky-Washnitzer cohomology
|
|
161
|
+
of a hyperelliptic curve `y^2 = Q(x)`, with respect to the basis
|
|
162
|
+
`x^i dx/y`, `0 \leq i < 2g`.
|
|
163
|
+
|
|
164
|
+
INPUT:
|
|
165
|
+
|
|
166
|
+
- ``p`` -- a prime
|
|
167
|
+
- ``Q`` -- a monic polynomial in `\ZZ[x]` of odd degree; must have no
|
|
168
|
+
multiple roots mod `p`
|
|
169
|
+
- ``N`` -- precision parameter; the output matrix will be correct modulo `p^N`
|
|
170
|
+
|
|
171
|
+
The prime `p` should satisfy `p > (2g+1)(2N-1)`, where `g =
|
|
172
|
+
\left(\deg Q - 1\right) / 2` is the genus of the curve.
|
|
173
|
+
|
|
174
|
+
ALGORITHM:
|
|
175
|
+
|
|
176
|
+
Described in [Harv2007]_, Section 7. Running time is theoretically
|
|
177
|
+
`\widetilde{O}(p^{1/2} N^{5/2} g^3)`.
|
|
178
|
+
|
|
179
|
+
EXAMPLES::
|
|
180
|
+
|
|
181
|
+
sage: from sage.schemes.hyperelliptic_curves.hypellfrob import hypellfrob
|
|
182
|
+
sage: R.<x> = PolynomialRing(ZZ)
|
|
183
|
+
sage: f = x^5 + 2*x^2 + x + 1; p = 101
|
|
184
|
+
sage: M = hypellfrob(p, 4, f); M
|
|
185
|
+
[ 91844754 + O(101^4) 38295665 + O(101^4) 44498269 + O(101^4) 11854028 + O(101^4)]
|
|
186
|
+
[ 93514789 + O(101^4) 48987424 + O(101^4) 53287857 + O(101^4) 61431148 + O(101^4)]
|
|
187
|
+
[ 77916046 + O(101^4) 60656459 + O(101^4) 101244586 + O(101^4) 56237448 + O(101^4)]
|
|
188
|
+
[ 58643832 + O(101^4) 81727988 + O(101^4) 85294589 + O(101^4) 70104432 + O(101^4)]
|
|
189
|
+
sage: -M.trace()
|
|
190
|
+
7 + O(101^4)
|
|
191
|
+
sage: sum(legendre_symbol(f(i), p) for i in range(p))
|
|
192
|
+
7
|
|
193
|
+
sage: ZZ(M.det())
|
|
194
|
+
10201
|
|
195
|
+
sage: M = hypellfrob(p, 1, f); M
|
|
196
|
+
[ O(101) O(101) 93 + O(101) 62 + O(101)]
|
|
197
|
+
[ O(101) O(101) 55 + O(101) 19 + O(101)]
|
|
198
|
+
[ O(101) O(101) 65 + O(101) 42 + O(101)]
|
|
199
|
+
[ O(101) O(101) 89 + O(101) 29 + O(101)]
|
|
200
|
+
|
|
201
|
+
.. TODO::
|
|
202
|
+
|
|
203
|
+
Remove the restriction on `p`. Probably by merging in Robert's code,
|
|
204
|
+
which eventually needs a fast C++/NTL implementation.
|
|
205
|
+
"""
|
|
206
|
+
# Sage objects that wrap the NTL objects
|
|
207
|
+
cdef ntl_ZZ pp
|
|
208
|
+
cdef ntl_ZZX QQ
|
|
209
|
+
cdef ntl_mat_ZZ mm # the result will go in mm
|
|
210
|
+
cdef int i, j
|
|
211
|
+
|
|
212
|
+
if N < 1:
|
|
213
|
+
raise ValueError("N must be an integer >= 1")
|
|
214
|
+
|
|
215
|
+
Q = Q.list()
|
|
216
|
+
if len(Q) < 4 or len(Q) % 2 or Q[-1] != 1:
|
|
217
|
+
raise ValueError("Q must be a monic polynomial of odd degree >= 3")
|
|
218
|
+
QQ = ZZX(Q)
|
|
219
|
+
|
|
220
|
+
bound = (len(Q) - 1) * (2*N - 1)
|
|
221
|
+
if p <= bound:
|
|
222
|
+
raise ValueError("In the current implementation, p must be greater "
|
|
223
|
+
"than (2g+1)(2N-1) = %s" % bound)
|
|
224
|
+
|
|
225
|
+
if not is_prime(p):
|
|
226
|
+
raise ValueError("p (= %s) must be prime" % p)
|
|
227
|
+
|
|
228
|
+
pp = ZZ(p)
|
|
229
|
+
|
|
230
|
+
cdef int g # the genus
|
|
231
|
+
g = (len(Q) / 2) - 1
|
|
232
|
+
|
|
233
|
+
# Note: the C++ code actually resets the size of the matrix, but this seems
|
|
234
|
+
# to confuse the Sage NTL wrapper. So to be safe I'm setting it ahead of
|
|
235
|
+
# time.
|
|
236
|
+
mm = ntl_mat_ZZ(2 * g, 2 * g)
|
|
237
|
+
|
|
238
|
+
cdef int result
|
|
239
|
+
sig_on()
|
|
240
|
+
cdef mat_ZZ_c *mm_x = &mm.x # workaround for Cython misfeature
|
|
241
|
+
result = hypellfrob_matrix(mm_x[0], pp.x, N, QQ.x)
|
|
242
|
+
sig_off()
|
|
243
|
+
|
|
244
|
+
if not result:
|
|
245
|
+
raise ValueError("Could not compute frobenius matrix"
|
|
246
|
+
", because the curve is singular at p.")
|
|
247
|
+
|
|
248
|
+
R = Qp(p, N, print_mode='terse')
|
|
249
|
+
prec = big_oh(p**N)
|
|
250
|
+
data = [[mm[j, i]._integer_() + prec for i in range(2 * g)]
|
|
251
|
+
for j in range(2 * g)]
|
|
252
|
+
return Matrix(R, data)
|