passagemath-ntl 10.6.36__cp314-cp314t-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.
Files changed (161) hide show
  1. passagemath_ntl-10.6.36.dist-info/METADATA +122 -0
  2. passagemath_ntl-10.6.36.dist-info/RECORD +161 -0
  3. passagemath_ntl-10.6.36.dist-info/WHEEL +6 -0
  4. passagemath_ntl-10.6.36.dist-info/top_level.txt +2 -0
  5. passagemath_ntl.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
  6. passagemath_ntl.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
  7. passagemath_ntl.libs/libmpfi-ad12a86d.so.0.0.0 +0 -0
  8. passagemath_ntl.libs/libmpfr-9d41ebf1.so.6.2.1 +0 -0
  9. passagemath_ntl.libs/libntl-0043a3a2.so.44.0.1 +0 -0
  10. sage/all__sagemath_ntl.py +7 -0
  11. sage/libs/all__sagemath_ntl.py +3 -0
  12. sage/libs/mpfi/__init__.pxd +287 -0
  13. sage/libs/mpfi/types.pxd +10 -0
  14. sage/libs/ntl/GF2.pxd +18 -0
  15. sage/libs/ntl/GF2E.pxd +28 -0
  16. sage/libs/ntl/GF2EX.pxd +12 -0
  17. sage/libs/ntl/GF2X.pxd +81 -0
  18. sage/libs/ntl/ZZ.pxd +93 -0
  19. sage/libs/ntl/ZZX.pxd +85 -0
  20. sage/libs/ntl/ZZ_p.pxd +28 -0
  21. sage/libs/ntl/ZZ_pE.pxd +37 -0
  22. sage/libs/ntl/ZZ_pEX.pxd +106 -0
  23. sage/libs/ntl/ZZ_pX.pxd +122 -0
  24. sage/libs/ntl/__init__.py +4 -0
  25. sage/libs/ntl/all.py +72 -0
  26. sage/libs/ntl/conversion.pxd +106 -0
  27. sage/libs/ntl/convert.cpython-314t-aarch64-linux-gnu.so +0 -0
  28. sage/libs/ntl/convert.pxd +7 -0
  29. sage/libs/ntl/convert.pyx +38 -0
  30. sage/libs/ntl/decl.pxi +18 -0
  31. sage/libs/ntl/error.cpython-314t-aarch64-linux-gnu.so +0 -0
  32. sage/libs/ntl/error.pyx +63 -0
  33. sage/libs/ntl/lzz_p.pxd +20 -0
  34. sage/libs/ntl/lzz_pX.pxd +59 -0
  35. sage/libs/ntl/mat_GF2.pxd +30 -0
  36. sage/libs/ntl/mat_GF2E.pxd +30 -0
  37. sage/libs/ntl/mat_ZZ.pxd +59 -0
  38. sage/libs/ntl/misc.pxi +33 -0
  39. sage/libs/ntl/ntl_GF2.cpython-314t-aarch64-linux-gnu.so +0 -0
  40. sage/libs/ntl/ntl_GF2.pxd +5 -0
  41. sage/libs/ntl/ntl_GF2.pyx +281 -0
  42. sage/libs/ntl/ntl_GF2E.cpython-314t-aarch64-linux-gnu.so +0 -0
  43. sage/libs/ntl/ntl_GF2E.pxd +8 -0
  44. sage/libs/ntl/ntl_GF2E.pyx +488 -0
  45. sage/libs/ntl/ntl_GF2EContext.cpython-314t-aarch64-linux-gnu.so +0 -0
  46. sage/libs/ntl/ntl_GF2EContext.pxd +9 -0
  47. sage/libs/ntl/ntl_GF2EContext.pyx +134 -0
  48. sage/libs/ntl/ntl_GF2EX.cpython-314t-aarch64-linux-gnu.so +0 -0
  49. sage/libs/ntl/ntl_GF2EX.pxd +10 -0
  50. sage/libs/ntl/ntl_GF2EX.pyx +251 -0
  51. sage/libs/ntl/ntl_GF2X.cpython-314t-aarch64-linux-gnu.so +0 -0
  52. sage/libs/ntl/ntl_GF2X.pxd +5 -0
  53. sage/libs/ntl/ntl_GF2X.pyx +771 -0
  54. sage/libs/ntl/ntl_GF2X_linkage.pxi +404 -0
  55. sage/libs/ntl/ntl_ZZ.cpython-314t-aarch64-linux-gnu.so +0 -0
  56. sage/libs/ntl/ntl_ZZ.pxd +7 -0
  57. sage/libs/ntl/ntl_ZZ.pyx +541 -0
  58. sage/libs/ntl/ntl_ZZX.cpython-314t-aarch64-linux-gnu.so +0 -0
  59. sage/libs/ntl/ntl_ZZX.pxd +7 -0
  60. sage/libs/ntl/ntl_ZZX.pyx +1206 -0
  61. sage/libs/ntl/ntl_ZZ_p.cpython-314t-aarch64-linux-gnu.so +0 -0
  62. sage/libs/ntl/ntl_ZZ_p.pxd +10 -0
  63. sage/libs/ntl/ntl_ZZ_p.pyx +509 -0
  64. sage/libs/ntl/ntl_ZZ_pContext.cpython-314t-aarch64-linux-gnu.so +0 -0
  65. sage/libs/ntl/ntl_ZZ_pContext.pxd +22 -0
  66. sage/libs/ntl/ntl_ZZ_pContext.pyx +201 -0
  67. sage/libs/ntl/ntl_ZZ_pE.cpython-314t-aarch64-linux-gnu.so +0 -0
  68. sage/libs/ntl/ntl_ZZ_pE.pxd +11 -0
  69. sage/libs/ntl/ntl_ZZ_pE.pyx +349 -0
  70. sage/libs/ntl/ntl_ZZ_pEContext.cpython-314t-aarch64-linux-gnu.so +0 -0
  71. sage/libs/ntl/ntl_ZZ_pEContext.pxd +23 -0
  72. sage/libs/ntl/ntl_ZZ_pEContext.pyx +226 -0
  73. sage/libs/ntl/ntl_ZZ_pEX.cpython-314t-aarch64-linux-gnu.so +0 -0
  74. sage/libs/ntl/ntl_ZZ_pEX.pxd +10 -0
  75. sage/libs/ntl/ntl_ZZ_pEX.pyx +1255 -0
  76. sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi +420 -0
  77. sage/libs/ntl/ntl_ZZ_pX.cpython-314t-aarch64-linux-gnu.so +0 -0
  78. sage/libs/ntl/ntl_ZZ_pX.pxd +17 -0
  79. sage/libs/ntl/ntl_ZZ_pX.pyx +1532 -0
  80. sage/libs/ntl/ntl_lzz_p.cpython-314t-aarch64-linux-gnu.so +0 -0
  81. sage/libs/ntl/ntl_lzz_p.pxd +8 -0
  82. sage/libs/ntl/ntl_lzz_p.pyx +440 -0
  83. sage/libs/ntl/ntl_lzz_pContext.cpython-314t-aarch64-linux-gnu.so +0 -0
  84. sage/libs/ntl/ntl_lzz_pContext.pxd +7 -0
  85. sage/libs/ntl/ntl_lzz_pContext.pyx +137 -0
  86. sage/libs/ntl/ntl_lzz_pX.cpython-314t-aarch64-linux-gnu.so +0 -0
  87. sage/libs/ntl/ntl_lzz_pX.pxd +10 -0
  88. sage/libs/ntl/ntl_lzz_pX.pyx +902 -0
  89. sage/libs/ntl/ntl_mat_GF2.cpython-314t-aarch64-linux-gnu.so +0 -0
  90. sage/libs/ntl/ntl_mat_GF2.pxd +8 -0
  91. sage/libs/ntl/ntl_mat_GF2.pyx +612 -0
  92. sage/libs/ntl/ntl_mat_GF2E.cpython-314t-aarch64-linux-gnu.so +0 -0
  93. sage/libs/ntl/ntl_mat_GF2E.pxd +10 -0
  94. sage/libs/ntl/ntl_mat_GF2E.pyx +752 -0
  95. sage/libs/ntl/ntl_mat_ZZ.cpython-314t-aarch64-linux-gnu.so +0 -0
  96. sage/libs/ntl/ntl_mat_ZZ.pxd +6 -0
  97. sage/libs/ntl/ntl_mat_ZZ.pyx +1523 -0
  98. sage/libs/ntl/ntl_tools.pxd +3 -0
  99. sage/libs/ntl/ntlwrap.h +53 -0
  100. sage/libs/ntl/ntlwrap_impl.h +743 -0
  101. sage/libs/ntl/types.pxd +157 -0
  102. sage/libs/ntl/vec_GF2.pxd +26 -0
  103. sage/libs/ntl/vec_GF2E.pxd +2 -0
  104. sage/matrix/all__sagemath_ntl.py +1 -0
  105. sage/matrix/matrix_modn_dense_double.pxd +10 -0
  106. sage/matrix/matrix_modn_dense_float.pxd +9 -0
  107. sage/matrix/matrix_modn_dense_template.pxi +3257 -0
  108. sage/matrix/matrix_modn_dense_template_header.pxi +15 -0
  109. sage/matrix/matrix_modn_sparse.pxd +8 -0
  110. sage/misc/all__sagemath_ntl.py +1 -0
  111. sage/rings/all__sagemath_ntl.py +7 -0
  112. sage/rings/bernmm.cpython-314t-aarch64-linux-gnu.so +0 -0
  113. sage/rings/bernmm.pyx +161 -0
  114. sage/rings/bernoulli_mod_p.cpython-314t-aarch64-linux-gnu.so +0 -0
  115. sage/rings/bernoulli_mod_p.pyx +313 -0
  116. sage/rings/finite_rings/all__sagemath_ntl.py +1 -0
  117. sage/rings/finite_rings/finite_field_ntl_gf2e.py +305 -0
  118. sage/rings/finite_rings/residue_field_ntl_gf2e.cpython-314t-aarch64-linux-gnu.so +0 -0
  119. sage/rings/finite_rings/residue_field_ntl_gf2e.pyx +140 -0
  120. sage/rings/padics/all__sagemath_ntl.py +5 -0
  121. sage/rings/padics/padic_ZZ_pX_CA_element.cpython-314t-aarch64-linux-gnu.so +0 -0
  122. sage/rings/padics/padic_ZZ_pX_CA_element.pxd +25 -0
  123. sage/rings/padics/padic_ZZ_pX_CA_element.pyx +2368 -0
  124. sage/rings/padics/padic_ZZ_pX_CR_element.cpython-314t-aarch64-linux-gnu.so +0 -0
  125. sage/rings/padics/padic_ZZ_pX_CR_element.pxd +33 -0
  126. sage/rings/padics/padic_ZZ_pX_CR_element.pyx +3277 -0
  127. sage/rings/padics/padic_ZZ_pX_FM_element.cpython-314t-aarch64-linux-gnu.so +0 -0
  128. sage/rings/padics/padic_ZZ_pX_FM_element.pxd +12 -0
  129. sage/rings/padics/padic_ZZ_pX_FM_element.pyx +1739 -0
  130. sage/rings/padics/padic_ZZ_pX_element.cpython-314t-aarch64-linux-gnu.so +0 -0
  131. sage/rings/padics/padic_ZZ_pX_element.pxd +6 -0
  132. sage/rings/padics/padic_ZZ_pX_element.pyx +919 -0
  133. sage/rings/padics/padic_ext_element.cpython-314t-aarch64-linux-gnu.so +0 -0
  134. sage/rings/padics/padic_ext_element.pxd +38 -0
  135. sage/rings/padics/padic_ext_element.pyx +512 -0
  136. sage/rings/padics/pow_computer_ext.cpython-314t-aarch64-linux-gnu.so +0 -0
  137. sage/rings/padics/pow_computer_ext.pxd +107 -0
  138. sage/rings/padics/pow_computer_ext.pyx +2401 -0
  139. sage/rings/polynomial/all__sagemath_ntl.py +1 -0
  140. sage/rings/polynomial/evaluation_ntl.cpython-314t-aarch64-linux-gnu.so +0 -0
  141. sage/rings/polynomial/evaluation_ntl.pxd +7 -0
  142. sage/rings/polynomial/evaluation_ntl.pyx +70 -0
  143. sage/rings/polynomial/polynomial_gf2x.cpython-314t-aarch64-linux-gnu.so +0 -0
  144. sage/rings/polynomial/polynomial_gf2x.pxd +10 -0
  145. sage/rings/polynomial/polynomial_gf2x.pyx +364 -0
  146. sage/rings/polynomial/polynomial_integer_dense_ntl.cpython-314t-aarch64-linux-gnu.so +0 -0
  147. sage/rings/polynomial/polynomial_integer_dense_ntl.pxd +8 -0
  148. sage/rings/polynomial/polynomial_integer_dense_ntl.pyx +1128 -0
  149. sage/rings/polynomial/polynomial_modn_dense_ntl.cpython-314t-aarch64-linux-gnu.so +0 -0
  150. sage/rings/polynomial/polynomial_modn_dense_ntl.pxd +36 -0
  151. sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +2049 -0
  152. sage/rings/polynomial/polynomial_template.pxi +842 -0
  153. sage/rings/polynomial/polynomial_template_header.pxi +11 -0
  154. sage/rings/polynomial/polynomial_zz_pex.cpython-314t-aarch64-linux-gnu.so +0 -0
  155. sage/rings/polynomial/polynomial_zz_pex.pxd +12 -0
  156. sage/rings/polynomial/polynomial_zz_pex.pyx +778 -0
  157. sage/rings/real_mpfi.pxd +50 -0
  158. sage/schemes/all__sagemath_ntl.py +1 -0
  159. sage/schemes/hyperelliptic_curves/all__sagemath_ntl.py +1 -0
  160. sage/schemes/hyperelliptic_curves/hypellfrob.cpython-314t-aarch64-linux-gnu.so +0 -0
  161. sage/schemes/hyperelliptic_curves/hypellfrob.pyx +252 -0
@@ -0,0 +1,38 @@
1
+ # sage_setup: distribution = sagemath-ntl
2
+ from sage.rings.padics.padic_generic_element cimport pAdicGenericElement
3
+ from sage.libs.ntl.types cimport ZZ_pX_c, ZZ_pE_c, ZZ_pEX_c, ZZ_p_c, ZZX_c
4
+ from sage.libs.ntl.ntl_ZZ_pContext cimport ntl_ZZ_pContext_class
5
+ from sage.libs.ntl.ntl_ZZ_pEContext cimport ntl_ZZ_pEContext_class
6
+
7
+ cdef class pAdicExtElement(pAdicGenericElement):
8
+ cdef int _set_from_list(self, L) except -1
9
+ cdef int _set_from_list_rel(self, L, long relprec) except -1
10
+ cdef int _set_from_list_abs(self, L, long absprec) except -1
11
+ cdef int _set_from_list_both(self, L, long absprec, long relprec) except -1
12
+
13
+ cdef int _set_from_ZZX(self, ZZX_c poly) except -1
14
+ cdef int _set_from_ZZX_rel(self, ZZX_c poly, long relprec) except -1
15
+ cdef int _set_from_ZZX_abs(self, ZZX_c poly, long absprec) except -1
16
+ cdef int _set_from_ZZX_both(self, ZZX_c poly, long absprec, long relprec) except -1
17
+
18
+ cdef int _set_from_ZZ_pX(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx) except -1
19
+ cdef int _set_from_ZZ_pX_rel(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx, long relprec) except -1
20
+ cdef int _set_from_ZZ_pX_abs(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx, long absprec) except -1
21
+ cdef int _set_from_ZZ_pX_both(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx, long absprec, long relprec) except -1
22
+
23
+ cdef int _set_from_ZZ_pE(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx) except -1
24
+ cdef int _set_from_ZZ_pE_rel(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx, long relprec) except -1
25
+ cdef int _set_from_ZZ_pE_abs(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx, long absprec) except -1
26
+ cdef int _set_from_ZZ_pE_both(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx, long absprec, long relprec) except -1
27
+
28
+ cdef int _set_from_ZZ_pEX(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx) except -1
29
+ cdef int _set_from_ZZ_pEX_rel(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx, long relprec) except -1
30
+ cdef int _set_from_ZZ_pEX_abs(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx, long absprec) except -1
31
+ cdef int _set_from_ZZ_pEX_both(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx, long absprec, long relprec) except -1
32
+
33
+ cdef long _check_ZZ_pContext(self, ntl_ZZ_pContext_class ctx) except -1
34
+ cdef long _check_ZZ_pEContext(self, ntl_ZZ_pEContext_class ctx) except -1
35
+
36
+ cdef ext_p_list(self, bint pos)
37
+ cdef ext_p_list_precs(self, bint pos, long prec)
38
+ cdef ZZ_p_c _const_term(self) noexcept
@@ -0,0 +1,512 @@
1
+ # sage_setup: distribution = sagemath-ntl
2
+ # distutils: libraries = NTL_LIBRARIES gmp M_LIBRARIES
3
+ # distutils: extra_compile_args = NTL_CFLAGS
4
+ # distutils: include_dirs = NTL_INCDIR
5
+ # distutils: library_dirs = NTL_LIBDIR
6
+ # distutils: extra_link_args = NTL_LIBEXTRA
7
+ # distutils: language = c++
8
+ # sage.doctest: needs sage.rings.padics
9
+ r"""
10
+ `p`-adic Extension Element
11
+
12
+ A common superclass for all elements of extension rings and field of `\ZZ_p` and
13
+ `\QQ_p`.
14
+
15
+ AUTHORS:
16
+
17
+ - David Roe (2007): initial version
18
+
19
+ - Julian Rueth (2012-10-18): added residue
20
+ """
21
+ # ****************************************************************************
22
+ # Copyright (C) 2007-2010 David Roe <roed.math@gmail.com>
23
+ # 2012 Julian Rueth <julian.rueth@fsfe.org>
24
+ #
25
+ # Distributed under the terms of the GNU General Public License (GPL)
26
+ # as published by the Free Software Foundation; either version 2 of
27
+ # the License, or (at your option) any later version.
28
+ #
29
+ # https://www.gnu.org/licenses/
30
+ # ****************************************************************************
31
+
32
+ from sage.rings.padics.pow_computer cimport PowComputer_class
33
+ from sage.libs.ntl.ntl_ZZ_p cimport ntl_ZZ_p
34
+
35
+ cdef class pAdicExtElement(pAdicGenericElement):
36
+ cdef int _set_from_list(self, L) except -1:
37
+ """
38
+ Set ``self`` from a list.
39
+
40
+ The list should either be uniform in type, or all of the entries
41
+ should be coercible to integers. If any of the entries in ``L``
42
+ is a list, ``L`` will be cast to a ZZ_pEX.
43
+
44
+ INPUT:
45
+
46
+ - ``L`` -- list
47
+ """
48
+ raise NotImplementedError
49
+
50
+ cdef int _set_from_list_rel(self, L, long relprec) except -1:
51
+ raise NotImplementedError
52
+
53
+ cdef int _set_from_list_abs(self, L, long absprec) except -1:
54
+ raise NotImplementedError
55
+
56
+ cdef int _set_from_list_both(self, L, long absprec, long relprec) except -1:
57
+ raise NotImplementedError
58
+
59
+ cdef int _set_from_ZZX(self, ZZX_c poly) except -1:
60
+ """
61
+ Set from a ZZX_c, choosing how to handle based on the
62
+ precision type of ``self.parent()``.
63
+
64
+ Fixed modulus elements should override this function.
65
+
66
+ This function is not used internally.
67
+ """
68
+ if self.parent().is_capped_relative():
69
+ self._set_from_ZZX_rel(poly, (<PowComputer_class>self.parent().prime_pow).prec_cap)
70
+ elif self.parent().is_capped_absolute():
71
+ self._set_from_ZZX_abs(poly, (<PowComputer_class>self.parent().prime_pow).prec_cap)
72
+ else:
73
+ raise RuntimeError("_set_from_ZZX should have been overridden")
74
+
75
+ cdef int _set_from_ZZX_rel(self, ZZX_c poly, long relprec) except -1:
76
+ """
77
+ Set from a ZZX_c with bounded relative precision.
78
+
79
+ Capped relative elements should override this function, so the
80
+ default implementation is for capped absolute.
81
+
82
+ This function is not used internally.
83
+ """
84
+ self._set_from_ZZX_both(poly, (<PowComputer_class>self.parent().prime_pow).prec_cap, relprec)
85
+
86
+ cdef int _set_from_ZZX_abs(self, ZZX_c poly, long absprec) except -1:
87
+ """
88
+ Set from a ZZX_c with bounded absolute precision.
89
+
90
+ Capped absolute elements should override this function, so the
91
+ default implementation is for capped relative.
92
+
93
+ This function is not used internally.
94
+ """
95
+ self._set_from_ZZX_both(poly, absprec, (<PowComputer_class>self.parent().prime_pow).prec_cap)
96
+
97
+ cdef int _set_from_ZZX_both(self, ZZX_c poly, long absprec, long relprec) except -1:
98
+ """
99
+ Set from a ZZX_c with both absolute and relative precisions bounded.
100
+
101
+ This function should be overridden for both capped absolute
102
+ and capped relative elements.
103
+
104
+ This function is not used internally.
105
+ """
106
+ if self.parent().is_fixed_mod():
107
+ self._set_from_ZZX(poly)
108
+ else:
109
+ raise RuntimeError("_set_from_ZZX_both should have been overridden")
110
+
111
+ cdef int _set_from_ZZ_pX(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx) except -1:
112
+ """
113
+ Set ``self`` from a ZZ_pX defined with context ctx.
114
+
115
+ This function should be overridden for fixed modulus elements.
116
+
117
+ This function is not used internally.
118
+ """
119
+ if self.parent().is_capped_relative():
120
+ self._set_from_ZZ_pX_rel(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap)
121
+ elif self.parent().is_capped_absolute():
122
+ self._set_from_ZZ_pX_abs(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap)
123
+ else:
124
+ raise RuntimeError("_set_from_ZZ_pX should have been overridden")
125
+
126
+ cdef int _set_from_ZZ_pX_rel(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx, long relprec) except -1:
127
+ """
128
+ Set from a ZZ_pX_c with bounded relative precision.
129
+
130
+ Capped relative rings should override this function, so the
131
+ default implementation is for capped absolute.
132
+
133
+ This function is not used internally.
134
+ """
135
+ self._set_from_ZZ_pX_both(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap, relprec)
136
+
137
+ cdef int _set_from_ZZ_pX_abs(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx, long absprec) except -1:
138
+ """
139
+ Set from a ZZ_pX_c with bounded absolute precision.
140
+
141
+ Capped absolute rings should override this function, so the
142
+ default implementation is for capped relative.
143
+
144
+ This function is not used internally.
145
+ """
146
+ self._set_from_ZZ_pX_both(poly, ctx, absprec, (<PowComputer_class>self.parent().prime_pow).prec_cap)
147
+
148
+ cdef int _set_from_ZZ_pX_both(self, ZZ_pX_c* poly, ntl_ZZ_pContext_class ctx, long absprec, long relprec) except -1:
149
+ """
150
+ Set from a ZZ_pX_c with both absolute and relative precision bounded.
151
+
152
+ This function should be overridden by both capped absolute and capped relative elements.
153
+
154
+ This function is not used internally.
155
+ """
156
+ if self.parent().is_fixed_mod():
157
+ self._set_from_ZZ_pX(poly, ctx)
158
+ else:
159
+ raise RuntimeError("_set_from_ZZ_pX_both should have been overridden")
160
+
161
+ cdef int _set_from_ZZ_pE(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx) except -1:
162
+ """
163
+ Set from a ZZ_pE_c.
164
+
165
+ This function is not used internally.
166
+ """
167
+ if self.parent().is_capped_relative():
168
+ self._set_from_ZZ_pE_rel(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap)
169
+ elif self.parent().is_capped_absolute():
170
+ self._set_from_ZZ_pE_abs(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap)
171
+ else:
172
+ raise RuntimeError("_set_from_ZZ_pE should have been overridden")
173
+
174
+ cdef int _set_from_ZZ_pE_rel(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx, long relprec) except -1:
175
+ """
176
+ Set from a ZZ_pE_c with bounded relative precision.
177
+
178
+ Capped relative rings should override this function, so the
179
+ default implementation is for capped absolute.
180
+
181
+ This function is not used internally.
182
+ """
183
+ self._set_from_ZZ_pE_both(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap, relprec)
184
+
185
+ cdef int _set_from_ZZ_pE_abs(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx, long absprec) except -1:
186
+ """
187
+ Set from a ZZ_pE_c with bounded absolute precision.
188
+
189
+ Capped absolute elements should override this function, so the
190
+ default implementation is for capped relative.
191
+
192
+ This function is not used internally.
193
+ """
194
+ self._set_from_ZZ_pE_both(poly, ctx, absprec, (<PowComputer_class>self.parent().prime_pow).prec_cap)
195
+
196
+ cdef int _set_from_ZZ_pE_both(self, ZZ_pE_c* poly, ntl_ZZ_pEContext_class ctx, long absprec, long relprec) except -1:
197
+ """
198
+ Set from a ZZ_pE_c with both absolute and relative precision bounded.
199
+
200
+ Capped absolute and capped relative elements should override
201
+ this function.
202
+
203
+ This function is not used internally.
204
+ """
205
+ if self.parent().is_fixed_mod():
206
+ self._set_from_ZZ_pE(poly, ctx)
207
+ else:
208
+ raise RuntimeError("_set_from_ZZ_pE_both should have been overridden")
209
+
210
+ cdef int _set_from_ZZ_pEX(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx) except -1:
211
+ """
212
+ Set ``self`` from a ZZ_pEX_c.
213
+
214
+ Fixed modulus elements should override this function.
215
+
216
+ This function is not used internally.
217
+ """
218
+ if self.parent().is_capped_relative():
219
+ self._set_from_ZZ_pEX_rel(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap)
220
+ elif self.parent().is_capped_absolute():
221
+ self._set_from_ZZ_pEX_abs(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap)
222
+ else:
223
+ raise RuntimeError("_set_from_ZZ_pEX should have been overridden")
224
+
225
+ cdef int _set_from_ZZ_pEX_rel(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx, long relprec) except -1:
226
+ """
227
+ Set from a ZZ_pEX_c with bounded relative precision.
228
+
229
+ Capped relative elements should override this function, so the
230
+ default implementation is for capped absolute.
231
+
232
+ This function is not used internally.
233
+ """
234
+ self._set_from_ZZ_pEX_both(poly, ctx, (<PowComputer_class>self.parent().prime_pow).prec_cap, relprec)
235
+
236
+ cdef int _set_from_ZZ_pEX_abs(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx, long absprec) except -1:
237
+ """
238
+ Set from a ZZ_pEX_c with bounded absolute precision.
239
+
240
+ Capped absolute elements should override this function, so the
241
+ default implementation is for capped relative.
242
+
243
+ This function is not used internally.
244
+ """
245
+ self._set_from_ZZ_pEX_both(poly, ctx, absprec, (<PowComputer_class>self.parent().prime_pow).prec_cap)
246
+
247
+ cdef int _set_from_ZZ_pEX_both(self, ZZ_pEX_c* poly, ntl_ZZ_pEContext_class ctx, long absprec, long relprec) except -1:
248
+ """
249
+ Set from a ZZ_pEX_c with both absolute and relative precision bounded.
250
+
251
+ Capped absolute and capped relative elements should override
252
+ this function.
253
+
254
+ This function is not used internally.
255
+ """
256
+ if self.parent().is_fixed_mod():
257
+ self._set_from_ZZ_pEX(poly, ctx)
258
+ else:
259
+ raise RuntimeError("_set_from_ZZ_pEX_both should have been overridden")
260
+
261
+ cdef long _check_ZZ_pContext(self, ntl_ZZ_pContext_class ctx) except -1:
262
+ raise NotImplementedError
263
+
264
+ cdef long _check_ZZ_pEContext(self, ntl_ZZ_pEContext_class ctx) except -1:
265
+ raise NotImplementedError
266
+
267
+ cdef ext_p_list(self, bint pos):
268
+ raise NotImplementedError
269
+
270
+ cdef ext_p_list_precs(self, bint pos, long prec):
271
+ raise NotImplementedError
272
+
273
+ def _const_term_test(self):
274
+ """
275
+ Return the constant term of a polynomial representing ``self``.
276
+
277
+ This function is mainly for troubleshooting, and the meaning
278
+ of the return value will depend on whether ``self`` is capped
279
+ relative or otherwise.
280
+
281
+ EXAMPLES::
282
+
283
+ sage: R = Zp(5,5)
284
+ sage: S.<x> = R[]
285
+ sage: f = x^5 + 75*x^3 - 15*x^2 + 125*x - 5
286
+ sage: W.<w> = R.ext(f)
287
+ sage: a = W(566)
288
+ sage: a._const_term_test()
289
+ 566
290
+ """
291
+ cdef ntl_ZZ_p ans = ntl_ZZ_p(modulus=self.parent().prime())
292
+ ans.x = self._const_term()
293
+ return ans
294
+
295
+ cdef ZZ_p_c _const_term(self) noexcept:
296
+ raise NotImplementedError
297
+
298
+ def _ext_p_list(self, pos):
299
+ r"""
300
+ Return a list of integers (in the Eisenstein case) or a list
301
+ of lists of integers (in the unramified case).
302
+
303
+ ``self`` can be reconstructed as a sum of elements of the list times
304
+ powers of the uniformiser (in the Eisenstein case), or as a sum of
305
+ powers of the p times polynomials in the generator (in the
306
+ unramified case).
307
+
308
+ Note that zeros are truncated from the returned list, so you must
309
+ use the :func:`valuation()` function to completely recover ``self``.
310
+
311
+ INPUT:
312
+
313
+ - ``pos`` -- boolean; if ``True``, all integers will be in the range
314
+ `[0,p-1]`, otherwise they will be in the range `[(1-p)/2, p/2]`
315
+
316
+ OUTPUT:
317
+
318
+ - a list of integers or list of lists giving the
319
+ series expansion of ``self``
320
+
321
+ EXAMPLES::
322
+
323
+ sage: R = Zp(5,5)
324
+ sage: S.<x> = R[]
325
+ sage: f = x^5 + 75*x^3 - 15*x^2 + 125*x - 5
326
+ sage: W.<w> = R.ext(f)
327
+ sage: y = W(775, 19); y
328
+ w^10 + 4*w^12 + 2*w^14 + w^15 + 2*w^16 + 4*w^17 + w^18 + O(w^19)
329
+ sage: y._ext_p_list(True)
330
+ [1, 0, 4, 0, 2, 1, 2, 4, 1]
331
+ sage: y._ext_p_list(False)
332
+ [1, 0, -1, 0, 2, 1, 2, 0, 1]
333
+ """
334
+ return self.ext_p_list(pos)
335
+
336
+ def frobenius(self, arithmetic=True):
337
+ r"""
338
+ Return the image of this element under the Frobenius automorphism
339
+ applied to its parent.
340
+
341
+ INPUT:
342
+
343
+ - ``arithmetic`` -- whether to apply the arithmetic Frobenius (acting
344
+ by raising to the `p`-th power on the residue field). If ``False`` is
345
+ provided, the image of geometric Frobenius (raising to the `(1/p)`-th
346
+ power on the residue field) will be returned instead.
347
+
348
+ EXAMPLES::
349
+
350
+ sage: R.<a> = Zq(5^4,3)
351
+ sage: a.frobenius()
352
+ (a^3 + a^2 + 3*a) + (3*a + 1)*5 + (2*a^3 + 2*a^2 + 2*a)*5^2 + O(5^3)
353
+ sage: f = R.defining_polynomial()
354
+ sage: f(a)
355
+ O(5^3)
356
+ sage: f(a.frobenius())
357
+ O(5^3)
358
+ sage: for i in range(4): a = a.frobenius()
359
+ sage: a
360
+ a + O(5^3)
361
+
362
+ sage: K.<a> = Qq(7^3,4)
363
+ sage: b = (a+1)/7
364
+ sage: c = b.frobenius(); c
365
+ (3*a^2 + 5*a + 1)*7^-1 + (6*a^2 + 6*a + 6) + (4*a^2 + 3*a + 4)*7 + (6*a^2 + a + 6)*7^2 + O(7^3)
366
+ sage: c.frobenius().frobenius()
367
+ (a + 1)*7^-1 + O(7^3)
368
+
369
+ An error will be raised if the parent of ``self`` is a ramified extension::
370
+
371
+ sage: x = polygen(ZZ, 'x')
372
+ sage: K.<a> = Qp(5).extension(x^2 - 5)
373
+ sage: a.frobenius()
374
+ Traceback (most recent call last):
375
+ ...
376
+ NotImplementedError: Frobenius automorphism only implemented for unramified extensions
377
+ """
378
+ R = self.parent()
379
+ if R.absolute_e() != 1:
380
+ raise NotImplementedError("Frobenius automorphism only implemented for unramified extensions")
381
+ if self.is_zero(): return self
382
+ L = self.teichmuller_expansion()
383
+ ppow = R.uniformizer_pow(self.valuation())
384
+ if arithmetic:
385
+ exp = R.prime()
386
+ else:
387
+ exp = R.prime()**(R.absolute_degree()-1)
388
+ ans = ppow * L[0]**exp
389
+ for m in range(1,len(L)):
390
+ ppow = ppow << 1
391
+ ans += ppow * L[m]**exp
392
+ return ans
393
+
394
+ cpdef bint _is_base_elt(self, p) except -1:
395
+ r"""
396
+ Return ``True`` if this element is an element of Zp or Qp (rather than
397
+ an extension).
398
+
399
+ INPUT:
400
+
401
+ - ``p`` -- a prime, which is compared with the parent of this element
402
+
403
+ EXAMPLES::
404
+
405
+ sage: K.<a> = Qq(7^3,4)
406
+ sage: a._is_base_elt(5)
407
+ False
408
+ """
409
+ return False
410
+
411
+ def residue(self, absprec=1, field=None, check_prec=True):
412
+ r"""
413
+ Reduces this element modulo `\pi^\mathrm{absprec}`.
414
+
415
+ INPUT:
416
+
417
+ - ``absprec`` -- nonnegative integer (default: 1)
418
+
419
+ - ``field`` -- boolean (default: ``None``); for precision 1, whether to return
420
+ an element of the residue field or a residue ring. Currently unused.
421
+
422
+ - ``check_prec`` -- boolean (default: ``True``); whether to raise an error if this
423
+ element has insufficient precision to determine the reduction. Errors are never
424
+ raised for fixed-mod or floating-point types.
425
+
426
+ OUTPUT: this element reduced modulo `\pi^\mathrm{absprec}`
427
+
428
+ If ``absprec`` is zero, then as an element of `\ZZ/(1)`.
429
+
430
+ If ``absprec`` is one, then as an element of the residue field.
431
+
432
+ .. NOTE::
433
+
434
+ Only implemented for ``absprec`` less than or equal to one.
435
+
436
+ AUTHORS:
437
+
438
+ - Julian Rueth (2012-10-18): initial version
439
+
440
+ EXAMPLES:
441
+
442
+ Unramified case::
443
+
444
+ sage: # needs sage.libs.flint
445
+ sage: R = ZpCA(3,5)
446
+ sage: S.<a> = R[]
447
+ sage: W.<a> = R.extension(a^2 + 9*a + 1)
448
+ sage: (a + 1).residue(1)
449
+ a0 + 1
450
+ sage: a.residue(2)
451
+ Traceback (most recent call last):
452
+ ...
453
+ NotImplementedError: reduction modulo p^n with n>1
454
+
455
+ Eisenstein case::
456
+
457
+ sage: R = ZpCA(3,5)
458
+ sage: S.<a> = R[]
459
+ sage: W.<a> = R.extension(a^2 + 9*a + 3)
460
+ sage: (a + 1).residue(1)
461
+ 1
462
+ sage: a.residue(2)
463
+ Traceback (most recent call last):
464
+ ...
465
+ NotImplementedError: residue() not implemented in extensions for absprec larger than one
466
+
467
+ TESTS::
468
+
469
+ sage: # needs sage.libs.flint
470
+ sage: K = Qp(3,5)
471
+ sage: S.<a> = R[]
472
+ sage: W.<a> = R.extension(a^2 + 9*a + 1)
473
+ sage: (a/3).residue(0)
474
+ Traceback (most recent call last):
475
+ ...
476
+ ValueError: element must have nonnegative valuation in order to compute residue
477
+
478
+ sage: # needs sage.libs.flint
479
+ sage: R = ZpFM(3,5)
480
+ sage: S.<a> = R[]
481
+ sage: W.<a> = R.extension(a^2 + 3)
482
+ sage: W.one().residue(0)
483
+ 0
484
+ sage: a.residue(-1)
485
+ Traceback (most recent call last):
486
+ ...
487
+ ValueError: cannot reduce modulo a negative power of the uniformizer
488
+ sage: a.residue(16)
489
+ Traceback (most recent call last):
490
+ ...
491
+ NotImplementedError: residue() not implemented in extensions for absprec larger than one
492
+ """
493
+ if absprec < 0:
494
+ raise ValueError("cannot reduce modulo a negative power of the uniformizer")
495
+ if self.valuation() < 0:
496
+ raise ValueError("element must have nonnegative valuation in order to compute residue")
497
+ R = self.parent()
498
+ if check_prec and (R.is_fixed_mod() or R.is_floating_point()):
499
+ check_prec = False
500
+ if check_prec and absprec > self.precision_absolute():
501
+ from precision_error import PrecisionError
502
+ raise PrecisionError("not enough precision known in order to compute residue")
503
+ if field and absprec != 1:
504
+ raise ValueError("field keyword may only be set at precision 1")
505
+
506
+ if absprec == 0:
507
+ from sage.rings.finite_rings.integer_mod import Mod
508
+ return Mod(0,1)
509
+ elif absprec == 1:
510
+ return R.residue_field()(self.expansion(0))
511
+ else:
512
+ raise NotImplementedError("residue() not implemented in extensions for absprec larger than one")
@@ -0,0 +1,107 @@
1
+ # sage_setup: distribution = sagemath-ntl
2
+ from sage.rings.padics.pow_computer cimport PowComputer_class
3
+ from sage.libs.ntl.ntl_ZZ_pContext cimport ntl_ZZ_pContext_class
4
+ from sage.libs.ntl.types cimport *
5
+ from sage.libs.gmp.types cimport mpz_t
6
+
7
+ cdef class PowComputer_ext(PowComputer_class):
8
+ cdef ZZ_c* small_powers
9
+ cdef ZZ_c top_power
10
+ cdef ZZ_c temp_z
11
+ cdef long _initialized
12
+ cdef mpz_t temp_m2
13
+
14
+ # the following are for unpickling
15
+ cdef object _poly
16
+ cdef object _shift_seed
17
+ cdef object _ext_type
18
+
19
+ cdef ZZ_c* pow_ZZ_tmp(self, long n) except NULL
20
+ cdef ZZ_c* pow_ZZ_top(self) noexcept
21
+
22
+ cdef void cleanup_ext(self) noexcept
23
+
24
+ cdef class PowComputer_ZZ_pX(PowComputer_ext):
25
+ cdef ntl_ZZ_pContext_class get_context(self, long n)
26
+ cdef ntl_ZZ_pContext_class get_context_capdiv(self, long n)
27
+ cdef ntl_ZZ_pContext_class get_top_context(self)
28
+ cdef restore_context(self, long n)
29
+ cdef restore_context_capdiv(self, long n)
30
+ cdef void restore_top_context(self) noexcept
31
+ cdef ZZ_pX_Modulus_c* get_modulus(self, long n) noexcept
32
+ cdef ZZ_pX_Modulus_c* get_modulus_capdiv(self, long n) noexcept
33
+ cdef ZZ_pX_Modulus_c* get_top_modulus(self) noexcept
34
+ cdef int eis_shift(self, ZZ_pX_c* x, ZZ_pX_c* a, long n, long finalprec) except -1
35
+ cdef int eis_shift_capdiv(self, ZZ_pX_c* x, ZZ_pX_c* a, long n, long finalprec) except -1
36
+ cdef long capdiv(self, long n) noexcept
37
+ cdef int teichmuller_set_c (self, ZZ_pX_c* x, ZZ_pX_c* a, long absprec) except -1
38
+
39
+ cdef class PowComputer_ZZ_pX_FM(PowComputer_ZZ_pX):
40
+ cdef ntl_ZZ_pContext_class c
41
+ cdef ZZ_pX_Modulus_c mod
42
+
43
+ cdef class PowComputer_ZZ_pX_FM_Eis(PowComputer_ZZ_pX_FM):
44
+ cdef int low_length
45
+ cdef int high_length
46
+ cdef ZZ_pX_Multiplier_c* low_shifter
47
+ cdef ZZ_pX_Multiplier_c* high_shifter
48
+
49
+ cdef void cleanup_ZZ_pX_FM_Eis(self) noexcept
50
+
51
+ cdef class PowComputer_ZZ_pX_small(PowComputer_ZZ_pX):
52
+ cdef object c # using a python list so that we can store ntl_ZZ_pContext_class objects
53
+ cdef ZZ_pX_Modulus_c *mod
54
+
55
+ cdef void cleanup_ZZ_pX_small(self) noexcept
56
+
57
+ cdef class PowComputer_ZZ_pX_small_Eis(PowComputer_ZZ_pX_small):
58
+ cdef int low_length
59
+ cdef int high_length
60
+ cdef ZZ_pX_c* low_shifter
61
+ cdef ZZ_pX_c* high_shifter
62
+
63
+ cdef void cleanup_ZZ_pX_small_Eis(self) noexcept
64
+
65
+ cdef class PowComputer_ZZ_pX_big(PowComputer_ZZ_pX):
66
+ cdef object context_list # using a python list so that we can store ntl_ZZ_pContext_class objects
67
+ cdef ZZ_pX_Modulus_c *modulus_list
68
+
69
+ cdef ntl_ZZ_pContext_class top_context
70
+ cdef ZZ_pX_Modulus_c top_mod
71
+
72
+ cdef object context_dict # currently using a dict, optimize for speed later
73
+ cdef object modulus_dict # currently using a dict, optimize for speed later
74
+
75
+ cdef void cleanup_ZZ_pX_big(self) noexcept
76
+
77
+ cdef class PowComputer_ZZ_pX_big_Eis(PowComputer_ZZ_pX_big):
78
+ cdef int low_length
79
+ cdef int high_length
80
+ cdef ZZ_pX_c* low_shifter
81
+ cdef ZZ_pX_c* high_shifter
82
+
83
+ cdef void cleanup_ZZ_pX_big_Eis(self) noexcept
84
+
85
+ # cdef class PowComputer_ZZ_pEX(PowComputer_ext):
86
+ # cdef ntl_ZZ_pEContext get_context(self, long n)
87
+ # cdef ntl_ZZ_pEContext get_top_context(self)
88
+ # cdef void restore_context(self, long n)
89
+ # cdef void restore_top_context(self)
90
+ # cdef ZZ_pEX_Modulus_c get_modulus(self, long n)
91
+ # cdef ZZ_pEX_Modulus_c get_top_modulus(self)
92
+ #
93
+ # cdef class PowComputer_ZZ_pEX_FM(PowComputer_ZZ_pEX):
94
+ # cdef ZZ_pEX_c poly
95
+ # cdef ntl_ZZ_pEContext c
96
+ # cdef ZZ_pEX_Modulus_c mod
97
+ #
98
+ #
99
+ # cdef class PowComputer_ZZ_pEX_small(PowComputer_ZZ_pEX):
100
+ # cdef ZZ_pEX_c *poly
101
+ # cdef ntl_ZZ_pEContext *c
102
+ # cdef ZZ_pEX_Modulus_c *mod
103
+ #
104
+ # cdef class PowComputer_ZZ_pEX_big(PowComputer_ZZ_pEX):
105
+ # cdef ZZ_pEX_c poly
106
+ # cdef context_dict # currently using a dict, optimize for speed later
107
+ # cdef modulus_dict # currently using a dict, optimize for speed later