passagemath-schemes 10.8.1a4__cp314-cp314t-macosx_13_0_arm64.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 (312) hide show
  1. passagemath_schemes/.dylibs/libflint.22.0.dylib +0 -0
  2. passagemath_schemes/.dylibs/libgmp.10.dylib +0 -0
  3. passagemath_schemes/.dylibs/libgmpxx.4.dylib +0 -0
  4. passagemath_schemes/.dylibs/libmpfr.6.dylib +0 -0
  5. passagemath_schemes/__init__.py +3 -0
  6. passagemath_schemes-10.8.1a4.dist-info/METADATA +203 -0
  7. passagemath_schemes-10.8.1a4.dist-info/METADATA.bak +204 -0
  8. passagemath_schemes-10.8.1a4.dist-info/RECORD +312 -0
  9. passagemath_schemes-10.8.1a4.dist-info/WHEEL +6 -0
  10. passagemath_schemes-10.8.1a4.dist-info/top_level.txt +3 -0
  11. sage/all__sagemath_schemes.py +23 -0
  12. sage/databases/all__sagemath_schemes.py +7 -0
  13. sage/databases/cremona.py +1723 -0
  14. sage/dynamics/all__sagemath_schemes.py +2 -0
  15. sage/dynamics/arithmetic_dynamics/affine_ds.py +1083 -0
  16. sage/dynamics/arithmetic_dynamics/all.py +14 -0
  17. sage/dynamics/arithmetic_dynamics/berkovich_ds.py +1101 -0
  18. sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py +1543 -0
  19. sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +2426 -0
  20. sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py +1169 -0
  21. sage/dynamics/arithmetic_dynamics/generic_ds.py +663 -0
  22. sage/dynamics/arithmetic_dynamics/product_projective_ds.py +339 -0
  23. sage/dynamics/arithmetic_dynamics/projective_ds.py +9556 -0
  24. sage/dynamics/arithmetic_dynamics/projective_ds_helper.cpython-314t-darwin.so +0 -0
  25. sage/dynamics/arithmetic_dynamics/projective_ds_helper.pyx +301 -0
  26. sage/dynamics/arithmetic_dynamics/wehlerK3.py +2578 -0
  27. sage/lfunctions/all.py +18 -0
  28. sage/lfunctions/dokchitser.py +727 -0
  29. sage/lfunctions/pari.py +971 -0
  30. sage/lfunctions/zero_sums.cpython-314t-darwin.so +0 -0
  31. sage/lfunctions/zero_sums.pyx +1847 -0
  32. sage/modular/abvar/abvar.py +5132 -0
  33. sage/modular/abvar/abvar_ambient_jacobian.py +414 -0
  34. sage/modular/abvar/abvar_newform.py +246 -0
  35. sage/modular/abvar/all.py +8 -0
  36. sage/modular/abvar/constructor.py +187 -0
  37. sage/modular/abvar/cuspidal_subgroup.py +371 -0
  38. sage/modular/abvar/finite_subgroup.py +896 -0
  39. sage/modular/abvar/homology.py +721 -0
  40. sage/modular/abvar/homspace.py +989 -0
  41. sage/modular/abvar/lseries.py +415 -0
  42. sage/modular/abvar/morphism.py +935 -0
  43. sage/modular/abvar/torsion_point.py +274 -0
  44. sage/modular/abvar/torsion_subgroup.py +741 -0
  45. sage/modular/all.py +43 -0
  46. sage/modular/arithgroup/all.py +20 -0
  47. sage/modular/arithgroup/arithgroup_element.cpython-314t-darwin.so +0 -0
  48. sage/modular/arithgroup/arithgroup_element.pyx +474 -0
  49. sage/modular/arithgroup/arithgroup_generic.py +1406 -0
  50. sage/modular/arithgroup/arithgroup_perm.py +2692 -0
  51. sage/modular/arithgroup/congroup.cpython-314t-darwin.so +0 -0
  52. sage/modular/arithgroup/congroup.pyx +334 -0
  53. sage/modular/arithgroup/congroup_gamma.py +361 -0
  54. sage/modular/arithgroup/congroup_gamma0.py +692 -0
  55. sage/modular/arithgroup/congroup_gamma1.py +659 -0
  56. sage/modular/arithgroup/congroup_gammaH.py +1491 -0
  57. sage/modular/arithgroup/congroup_generic.py +630 -0
  58. sage/modular/arithgroup/congroup_sl2z.py +266 -0
  59. sage/modular/arithgroup/farey_symbol.cpython-314t-darwin.so +0 -0
  60. sage/modular/arithgroup/farey_symbol.pyx +1067 -0
  61. sage/modular/arithgroup/tests.py +425 -0
  62. sage/modular/btquotients/all.py +4 -0
  63. sage/modular/btquotients/btquotient.py +3736 -0
  64. sage/modular/btquotients/pautomorphicform.py +2564 -0
  65. sage/modular/buzzard.py +100 -0
  66. sage/modular/congroup.py +29 -0
  67. sage/modular/congroup_element.py +13 -0
  68. sage/modular/cusps.py +1107 -0
  69. sage/modular/cusps_nf.py +1270 -0
  70. sage/modular/dims.py +571 -0
  71. sage/modular/dirichlet.py +3310 -0
  72. sage/modular/drinfeld_modform/all.py +2 -0
  73. sage/modular/drinfeld_modform/element.py +446 -0
  74. sage/modular/drinfeld_modform/ring.py +773 -0
  75. sage/modular/drinfeld_modform/tutorial.py +236 -0
  76. sage/modular/etaproducts.py +1076 -0
  77. sage/modular/hecke/algebra.py +725 -0
  78. sage/modular/hecke/all.py +19 -0
  79. sage/modular/hecke/ambient_module.py +994 -0
  80. sage/modular/hecke/degenmap.py +119 -0
  81. sage/modular/hecke/element.py +302 -0
  82. sage/modular/hecke/hecke_operator.py +736 -0
  83. sage/modular/hecke/homspace.py +185 -0
  84. sage/modular/hecke/module.py +1744 -0
  85. sage/modular/hecke/morphism.py +139 -0
  86. sage/modular/hecke/submodule.py +970 -0
  87. sage/modular/hypergeometric_misc.cpython-314t-darwin.so +0 -0
  88. sage/modular/hypergeometric_misc.pxd +4 -0
  89. sage/modular/hypergeometric_misc.pyx +166 -0
  90. sage/modular/hypergeometric_motive.py +2020 -0
  91. sage/modular/local_comp/all.py +2 -0
  92. sage/modular/local_comp/liftings.py +292 -0
  93. sage/modular/local_comp/local_comp.py +1070 -0
  94. sage/modular/local_comp/smoothchar.py +1825 -0
  95. sage/modular/local_comp/type_space.py +748 -0
  96. sage/modular/modform/all.py +30 -0
  97. sage/modular/modform/ambient.py +817 -0
  98. sage/modular/modform/ambient_R.py +177 -0
  99. sage/modular/modform/ambient_eps.py +306 -0
  100. sage/modular/modform/ambient_g0.py +120 -0
  101. sage/modular/modform/ambient_g1.py +199 -0
  102. sage/modular/modform/constructor.py +545 -0
  103. sage/modular/modform/cuspidal_submodule.py +708 -0
  104. sage/modular/modform/defaults.py +14 -0
  105. sage/modular/modform/eis_series.py +487 -0
  106. sage/modular/modform/eisenstein_submodule.py +663 -0
  107. sage/modular/modform/element.py +4105 -0
  108. sage/modular/modform/half_integral.py +154 -0
  109. sage/modular/modform/hecke_operator_on_qexp.py +247 -0
  110. sage/modular/modform/j_invariant.py +47 -0
  111. sage/modular/modform/l_series_gross_zagier.py +127 -0
  112. sage/modular/modform/l_series_gross_zagier_coeffs.cpython-314t-darwin.so +0 -0
  113. sage/modular/modform/l_series_gross_zagier_coeffs.pyx +177 -0
  114. sage/modular/modform/notes.py +45 -0
  115. sage/modular/modform/numerical.py +514 -0
  116. sage/modular/modform/periods.py +14 -0
  117. sage/modular/modform/ring.py +1257 -0
  118. sage/modular/modform/space.py +1859 -0
  119. sage/modular/modform/submodule.py +118 -0
  120. sage/modular/modform/tests.py +64 -0
  121. sage/modular/modform/theta.py +110 -0
  122. sage/modular/modform/vm_basis.py +380 -0
  123. sage/modular/modform/weight1.py +221 -0
  124. sage/modular/modform_hecketriangle/abstract_ring.py +1932 -0
  125. sage/modular/modform_hecketriangle/abstract_space.py +2527 -0
  126. sage/modular/modform_hecketriangle/all.py +30 -0
  127. sage/modular/modform_hecketriangle/analytic_type.py +590 -0
  128. sage/modular/modform_hecketriangle/constructor.py +416 -0
  129. sage/modular/modform_hecketriangle/element.py +351 -0
  130. sage/modular/modform_hecketriangle/functors.py +752 -0
  131. sage/modular/modform_hecketriangle/graded_ring.py +541 -0
  132. sage/modular/modform_hecketriangle/graded_ring_element.py +2225 -0
  133. sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +3349 -0
  134. sage/modular/modform_hecketriangle/hecke_triangle_groups.py +1426 -0
  135. sage/modular/modform_hecketriangle/readme.py +1214 -0
  136. sage/modular/modform_hecketriangle/series_constructor.py +580 -0
  137. sage/modular/modform_hecketriangle/space.py +1037 -0
  138. sage/modular/modform_hecketriangle/subspace.py +423 -0
  139. sage/modular/modsym/all.py +17 -0
  140. sage/modular/modsym/ambient.py +3844 -0
  141. sage/modular/modsym/boundary.py +1420 -0
  142. sage/modular/modsym/element.py +336 -0
  143. sage/modular/modsym/g1list.py +178 -0
  144. sage/modular/modsym/ghlist.py +182 -0
  145. sage/modular/modsym/hecke_operator.py +73 -0
  146. sage/modular/modsym/manin_symbol.cpython-314t-darwin.so +0 -0
  147. sage/modular/modsym/manin_symbol.pxd +5 -0
  148. sage/modular/modsym/manin_symbol.pyx +497 -0
  149. sage/modular/modsym/manin_symbol_list.py +1291 -0
  150. sage/modular/modsym/modsym.py +400 -0
  151. sage/modular/modsym/modular_symbols.py +384 -0
  152. sage/modular/modsym/p1list_nf.py +1241 -0
  153. sage/modular/modsym/relation_matrix.py +591 -0
  154. sage/modular/modsym/relation_matrix_pyx.cpython-314t-darwin.so +0 -0
  155. sage/modular/modsym/relation_matrix_pyx.pyx +108 -0
  156. sage/modular/modsym/space.py +2468 -0
  157. sage/modular/modsym/subspace.py +455 -0
  158. sage/modular/modsym/tests.py +376 -0
  159. sage/modular/multiple_zeta.py +2635 -0
  160. sage/modular/multiple_zeta_F_algebra.py +789 -0
  161. sage/modular/overconvergent/all.py +6 -0
  162. sage/modular/overconvergent/genus0.py +1879 -0
  163. sage/modular/overconvergent/hecke_series.py +1187 -0
  164. sage/modular/overconvergent/weightspace.py +776 -0
  165. sage/modular/pollack_stevens/all.py +4 -0
  166. sage/modular/pollack_stevens/distributions.py +874 -0
  167. sage/modular/pollack_stevens/fund_domain.py +1572 -0
  168. sage/modular/pollack_stevens/manin_map.py +856 -0
  169. sage/modular/pollack_stevens/modsym.py +1590 -0
  170. sage/modular/pollack_stevens/padic_lseries.py +417 -0
  171. sage/modular/pollack_stevens/sigma0.py +534 -0
  172. sage/modular/pollack_stevens/space.py +1078 -0
  173. sage/modular/quasimodform/all.py +3 -0
  174. sage/modular/quasimodform/element.py +846 -0
  175. sage/modular/quasimodform/ring.py +826 -0
  176. sage/modular/quatalg/all.py +3 -0
  177. sage/modular/quatalg/brandt.py +1642 -0
  178. sage/modular/ssmod/all.py +8 -0
  179. sage/modular/ssmod/ssmod.py +827 -0
  180. sage/rings/all__sagemath_schemes.py +1 -0
  181. sage/rings/polynomial/all__sagemath_schemes.py +1 -0
  182. sage/rings/polynomial/binary_form_reduce.py +585 -0
  183. sage/schemes/all.py +41 -0
  184. sage/schemes/berkovich/all.py +6 -0
  185. sage/schemes/berkovich/berkovich_cp_element.py +2582 -0
  186. sage/schemes/berkovich/berkovich_space.py +700 -0
  187. sage/schemes/curves/affine_curve.py +2924 -0
  188. sage/schemes/curves/all.py +33 -0
  189. sage/schemes/curves/closed_point.py +434 -0
  190. sage/schemes/curves/constructor.py +397 -0
  191. sage/schemes/curves/curve.py +542 -0
  192. sage/schemes/curves/plane_curve_arrangement.py +1283 -0
  193. sage/schemes/curves/point.py +463 -0
  194. sage/schemes/curves/projective_curve.py +3203 -0
  195. sage/schemes/curves/weighted_projective_curve.py +106 -0
  196. sage/schemes/curves/zariski_vankampen.py +1931 -0
  197. sage/schemes/cyclic_covers/all.py +2 -0
  198. sage/schemes/cyclic_covers/charpoly_frobenius.py +320 -0
  199. sage/schemes/cyclic_covers/constructor.py +137 -0
  200. sage/schemes/cyclic_covers/cycliccover_finite_field.py +1309 -0
  201. sage/schemes/cyclic_covers/cycliccover_generic.py +310 -0
  202. sage/schemes/elliptic_curves/BSD.py +991 -0
  203. sage/schemes/elliptic_curves/Qcurves.py +592 -0
  204. sage/schemes/elliptic_curves/addition_formulas_ring.py +94 -0
  205. sage/schemes/elliptic_curves/all.py +49 -0
  206. sage/schemes/elliptic_curves/cardinality.py +609 -0
  207. sage/schemes/elliptic_curves/cm.py +1103 -0
  208. sage/schemes/elliptic_curves/constructor.py +1530 -0
  209. sage/schemes/elliptic_curves/ec_database.py +175 -0
  210. sage/schemes/elliptic_curves/ell_curve_isogeny.py +3971 -0
  211. sage/schemes/elliptic_curves/ell_egros.py +457 -0
  212. sage/schemes/elliptic_curves/ell_field.py +2837 -0
  213. sage/schemes/elliptic_curves/ell_finite_field.py +3249 -0
  214. sage/schemes/elliptic_curves/ell_generic.py +3760 -0
  215. sage/schemes/elliptic_curves/ell_local_data.py +1207 -0
  216. sage/schemes/elliptic_curves/ell_modular_symbols.py +775 -0
  217. sage/schemes/elliptic_curves/ell_number_field.py +4220 -0
  218. sage/schemes/elliptic_curves/ell_padic_field.py +107 -0
  219. sage/schemes/elliptic_curves/ell_point.py +4944 -0
  220. sage/schemes/elliptic_curves/ell_rational_field.py +7184 -0
  221. sage/schemes/elliptic_curves/ell_tate_curve.py +671 -0
  222. sage/schemes/elliptic_curves/ell_torsion.py +436 -0
  223. sage/schemes/elliptic_curves/ell_wp.py +352 -0
  224. sage/schemes/elliptic_curves/formal_group.py +760 -0
  225. sage/schemes/elliptic_curves/gal_reps.py +1459 -0
  226. sage/schemes/elliptic_curves/gal_reps_number_field.py +1663 -0
  227. sage/schemes/elliptic_curves/gp_simon.py +152 -0
  228. sage/schemes/elliptic_curves/heegner.py +7328 -0
  229. sage/schemes/elliptic_curves/height.py +2108 -0
  230. sage/schemes/elliptic_curves/hom.py +1788 -0
  231. sage/schemes/elliptic_curves/hom_composite.py +1084 -0
  232. sage/schemes/elliptic_curves/hom_fractional.py +544 -0
  233. sage/schemes/elliptic_curves/hom_frobenius.py +522 -0
  234. sage/schemes/elliptic_curves/hom_scalar.py +531 -0
  235. sage/schemes/elliptic_curves/hom_sum.py +681 -0
  236. sage/schemes/elliptic_curves/hom_velusqrt.py +1290 -0
  237. sage/schemes/elliptic_curves/homset.py +271 -0
  238. sage/schemes/elliptic_curves/isogeny_class.py +1523 -0
  239. sage/schemes/elliptic_curves/isogeny_small_degree.py +2797 -0
  240. sage/schemes/elliptic_curves/jacobian.py +247 -0
  241. sage/schemes/elliptic_curves/kodaira_symbol.py +344 -0
  242. sage/schemes/elliptic_curves/kraus.py +1014 -0
  243. sage/schemes/elliptic_curves/lseries_ell.py +915 -0
  244. sage/schemes/elliptic_curves/mod5family.py +105 -0
  245. sage/schemes/elliptic_curves/mod_poly.py +197 -0
  246. sage/schemes/elliptic_curves/mod_sym_num.cpython-314t-darwin.so +0 -0
  247. sage/schemes/elliptic_curves/mod_sym_num.pyx +3796 -0
  248. sage/schemes/elliptic_curves/modular_parametrization.py +305 -0
  249. sage/schemes/elliptic_curves/padic_lseries.py +1793 -0
  250. sage/schemes/elliptic_curves/padics.py +1816 -0
  251. sage/schemes/elliptic_curves/period_lattice.py +2234 -0
  252. sage/schemes/elliptic_curves/period_lattice_region.cpython-314t-darwin.so +0 -0
  253. sage/schemes/elliptic_curves/period_lattice_region.pyx +722 -0
  254. sage/schemes/elliptic_curves/saturation.py +716 -0
  255. sage/schemes/elliptic_curves/sha_tate.py +1158 -0
  256. sage/schemes/elliptic_curves/weierstrass_morphism.py +1117 -0
  257. sage/schemes/elliptic_curves/weierstrass_transform.py +200 -0
  258. sage/schemes/hyperelliptic_curves/all.py +6 -0
  259. sage/schemes/hyperelliptic_curves/constructor.py +369 -0
  260. sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +1948 -0
  261. sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py +192 -0
  262. sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +936 -0
  263. sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py +1332 -0
  264. sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py +84 -0
  265. sage/schemes/hyperelliptic_curves/invariants.py +410 -0
  266. sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py +312 -0
  267. sage/schemes/hyperelliptic_curves/jacobian_g2.py +32 -0
  268. sage/schemes/hyperelliptic_curves/jacobian_generic.py +437 -0
  269. sage/schemes/hyperelliptic_curves/jacobian_homset.py +186 -0
  270. sage/schemes/hyperelliptic_curves/jacobian_morphism.py +878 -0
  271. sage/schemes/hyperelliptic_curves/kummer_surface.py +99 -0
  272. sage/schemes/hyperelliptic_curves/mestre.py +302 -0
  273. sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +3863 -0
  274. sage/schemes/jacobians/abstract_jacobian.py +277 -0
  275. sage/schemes/jacobians/all.py +2 -0
  276. sage/schemes/overview.py +161 -0
  277. sage/schemes/plane_conics/all.py +22 -0
  278. sage/schemes/plane_conics/con_field.py +1296 -0
  279. sage/schemes/plane_conics/con_finite_field.py +158 -0
  280. sage/schemes/plane_conics/con_number_field.py +456 -0
  281. sage/schemes/plane_conics/con_rational_field.py +406 -0
  282. sage/schemes/plane_conics/con_rational_function_field.py +581 -0
  283. sage/schemes/plane_conics/constructor.py +249 -0
  284. sage/schemes/plane_quartics/all.py +2 -0
  285. sage/schemes/plane_quartics/quartic_constructor.py +71 -0
  286. sage/schemes/plane_quartics/quartic_generic.py +53 -0
  287. sage/schemes/riemann_surfaces/all.py +1 -0
  288. sage/schemes/riemann_surfaces/riemann_surface.py +4177 -0
  289. sage_wheels/share/cremona/cremona_mini.db +0 -0
  290. sage_wheels/share/ellcurves/rank0 +30427 -0
  291. sage_wheels/share/ellcurves/rank1 +31871 -0
  292. sage_wheels/share/ellcurves/rank10 +6 -0
  293. sage_wheels/share/ellcurves/rank11 +6 -0
  294. sage_wheels/share/ellcurves/rank12 +1 -0
  295. sage_wheels/share/ellcurves/rank14 +1 -0
  296. sage_wheels/share/ellcurves/rank15 +1 -0
  297. sage_wheels/share/ellcurves/rank17 +1 -0
  298. sage_wheels/share/ellcurves/rank19 +1 -0
  299. sage_wheels/share/ellcurves/rank2 +2388 -0
  300. sage_wheels/share/ellcurves/rank20 +1 -0
  301. sage_wheels/share/ellcurves/rank21 +1 -0
  302. sage_wheels/share/ellcurves/rank22 +1 -0
  303. sage_wheels/share/ellcurves/rank23 +1 -0
  304. sage_wheels/share/ellcurves/rank24 +1 -0
  305. sage_wheels/share/ellcurves/rank28 +1 -0
  306. sage_wheels/share/ellcurves/rank3 +836 -0
  307. sage_wheels/share/ellcurves/rank4 +10 -0
  308. sage_wheels/share/ellcurves/rank5 +5 -0
  309. sage_wheels/share/ellcurves/rank6 +5 -0
  310. sage_wheels/share/ellcurves/rank7 +5 -0
  311. sage_wheels/share/ellcurves/rank8 +6 -0
  312. sage_wheels/share/ellcurves/rank9 +7 -0
@@ -0,0 +1,970 @@
1
+ # sage_setup: distribution = sagemath-schemes
2
+ # sage.doctest: needs sage.libs.flint sage.libs.pari
3
+ """
4
+ Submodules of Hecke modules
5
+ """
6
+ # ****************************************************************************
7
+ # Sage: Open Source Mathematical Software
8
+ #
9
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
10
+ #
11
+ # Distributed under the terms of the GNU General Public License (GPL)
12
+ #
13
+ # This code is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # General Public License for more details.
17
+ #
18
+ # The full text of the GPL is available at:
19
+ #
20
+ # https://www.gnu.org/licenses/
21
+ # ****************************************************************************
22
+
23
+ import sage.arith.misc as arith
24
+ from sage.misc.verbose import verbose
25
+ from sage.misc.cachefunc import cached_method
26
+ from sage.modules.free_module import FreeModule_generic
27
+ from sage.structure.richcmp import richcmp_method, richcmp_not_equal
28
+
29
+ from . import module
30
+
31
+
32
+ @richcmp_method
33
+ class HeckeSubmodule(module.HeckeModule_free_module):
34
+ """
35
+ Submodule of a Hecke module.
36
+ """
37
+ def __init__(self, ambient, submodule,
38
+ dual_free_module=None, check=True) -> None:
39
+ r"""
40
+ Initialise a submodule of an ambient Hecke module.
41
+
42
+ INPUT:
43
+
44
+ - ``ambient`` -- an ambient Hecke module
45
+
46
+ - ``submodule`` -- a free module over the base ring which is a submodule
47
+ of the free module attached to the ambient Hecke module. This should
48
+ be invariant under all Hecke operators.
49
+
50
+ - ``dual_free_module`` -- the submodule of the dual of the ambient
51
+ module corresponding to this submodule (or ``None``)
52
+
53
+ - ``check`` -- whether or not to explicitly check that the submodule is
54
+ Hecke equivariant
55
+
56
+ EXAMPLES::
57
+
58
+ sage: CuspForms(1,60) # indirect doctest
59
+ Cuspidal subspace of dimension 5 of Modular Forms space of dimension 6 for Modular Group SL(2,Z) of weight 60 over Rational Field
60
+
61
+ sage: M = ModularForms(4,10)
62
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.submodule(M.basis()[:3]).free_module())
63
+ sage: S
64
+ Rank 3 submodule of a Hecke module of level 4
65
+
66
+ sage: S == loads(dumps(S))
67
+ True
68
+ """
69
+ from . import ambient_module
70
+ if not isinstance(ambient, ambient_module.AmbientHeckeModule):
71
+ raise TypeError("ambient must be an ambient Hecke module")
72
+ if not isinstance(submodule, FreeModule_generic):
73
+ raise TypeError("submodule must be a free module")
74
+ if not submodule.is_submodule(ambient.free_module()):
75
+ raise ValueError("submodule must be a submodule of the ambient free module")
76
+
77
+ if check:
78
+ if not ambient._is_hecke_equivariant_free_module(submodule):
79
+ raise ValueError("The submodule must be invariant under all Hecke operators.")
80
+
81
+ self.__ambient = ambient
82
+ self.__submodule = submodule
83
+ module.HeckeModule_free_module.__init__(self, ambient.base_ring(),
84
+ ambient.level(),
85
+ ambient.weight())
86
+ if dual_free_module is not None:
87
+ if not isinstance(dual_free_module, FreeModule_generic):
88
+ raise TypeError("dual_free_module must be a free module")
89
+ if dual_free_module.rank() != submodule.rank():
90
+ raise ArithmeticError("dual_free_module must have the same rank as submodule")
91
+ self.dual_free_module.set_cache(dual_free_module)
92
+
93
+ def _repr_(self):
94
+ r"""
95
+ String representation of ``self``.
96
+
97
+ EXAMPLES::
98
+
99
+ sage: M = ModularForms(4,10)
100
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.submodule(M.basis()[:3]).free_module())
101
+ sage: S._repr_()
102
+ 'Rank 3 submodule of a Hecke module of level 4'
103
+ """
104
+ return "Rank %s submodule of a Hecke module of level %s" % (
105
+ self.rank(), self.level())
106
+
107
+ def __add__(self, other):
108
+ r"""
109
+ Sum of ``self`` and ``other`` (as submodules of a common ambient
110
+ module).
111
+
112
+ EXAMPLES::
113
+
114
+ sage: M = ModularForms(4,10)
115
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.submodule(M.basis()[:3]).free_module())
116
+ sage: E = sage.modular.hecke.submodule.HeckeSubmodule(M, M.submodule(M.basis()[3:]).free_module())
117
+ sage: S + E # indirect doctest
118
+ Modular Forms subspace of dimension 6 of Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(4) of weight 10 over Rational Field
119
+ """
120
+ if not isinstance(other, module.HeckeModule_free_module):
121
+ raise TypeError("other (=%s) must be a Hecke module." % other)
122
+ if self.ambient() != other.ambient():
123
+ raise ArithmeticError("sum only defined for submodules of a common ambient space")
124
+ if other.is_ambient():
125
+ return other
126
+ # Neither is ambient
127
+ M = self.free_module() + other.free_module()
128
+ return self.ambient().submodule(M, check=False)
129
+
130
+ def _element_constructor_(self, x, check=True):
131
+ """
132
+ Coerce x into the ambient module and checks that x is in this
133
+ submodule.
134
+
135
+ EXAMPLES::
136
+
137
+ sage: M = ModularSymbols(37)
138
+ sage: S = M.cuspidal_submodule()
139
+ sage: M([0,oo])
140
+ -(1,0)
141
+ sage: S([0,oo])
142
+ Traceback (most recent call last):
143
+ ...
144
+ TypeError: x does not coerce to an element of this Hecke module
145
+ sage: S([-1/23,0])
146
+ (1,23)
147
+ """
148
+ z = self.ambient_hecke_module()(x).element()
149
+ if check and z not in self.__submodule:
150
+ raise TypeError("x does not coerce to an element of this Hecke module")
151
+ return self.element_class(self, z)
152
+
153
+ def __richcmp__(self, other, op):
154
+ """
155
+ Compare ``self`` to ``other``.
156
+
157
+ EXAMPLES::
158
+
159
+ sage: M = ModularSymbols(12,6)
160
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
161
+ sage: T = sage.modular.hecke.submodule.HeckeSubmodule(M, M.new_submodule().free_module())
162
+ sage: S
163
+ Rank 14 submodule of a Hecke module of level 12
164
+ sage: T
165
+ Rank 0 submodule of a Hecke module of level 12
166
+ sage: S > T
167
+ True
168
+ sage: T < S
169
+ True
170
+ sage: S == S
171
+ True
172
+ """
173
+ if not isinstance(other, module.HeckeModule_free_module):
174
+ return NotImplemented
175
+ lx = self.ambient()
176
+ rx = other.ambient()
177
+ if lx != rx:
178
+ return richcmp_not_equal(lx, rx, op)
179
+ return self.free_module()._echelon_matrix_richcmp(other.free_module(), op)
180
+
181
+ ################################
182
+ # Semi-Private functions
183
+ ################################
184
+ def _compute_dual_hecke_matrix(self, n):
185
+ """
186
+ Compute the matrix for the `n`-th Hecke operator acting on
187
+ the dual of ``self``.
188
+
189
+ EXAMPLES::
190
+
191
+ sage: M = ModularForms(4,10)
192
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.submodule(M.basis()[:3]).free_module())
193
+ sage: S._compute_dual_hecke_matrix(3)
194
+ [ 0 0 1]
195
+ [ 0 -156 0]
196
+ [35568 0 72]
197
+ sage: CuspForms(4,10).dual_hecke_matrix(3)
198
+ [ 0 0 1]
199
+ [ 0 -156 0]
200
+ [35568 0 72]
201
+ """
202
+ A = self.ambient_hecke_module().dual_hecke_matrix(n)
203
+ check = arith.gcd(self.level(), n) != 1
204
+ return A.restrict(self.dual_free_module(), check=check)
205
+
206
+ def _compute_hecke_matrix(self, n):
207
+ r"""
208
+ Compute the matrix of the `n`-th Hecke operator acting on this space, by
209
+ calling the corresponding function for the ambient space and
210
+ restricting. If `n` is not coprime to the level, we check that the
211
+ restriction is well-defined.
212
+
213
+ EXAMPLES::
214
+
215
+ sage: R.<q> = QQ[[]]
216
+ sage: M = ModularForms(2, 12)
217
+ sage: f = M(q^2 - 24*q^4 + O(q^6))
218
+ sage: A = M.submodule(M.free_module().span([f.element()]),check=False)
219
+ sage: sage.modular.hecke.submodule.HeckeSubmodule._compute_hecke_matrix(A, 3)
220
+ [252]
221
+ sage: sage.modular.hecke.submodule.HeckeSubmodule._compute_hecke_matrix(A, 4)
222
+ Traceback (most recent call last):
223
+ ...
224
+ ArithmeticError: subspace is not invariant under matrix
225
+ """
226
+ A = self.ambient_hecke_module().hecke_matrix(n)
227
+ check = arith.gcd(self.level(), n) != 1
228
+ return A.restrict(self.free_module(), check=check)
229
+
230
+ def _compute_diamond_matrix(self, d):
231
+ r"""
232
+ EXAMPLES::
233
+
234
+ sage: f = ModularSymbols(Gamma1(13),2,sign=1).cuspidal_subspace().decomposition()[0]
235
+ sage: a = f.diamond_bracket_operator(2).matrix() # indirect doctest
236
+ sage: a.charpoly()
237
+ x^2 - x + 1
238
+ sage: a^12
239
+ [1 0]
240
+ [0 1]
241
+ """
242
+ return self.ambient_hecke_module().diamond_bracket_matrix(d).restrict(self.free_module(), check=False)
243
+
244
+ def _compute_atkin_lehner_matrix(self, d):
245
+ """
246
+ Compute the Atkin-Lehner matrix corresponding to the
247
+ divisor d of the level of ``self``.
248
+
249
+ EXAMPLES::
250
+
251
+ sage: M = ModularSymbols(4,10)
252
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
253
+ sage: S
254
+ Rank 6 submodule of a Hecke module of level 4
255
+ sage: S._compute_atkin_lehner_matrix(1)
256
+ [1 0 0 0 0 0]
257
+ [0 1 0 0 0 0]
258
+ [0 0 1 0 0 0]
259
+ [0 0 0 1 0 0]
260
+ [0 0 0 0 1 0]
261
+ [0 0 0 0 0 1]
262
+ """
263
+ A = self.ambient_hecke_module()._compute_atkin_lehner_matrix(d)
264
+ return A.restrict(self.free_module(), check=True)
265
+
266
+ def _set_dual_free_module(self, V):
267
+ """
268
+ Set the dual free module of ``self`` to V. Here V must be a vector
269
+ space of the same dimension as ``self``, embedded in a space of
270
+ the same dimension as the ambient space of ``self``.
271
+
272
+ EXAMPLES::
273
+
274
+ sage: M = ModularSymbols(4,10)
275
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
276
+ sage: S._set_dual_free_module(M.cuspidal_submodule().dual_free_module())
277
+ sage: S._set_dual_free_module(S)
278
+ """
279
+ if V.degree() != self.ambient_hecke_module().rank():
280
+ raise ArithmeticError("The degree of V must equal the rank of the ambient space.")
281
+ if V.rank() != self.rank():
282
+ raise ArithmeticError("The rank of V must equal the rank of self.")
283
+ self.dual_free_module.set_cache(V)
284
+
285
+ ################################
286
+ # Public functions
287
+ ################################
288
+
289
+ def ambient_hecke_module(self):
290
+ r"""
291
+ Return the ambient Hecke module of which this is a submodule.
292
+
293
+ EXAMPLES::
294
+
295
+ sage: CuspForms(2, 12).ambient_hecke_module()
296
+ Modular Forms space of dimension 4 for Congruence Subgroup Gamma0(2) of weight 12 over Rational Field
297
+ """
298
+ return self.__ambient
299
+
300
+ def ambient(self):
301
+ r"""
302
+ Synonym for ambient_hecke_module.
303
+
304
+ EXAMPLES::
305
+
306
+ sage: CuspForms(2, 12).ambient()
307
+ Modular Forms space of dimension 4 for Congruence Subgroup Gamma0(2) of weight 12 over Rational Field
308
+ """
309
+ return self.__ambient
310
+
311
+ @cached_method
312
+ def complement(self, bound=None):
313
+ """
314
+ Return the largest Hecke-stable complement of this space.
315
+
316
+ EXAMPLES::
317
+
318
+ sage: M = ModularSymbols(15, 6).cuspidal_subspace()
319
+ sage: M.complement()
320
+ Modular Symbols subspace of dimension 4 of
321
+ Modular Symbols space of dimension 20 for Gamma_0(15) of weight 6 with sign 0 over Rational Field
322
+
323
+ sage: # needs database_cremona_mini_ellcurve
324
+ sage: E = EllipticCurve("128a")
325
+ sage: ME = E.modular_symbol_space()
326
+ sage: ME.complement()
327
+ Modular Symbols subspace of dimension 17 of
328
+ Modular Symbols space of dimension 18 for Gamma_0(128) of weight 2 with sign 1 over Rational Field
329
+ """
330
+
331
+ if self.dual_free_module.is_in_cache():
332
+ D = self.dual_free_module()
333
+ V = D.basis_matrix().right_kernel()
334
+ return self.submodule(V, check=False)
335
+
336
+ if self.is_ambient():
337
+ return self.ambient_hecke_module().zero_submodule()
338
+
339
+ if self.is_zero():
340
+ return self.ambient_hecke_module()
341
+
342
+ if self.is_full_hecke_module():
343
+ anemic = False
344
+ else:
345
+ anemic = True
346
+
347
+ # TODO: optimize in some cases by computing image of
348
+ # complementary factor instead of kernel...?
349
+ verbose("computing")
350
+ N = self.level()
351
+ A = self.ambient_hecke_module()
352
+ V = A.free_module()
353
+ p = 2
354
+ if bound is None:
355
+ bound = A.hecke_bound()
356
+ while True:
357
+ if anemic:
358
+ while N % p == 0:
359
+ p = arith.next_prime(p)
360
+ verbose("using T_%s" % p)
361
+ f = self.hecke_polynomial(p)
362
+ T = A.hecke_matrix(p)
363
+ g = T.charpoly('x')
364
+ V = T.kernel_on(V, poly=g // f, check=False)
365
+ if V.rank() + self.rank() <= A.rank():
366
+ break
367
+ p = arith.next_prime(p)
368
+ if p > bound: # to avoid computing Hecke bound unless necessary
369
+ break
370
+
371
+ if V.rank() + self.rank() == A.rank():
372
+ return A.submodule(V, check=False)
373
+
374
+ # first attempt to compute the complement failed, we now try
375
+ # the following naive approach: decompose the ambient space,
376
+ # decompose self, and sum the pieces of ambient that are not
377
+ # subspaces of self
378
+ verbose("falling back on naive algorithm")
379
+ D = A.decomposition()
380
+ C = A.zero_submodule()
381
+ for X in D:
382
+ if self.intersection(X).dimension() == 0:
383
+ C = C + X
384
+ if C.rank() + self.rank() == A.rank():
385
+ return C
386
+
387
+ # failed miserably
388
+ raise RuntimeError("Computation of complementary space failed (cut down to rank %s, but should have cut down to rank %s)." % (
389
+ V.rank(), A.rank() - self.rank()))
390
+
391
+ def degeneracy_map(self, level, t=1):
392
+ """
393
+ The `t`-th degeneracy map from ``self`` to the space of ambient modular
394
+ symbols of the given level. The level of ``self`` must be a divisor or
395
+ multiple of level, and `t` must be a divisor of the quotient.
396
+
397
+ INPUT:
398
+
399
+ - ``level`` -- positive integer; the level of the codomain of the
400
+ map
401
+
402
+ - ``t`` -- integer; the parameter of the degeneracy map,
403
+ i.e., the map is related to `f(q)` - `f(q^t)`
404
+
405
+ OUTPUT:
406
+
407
+ A linear function from ``self`` to the space of modular symbols of given
408
+ level with the same weight, character, sign, etc., as this space.
409
+
410
+ EXAMPLES::
411
+
412
+ sage: D = ModularSymbols(10,4).cuspidal_submodule().decomposition(); D
413
+ [Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 10 for Gamma_0(10) of weight 4 with sign 0 over Rational Field,
414
+ Modular Symbols subspace of dimension 4 of Modular Symbols space of dimension 10 for Gamma_0(10) of weight 4 with sign 0 over Rational Field]
415
+ sage: d = D[1].degeneracy_map(5); d
416
+ Hecke module morphism defined by the matrix
417
+ [ 0 0 -1 1]
418
+ [ 0 1/2 3/2 -2]
419
+ [ 0 -1 1 0]
420
+ [ 0 -3/4 -1/4 1]
421
+ Domain: Modular Symbols subspace of dimension 4 of Modular Symbols space ...
422
+ Codomain: Modular Symbols space of dimension 4 for Gamma_0(5) of weight ...
423
+
424
+ ::
425
+
426
+ sage: d.rank()
427
+ 2
428
+ sage: d.kernel()
429
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 10 for Gamma_0(10) of weight 4 with sign 0 over Rational Field
430
+ sage: d.image()
431
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 4 for Gamma_0(5) of weight 4 with sign 0 over Rational Field
432
+ """
433
+ d = self.ambient_hecke_module().degeneracy_map(level, t)
434
+ return d.restrict_domain(self)
435
+
436
+ @cached_method
437
+ def dual_free_module(self, bound=None, anemic=True, use_star=True):
438
+ r"""
439
+ Compute embedded dual free module if possible.
440
+
441
+ In general this will not be possible, e.g., if this space is
442
+ not Hecke equivariant, possibly if it is not cuspidal, or if
443
+ the characteristic is not 0. In all these cases we raise a
444
+ :exc:`RuntimeError` exception.
445
+
446
+ If ``use_star`` is ``True`` (which is the default), we also use the +/-
447
+ eigenspaces for the star operator to find the dual free module of ``self``.
448
+ If ``self`` does not have a star involution, ``use_star`` will automatically be
449
+ set to ``False``.
450
+
451
+ EXAMPLES::
452
+
453
+ sage: M = ModularSymbols(11, 2)
454
+ sage: M.dual_free_module()
455
+ Vector space of dimension 3 over Rational Field
456
+ sage: Mpc = M.plus_submodule().cuspidal_submodule()
457
+ sage: Mcp = M.cuspidal_submodule().plus_submodule()
458
+ sage: Mcp.dual_free_module() == Mpc.dual_free_module()
459
+ True
460
+ sage: Mpc.dual_free_module()
461
+ Vector space of degree 3 and dimension 1 over Rational Field
462
+ Basis matrix:
463
+ [ 1 5/2 5]
464
+
465
+ sage: M = ModularSymbols(35,2).cuspidal_submodule()
466
+ sage: M.dual_free_module(use_star=False)
467
+ Vector space of degree 9 and dimension 6 over Rational Field
468
+ Basis matrix:
469
+ [ 1 0 0 0 -1 0 0 4 -2]
470
+ [ 0 1 0 0 0 0 0 -1/2 1/2]
471
+ [ 0 0 1 0 0 0 0 -1/2 1/2]
472
+ [ 0 0 0 1 -1 0 0 1 0]
473
+ [ 0 0 0 0 0 1 0 -2 1]
474
+ [ 0 0 0 0 0 0 1 -2 1]
475
+
476
+ sage: M = ModularSymbols(40,2)
477
+ sage: Mmc = M.minus_submodule().cuspidal_submodule()
478
+ sage: Mcm = M.cuspidal_submodule().minus_submodule()
479
+ sage: Mcm.dual_free_module() == Mmc.dual_free_module()
480
+ True
481
+ sage: Mcm.dual_free_module()
482
+ Vector space of degree 13 and dimension 3 over Rational Field
483
+ Basis matrix:
484
+ [ 0 1 0 0 0 0 1 0 -1 -1 1 -1 0]
485
+ [ 0 0 1 0 -1 0 -1 0 1 0 0 0 0]
486
+ [ 0 0 0 0 0 1 1 0 -1 0 0 0 0]
487
+
488
+ sage: M = ModularSymbols(43).cuspidal_submodule()
489
+ sage: S = M[0].plus_submodule() + M[1].minus_submodule()
490
+ sage: S.dual_free_module(use_star=False)
491
+ Traceback (most recent call last):
492
+ ...
493
+ RuntimeError: Computation of complementary space failed (cut down to rank 7, but should have cut down to rank 4).
494
+ sage: S.dual_free_module().dimension() == S.dimension()
495
+ True
496
+
497
+ We test that :issue:`5080` is fixed::
498
+
499
+ sage: EllipticCurve('128a').congruence_number() # needs sympow
500
+ 32
501
+ """
502
+
503
+ # if we know the complement we can read off the dual module
504
+ if self.complement.is_in_cache():
505
+ verbose('This module knows its complement already -- cheating in dual_free_module')
506
+ C = self.complement()
507
+ return C.basis_matrix().right_kernel()
508
+
509
+ verbose("computing dual")
510
+
511
+ A = self.ambient_hecke_module()
512
+
513
+ if self.dimension() == 0:
514
+ return A.zero_submodule()
515
+
516
+ if A.dimension() == self.dimension():
517
+ return A.free_module()
518
+
519
+ # ALGORITHM: Compute the char poly of each Hecke operator on
520
+ # the submodule, then use it to cut out a submodule of the
521
+ # dual. If the dimension cuts down to the dimension of self
522
+ # terminate with success. If it stays larger beyond the Sturm
523
+ # bound, raise a RuntimeError exception.
524
+
525
+ # In the case that the sign of self is not 1, we need to use
526
+ # the star involution as well as the Hecke operators in order
527
+ # to find the dual of self.
528
+ #
529
+ # Note that one needs to comment out the line caching the
530
+ # result of this computation below in order to get meaningful
531
+ # timings.
532
+
533
+ # If the star involution doesn't make sense for self, then we
534
+ # can't use it.
535
+ if not hasattr(self, 'star_eigenvalues'):
536
+ use_star = False
537
+
538
+ if use_star:
539
+ # If the star involution has both + and - eigenspaces on self,
540
+ # then we compute the dual on each eigenspace, then put them
541
+ # together.
542
+ if len(self.star_eigenvalues()) == 2:
543
+ V = self.plus_submodule(compute_dual=False).dual_free_module() + \
544
+ self.minus_submodule(compute_dual=False).dual_free_module()
545
+ return V
546
+
547
+ # At this point, we know that self is an eigenspace for star.
548
+ V = A.sign_submodule(self.sign()).dual_free_module()
549
+ else:
550
+ V = A.free_module()
551
+
552
+ N = self.level()
553
+ p = 2
554
+ if bound is None:
555
+ bound = A.hecke_bound()
556
+ while True:
557
+ if anemic:
558
+ while N % p == 0:
559
+ p = arith.next_prime(p)
560
+ verbose("using T_%s" % p)
561
+ f = self.hecke_polynomial(p)
562
+ T = A.dual_hecke_matrix(p)
563
+ V = T.kernel_on(V, poly=f, check=False)
564
+ if V.dimension() <= self.dimension():
565
+ break
566
+ p = arith.next_prime(p)
567
+ if p > bound:
568
+ break
569
+
570
+ if V.rank() == self.rank():
571
+ return V
572
+
573
+ # Failed to reduce V to the appropriate dimension
574
+ W = self.complement()
575
+ V2 = W.basis_matrix().right_kernel()
576
+ if V2.rank() == self.rank():
577
+ return V2
578
+
579
+ raise RuntimeError("Computation of embedded dual vector space failed "
580
+ "(cut down to rank %s, but should have cut down to rank %s)." % (V.rank(), self.rank()))
581
+
582
+ def free_module(self):
583
+ """
584
+ Return the free module corresponding to ``self``.
585
+
586
+ EXAMPLES::
587
+
588
+ sage: M = ModularSymbols(33,2).cuspidal_subspace() ; M
589
+ Modular Symbols subspace of dimension 6 of Modular Symbols space of dimension 9 for Gamma_0(33) of weight 2 with sign 0 over Rational Field
590
+ sage: M.free_module()
591
+ Vector space of degree 9 and dimension 6 over Rational Field
592
+ Basis matrix:
593
+ [ 0 1 0 0 0 0 0 -1 1]
594
+ [ 0 0 1 0 0 0 0 -1 1]
595
+ [ 0 0 0 1 0 0 0 -1 1]
596
+ [ 0 0 0 0 1 0 0 -1 1]
597
+ [ 0 0 0 0 0 1 0 -1 1]
598
+ [ 0 0 0 0 0 0 1 -1 0]
599
+ """
600
+ return self.__submodule
601
+
602
+ def module(self):
603
+ r"""
604
+ Alias for \code{self.free_module()}.
605
+
606
+ EXAMPLES::
607
+
608
+ sage: M = ModularSymbols(17,4).cuspidal_subspace()
609
+ sage: M.free_module() is M.module()
610
+ True
611
+ """
612
+ return self.free_module()
613
+
614
+ def intersection(self, other):
615
+ """
616
+ Return the intersection of ``self`` and ``other``, which must both lie in
617
+ a common ambient space of modular symbols.
618
+
619
+ EXAMPLES::
620
+
621
+ sage: M = ModularSymbols(43, sign=1)
622
+ sage: A = M[0] + M[1]
623
+ sage: B = M[1] + M[2]
624
+ sage: A.dimension(), B.dimension()
625
+ (2, 3)
626
+ sage: C = A.intersection(B); C.dimension()
627
+ 1
628
+
629
+ TESTS::
630
+
631
+ sage: M = ModularSymbols(1,80)
632
+ sage: M.plus_submodule().cuspidal_submodule().sign() # indirect doctest
633
+ 1
634
+ """
635
+ if self.ambient_hecke_module() != other.ambient_hecke_module():
636
+ raise ArithmeticError("intersection only defined for subspaces of"
637
+ " a common ambient modular symbols space")
638
+ if other.is_ambient():
639
+ return self
640
+ if self.is_ambient():
641
+ return other
642
+
643
+ # Neither is ambient
644
+ V = self.free_module().intersection(other.free_module())
645
+ M = self.ambient_hecke_module().submodule(V, check=False)
646
+
647
+ # if sign is nonzero, the intersection will be, too
648
+ # this only makes sense for modular symbols spaces (and hence shouldn't really be in this file)
649
+ try:
650
+ if self.sign():
651
+ M._set_sign(self.sign())
652
+ elif other.sign():
653
+ M._set_sign(other.sign())
654
+ except AttributeError:
655
+ pass
656
+
657
+ return M
658
+
659
+ def is_ambient(self) -> bool:
660
+ r"""
661
+ Return ``True`` if ``self`` is an ambient space of modular symbols.
662
+
663
+ EXAMPLES::
664
+
665
+ sage: M = ModularSymbols(17,4)
666
+ sage: M.cuspidal_subspace().is_ambient()
667
+ False
668
+ sage: A = M.ambient_hecke_module()
669
+ sage: S = A.submodule(A.basis())
670
+ sage: sage.modular.hecke.submodule.HeckeSubmodule.is_ambient(S)
671
+ True
672
+ """
673
+ return self.free_module() == self.ambient_hecke_module().free_module()
674
+
675
+ def is_new(self, p=None) -> bool:
676
+ """
677
+ Return ``True`` if this Hecke module is `p`-new. If `p` is None,
678
+ returns ``True`` if it is new.
679
+
680
+ EXAMPLES::
681
+
682
+ sage: M = ModularSymbols(1,16)
683
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
684
+ sage: S.is_new()
685
+ True
686
+ """
687
+ try:
688
+ return self.__is_new[p]
689
+ except AttributeError:
690
+ self.__is_new = {}
691
+ except KeyError:
692
+ pass
693
+ N = self.ambient_hecke_module().new_submodule(p)
694
+ self.__is_new[p] = self.is_submodule(N)
695
+ return self.__is_new[p]
696
+
697
+ def is_old(self, p=None) -> bool:
698
+ """
699
+ Return ``True`` if this Hecke module is `p`-old. If `p` is ``None``,
700
+ returns ``True`` if it is old.
701
+
702
+ EXAMPLES::
703
+
704
+ sage: M = ModularSymbols(50,2)
705
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.old_submodule().free_module())
706
+ sage: S.is_old()
707
+ True
708
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.new_submodule().free_module())
709
+ sage: S.is_old()
710
+ False
711
+ """
712
+ try:
713
+ return self.__is_old[p]
714
+ except AttributeError:
715
+ self.__is_old = {}
716
+ except KeyError:
717
+ pass
718
+ O = self.ambient_hecke_module().old_submodule(p)
719
+ self.__is_old[p] = self.is_submodule(O)
720
+ return self.__is_old[p]
721
+
722
+ def is_submodule(self, V) -> bool:
723
+ """
724
+ Return ``True`` if and only if ``self`` is a submodule of V.
725
+
726
+ EXAMPLES::
727
+
728
+ sage: M = ModularSymbols(30,4)
729
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
730
+ sage: S.is_submodule(M)
731
+ True
732
+ sage: SS = sage.modular.hecke.submodule.HeckeSubmodule(M, M.old_submodule().free_module())
733
+ sage: S.is_submodule(SS)
734
+ False
735
+ """
736
+ if not isinstance(V, module.HeckeModule_free_module):
737
+ return False
738
+ return self.ambient_hecke_module() == V.ambient_hecke_module() and \
739
+ self.free_module().is_subspace(V.free_module())
740
+
741
+ def linear_combination_of_basis(self, v):
742
+ """
743
+ Return the linear combination of the basis of ``self`` given
744
+ by the entries of `v`.
745
+
746
+ The result can be of different types, and is printed
747
+ accordingly, depending on the type of submodule.
748
+
749
+ EXAMPLES::
750
+
751
+ sage: M = ModularForms(Gamma0(2),12)
752
+
753
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
754
+ sage: S.basis()
755
+ ((1, 0, 0, 0), (0, 1, 0, 0))
756
+ sage: S.linear_combination_of_basis([3, 10])
757
+ (3, 10, 0, 0)
758
+
759
+ sage: S = M.cuspidal_submodule()
760
+ sage: S.basis()
761
+ [q + 252*q^3 - 2048*q^4 + 4830*q^5 + O(q^6), q^2 - 24*q^4 + O(q^6)]
762
+ sage: S.linear_combination_of_basis([3, 10])
763
+ 3*q + 10*q^2 + 756*q^3 - 6384*q^4 + 14490*q^5 + O(q^6)
764
+ """
765
+ x = self.free_module().linear_combination_of_basis(v)
766
+ return self(x)
767
+
768
+ def new_submodule(self, p=None):
769
+ """
770
+ Return the new or `p`-new submodule of this space of modular
771
+ symbols.
772
+
773
+ EXAMPLES::
774
+
775
+ sage: M = ModularSymbols(20,4)
776
+ sage: M.new_submodule()
777
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 18 for Gamma_0(20) of weight 4 with sign 0 over Rational Field
778
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
779
+ sage: S
780
+ Rank 12 submodule of a Hecke module of level 20
781
+ sage: S.new_submodule()
782
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 18 for Gamma_0(20) of weight 4 with sign 0 over Rational Field
783
+ """
784
+ try:
785
+ if self.__is_new[p]:
786
+ return self
787
+ except AttributeError:
788
+ self.__is_new = {}
789
+ except KeyError:
790
+ pass
791
+
792
+ if self.rank() == 0:
793
+ self.__is_new[p] = True
794
+ return self
795
+ try:
796
+ return self.__new_submodule[p]
797
+ except AttributeError:
798
+ self.__new_submodule = {}
799
+ except KeyError:
800
+ pass
801
+
802
+ S = self.ambient_hecke_module().new_submodule(p)
803
+ ns = S.intersection(self)
804
+ if ns.rank() == self.rank():
805
+ self.__is_new[p] = True
806
+ ns.__is_new = {p: True}
807
+ self.__new_submodule[p] = ns
808
+ return ns
809
+
810
+ def nonembedded_free_module(self):
811
+ """
812
+ Return the free module corresponding to ``self`` as an abstract
813
+ free module, i.e. not as an embedded vector space.
814
+
815
+ EXAMPLES::
816
+
817
+ sage: M = ModularSymbols(12,6)
818
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
819
+ sage: S
820
+ Rank 14 submodule of a Hecke module of level 12
821
+ sage: S.nonembedded_free_module()
822
+ Vector space of dimension 14 over Rational Field
823
+ """
824
+ return self.free_module().nonembedded_free_module()
825
+
826
+ def old_submodule(self, p=None):
827
+ r"""
828
+ Return the old or `p`-old submodule of this space of modular
829
+ symbols.
830
+
831
+ EXAMPLES: We compute the old and new submodules of
832
+ `\mathbf{S}_2(\Gamma_0(33))`.
833
+
834
+ ::
835
+
836
+ sage: M = ModularSymbols(33); S = M.cuspidal_submodule(); S
837
+ Modular Symbols subspace of dimension 6 of Modular Symbols space of dimension 9 for Gamma_0(33) of weight 2 with sign 0 over Rational Field
838
+ sage: S.old_submodule()
839
+ Modular Symbols subspace of dimension 4 of Modular Symbols space of dimension 9 for Gamma_0(33) of weight 2 with sign 0 over Rational Field
840
+ sage: S.new_submodule()
841
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 9 for Gamma_0(33) of weight 2 with sign 0 over Rational Field
842
+ """
843
+ try:
844
+ if self.__is_old[p]:
845
+ return self
846
+ except AttributeError:
847
+ self.__is_old = {}
848
+ except KeyError:
849
+ pass
850
+
851
+ if self.rank() == 0:
852
+ self.__is_old[p] = True
853
+ return self
854
+ try:
855
+ return self.__old_submodule[p]
856
+ except AttributeError:
857
+ self.__old_submodule = {}
858
+ except KeyError:
859
+ pass
860
+
861
+ S = self.ambient_hecke_module().old_submodule(p)
862
+ os = S.intersection(self)
863
+ if os.rank() == self.rank():
864
+ self.__is_old[p] = True
865
+ os.__is_old = {p: True}
866
+ self.__old_submodule[p] = os
867
+ return os
868
+
869
+ def rank(self):
870
+ r"""
871
+ Return the rank of ``self`` as a free module over the base ring.
872
+
873
+ EXAMPLES::
874
+
875
+ sage: ModularSymbols(6, 4).cuspidal_subspace().rank()
876
+ 2
877
+ sage: ModularSymbols(6, 4).cuspidal_subspace().dimension()
878
+ 2
879
+ """
880
+ return self.__submodule.rank()
881
+
882
+ def submodule(self, M, Mdual=None, check=True):
883
+ """
884
+ Construct a submodule of ``self`` from the free module M, which
885
+ must be a subspace of ``self``.
886
+
887
+ EXAMPLES::
888
+
889
+ sage: M = ModularSymbols(18,4)
890
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
891
+ sage: S[0]
892
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 18 for Gamma_0(18) of weight 4 with sign 0 over Rational Field
893
+ sage: S.submodule(S[0].free_module())
894
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 18 for Gamma_0(18) of weight 4 with sign 0 over Rational Field
895
+ """
896
+ if not isinstance(M, FreeModule_generic):
897
+ V = self.ambient_module().free_module()
898
+ if isinstance(M, (list, tuple)):
899
+ M = V.span([V(x.element()) for x in M])
900
+ else:
901
+ M = V.span(M)
902
+
903
+ if check:
904
+ if not M.is_submodule(self.free_module()):
905
+ raise TypeError("M (=%s) must be a submodule of the free module (=%s) associated to this module." % (M, self.free_module()))
906
+
907
+ return self.ambient().submodule(M, Mdual, check=check)
908
+
909
+ def submodule_from_nonembedded_module(self, V, Vdual=None, check=True):
910
+ """
911
+ Construct a submodule of ``self`` from V. Here V should be a
912
+ subspace of a vector space whose dimension is the same as that
913
+ of ``self``.
914
+
915
+ INPUT:
916
+
917
+ - ``V`` -- submodule of ambient free module of the same
918
+ rank as the rank of ``self``
919
+
920
+ - ``check`` -- whether to check that V is Hecke
921
+ equivariant
922
+
923
+ OUTPUT: Hecke submodule of self
924
+
925
+ EXAMPLES::
926
+
927
+ sage: M = ModularSymbols(37,2)
928
+ sage: S = sage.modular.hecke.submodule.HeckeSubmodule(M, M.cuspidal_submodule().free_module())
929
+ sage: V = (QQ**4).subspace([[1,-1,0,1/2],[0,0,1,-1/2]])
930
+ sage: S.submodule_from_nonembedded_module(V)
931
+ Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 5 for Gamma_0(37) of weight 2 with sign 0 over Rational Field
932
+ """
933
+ E = self.free_module()
934
+ M_V = V.matrix()
935
+ M_E = E.matrix()
936
+ # We encode the operation of taking the linear combinations of
937
+ # the basis of E given by the basis of V as a single matrix
938
+ # multiplication, since matrix multiplication is (presumed to be)
939
+ # so fast, and their are asymptotically fast algorithms.
940
+ A = M_V * M_E
941
+ V = A.row_space()
942
+ if Vdual is not None:
943
+ E = self.dual_free_module()
944
+ M_Vdual = Vdual.matrix()
945
+ M_E = E.matrix()
946
+ A = M_Vdual * M_E
947
+ Vdual = A.row_space()
948
+ return self.ambient_hecke_module().submodule(V, Vdual, check=check)
949
+
950
+ def hecke_bound(self):
951
+ r"""
952
+ Compute the Hecke bound for ``self``.
953
+
954
+ This is a number `n` such that the `T_m` for `m \leq n`
955
+ generate the Hecke algebra.
956
+
957
+ EXAMPLES::
958
+
959
+ sage: M = ModularSymbols(24,8)
960
+ sage: M.hecke_bound()
961
+ 53
962
+ sage: M.cuspidal_submodule().hecke_bound()
963
+ 32
964
+ sage: M.eisenstein_submodule().hecke_bound()
965
+ 53
966
+ """
967
+ if self.is_cuspidal():
968
+ return self.sturm_bound()
969
+ else:
970
+ return self.ambient_hecke_module().hecke_bound()