passagemath-modules 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.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-modules might be problematic. Click here for more details.

Files changed (808) hide show
  1. passagemath_modules-10.6.31rc3.dist-info/METADATA +281 -0
  2. passagemath_modules-10.6.31rc3.dist-info/RECORD +808 -0
  3. passagemath_modules-10.6.31rc3.dist-info/WHEEL +5 -0
  4. passagemath_modules-10.6.31rc3.dist-info/top_level.txt +2 -0
  5. passagemath_modules.libs/libgcc_s-0cd532bd.so.1 +0 -0
  6. passagemath_modules.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  7. passagemath_modules.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  8. passagemath_modules.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  9. passagemath_modules.libs/libmpc-d8ebe4b5.so.3.3.1 +0 -0
  10. passagemath_modules.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  11. passagemath_modules.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  12. passagemath_modules.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  13. sage/algebras/all__sagemath_modules.py +20 -0
  14. sage/algebras/catalog.py +148 -0
  15. sage/algebras/clifford_algebra.py +3107 -0
  16. sage/algebras/clifford_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  17. sage/algebras/clifford_algebra_element.pxd +16 -0
  18. sage/algebras/clifford_algebra_element.pyx +997 -0
  19. sage/algebras/commutative_dga.py +4252 -0
  20. sage/algebras/exterior_algebra_groebner.cpython-314-x86_64-linux-musl.so +0 -0
  21. sage/algebras/exterior_algebra_groebner.pxd +55 -0
  22. sage/algebras/exterior_algebra_groebner.pyx +727 -0
  23. sage/algebras/finite_dimensional_algebras/all.py +2 -0
  24. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +1029 -0
  25. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  26. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd +12 -0
  27. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +706 -0
  28. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py +196 -0
  29. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +255 -0
  30. sage/algebras/finite_gca.py +528 -0
  31. sage/algebras/group_algebra.py +232 -0
  32. sage/algebras/lie_algebras/abelian.py +197 -0
  33. sage/algebras/lie_algebras/affine_lie_algebra.py +1213 -0
  34. sage/algebras/lie_algebras/all.py +25 -0
  35. sage/algebras/lie_algebras/all__sagemath_modules.py +1 -0
  36. sage/algebras/lie_algebras/bch.py +177 -0
  37. sage/algebras/lie_algebras/bgg_dual_module.py +1184 -0
  38. sage/algebras/lie_algebras/bgg_resolution.py +232 -0
  39. sage/algebras/lie_algebras/center_uea.py +767 -0
  40. sage/algebras/lie_algebras/classical_lie_algebra.py +2516 -0
  41. sage/algebras/lie_algebras/examples.py +683 -0
  42. sage/algebras/lie_algebras/free_lie_algebra.py +973 -0
  43. sage/algebras/lie_algebras/heisenberg.py +820 -0
  44. sage/algebras/lie_algebras/lie_algebra.py +1562 -0
  45. sage/algebras/lie_algebras/lie_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  46. sage/algebras/lie_algebras/lie_algebra_element.pxd +68 -0
  47. sage/algebras/lie_algebras/lie_algebra_element.pyx +2122 -0
  48. sage/algebras/lie_algebras/morphism.py +661 -0
  49. sage/algebras/lie_algebras/nilpotent_lie_algebra.py +457 -0
  50. sage/algebras/lie_algebras/onsager.py +1324 -0
  51. sage/algebras/lie_algebras/poincare_birkhoff_witt.py +816 -0
  52. sage/algebras/lie_algebras/quotient.py +462 -0
  53. sage/algebras/lie_algebras/rank_two_heisenberg_virasoro.py +355 -0
  54. sage/algebras/lie_algebras/representation.py +1040 -0
  55. sage/algebras/lie_algebras/structure_coefficients.py +459 -0
  56. sage/algebras/lie_algebras/subalgebra.py +967 -0
  57. sage/algebras/lie_algebras/symplectic_derivation.py +289 -0
  58. sage/algebras/lie_algebras/verma_module.py +1630 -0
  59. sage/algebras/lie_algebras/virasoro.py +1186 -0
  60. sage/algebras/octonion_algebra.cpython-314-x86_64-linux-musl.so +0 -0
  61. sage/algebras/octonion_algebra.pxd +20 -0
  62. sage/algebras/octonion_algebra.pyx +987 -0
  63. sage/algebras/orlik_solomon.py +907 -0
  64. sage/algebras/orlik_terao.py +779 -0
  65. sage/algebras/steenrod/all.py +7 -0
  66. sage/algebras/steenrod/steenrod_algebra.py +4258 -0
  67. sage/algebras/steenrod/steenrod_algebra_bases.py +1179 -0
  68. sage/algebras/steenrod/steenrod_algebra_misc.py +1167 -0
  69. sage/algebras/steenrod/steenrod_algebra_mult.py +954 -0
  70. sage/algebras/weyl_algebra.py +1126 -0
  71. sage/all__sagemath_modules.py +62 -0
  72. sage/calculus/all__sagemath_modules.py +19 -0
  73. sage/calculus/expr.py +205 -0
  74. sage/calculus/integration.cpython-314-x86_64-linux-musl.so +0 -0
  75. sage/calculus/integration.pyx +698 -0
  76. sage/calculus/interpolation.cpython-314-x86_64-linux-musl.so +0 -0
  77. sage/calculus/interpolation.pxd +13 -0
  78. sage/calculus/interpolation.pyx +387 -0
  79. sage/calculus/interpolators.cpython-314-x86_64-linux-musl.so +0 -0
  80. sage/calculus/interpolators.pyx +326 -0
  81. sage/calculus/ode.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/calculus/ode.pxd +5 -0
  83. sage/calculus/ode.pyx +610 -0
  84. sage/calculus/riemann.cpython-314-x86_64-linux-musl.so +0 -0
  85. sage/calculus/riemann.pyx +1521 -0
  86. sage/calculus/test_sympy.py +201 -0
  87. sage/calculus/transforms/all.py +7 -0
  88. sage/calculus/transforms/dft.py +844 -0
  89. sage/calculus/transforms/dwt.cpython-314-x86_64-linux-musl.so +0 -0
  90. sage/calculus/transforms/dwt.pxd +7 -0
  91. sage/calculus/transforms/dwt.pyx +160 -0
  92. sage/calculus/transforms/fft.cpython-314-x86_64-linux-musl.so +0 -0
  93. sage/calculus/transforms/fft.pxd +12 -0
  94. sage/calculus/transforms/fft.pyx +487 -0
  95. sage/calculus/wester.py +662 -0
  96. sage/coding/abstract_code.py +1108 -0
  97. sage/coding/ag_code.py +868 -0
  98. sage/coding/ag_code_decoders.cpython-314-x86_64-linux-musl.so +0 -0
  99. sage/coding/ag_code_decoders.pyx +2639 -0
  100. sage/coding/all.py +15 -0
  101. sage/coding/bch_code.py +494 -0
  102. sage/coding/binary_code.cpython-314-x86_64-linux-musl.so +0 -0
  103. sage/coding/binary_code.pxd +124 -0
  104. sage/coding/binary_code.pyx +4139 -0
  105. sage/coding/bounds_catalog.py +43 -0
  106. sage/coding/channel.py +819 -0
  107. sage/coding/channels_catalog.py +29 -0
  108. sage/coding/code_bounds.py +755 -0
  109. sage/coding/code_constructions.py +804 -0
  110. sage/coding/codes_catalog.py +111 -0
  111. sage/coding/cyclic_code.py +1329 -0
  112. sage/coding/databases.py +316 -0
  113. sage/coding/decoder.py +373 -0
  114. sage/coding/decoders_catalog.py +88 -0
  115. sage/coding/delsarte_bounds.py +709 -0
  116. sage/coding/encoder.py +390 -0
  117. sage/coding/encoders_catalog.py +64 -0
  118. sage/coding/extended_code.py +468 -0
  119. sage/coding/gabidulin_code.py +1058 -0
  120. sage/coding/golay_code.py +404 -0
  121. sage/coding/goppa_code.py +441 -0
  122. sage/coding/grs_code.py +2371 -0
  123. sage/coding/guava.py +107 -0
  124. sage/coding/guruswami_sudan/all.py +1 -0
  125. sage/coding/guruswami_sudan/gs_decoder.py +897 -0
  126. sage/coding/guruswami_sudan/interpolation.py +409 -0
  127. sage/coding/guruswami_sudan/utils.py +176 -0
  128. sage/coding/hamming_code.py +176 -0
  129. sage/coding/information_set_decoder.py +1032 -0
  130. sage/coding/kasami_codes.cpython-314-x86_64-linux-musl.so +0 -0
  131. sage/coding/kasami_codes.pyx +351 -0
  132. sage/coding/linear_code.py +3067 -0
  133. sage/coding/linear_code_no_metric.py +1354 -0
  134. sage/coding/linear_rank_metric.py +961 -0
  135. sage/coding/parity_check_code.py +353 -0
  136. sage/coding/punctured_code.py +719 -0
  137. sage/coding/reed_muller_code.py +999 -0
  138. sage/coding/self_dual_codes.py +942 -0
  139. sage/coding/source_coding/all.py +2 -0
  140. sage/coding/source_coding/huffman.py +553 -0
  141. sage/coding/subfield_subcode.py +423 -0
  142. sage/coding/two_weight_db.py +399 -0
  143. sage/combinat/all__sagemath_modules.py +7 -0
  144. sage/combinat/cartesian_product.py +347 -0
  145. sage/combinat/family.py +11 -0
  146. sage/combinat/free_module.py +1977 -0
  147. sage/combinat/root_system/all.py +147 -0
  148. sage/combinat/root_system/ambient_space.py +527 -0
  149. sage/combinat/root_system/associahedron.py +471 -0
  150. sage/combinat/root_system/braid_move_calculator.py +143 -0
  151. sage/combinat/root_system/braid_orbit.cpython-314-x86_64-linux-musl.so +0 -0
  152. sage/combinat/root_system/braid_orbit.pyx +144 -0
  153. sage/combinat/root_system/branching_rules.py +2301 -0
  154. sage/combinat/root_system/cartan_matrix.py +1245 -0
  155. sage/combinat/root_system/cartan_type.py +3069 -0
  156. sage/combinat/root_system/coxeter_group.py +162 -0
  157. sage/combinat/root_system/coxeter_matrix.py +1261 -0
  158. sage/combinat/root_system/coxeter_type.py +681 -0
  159. sage/combinat/root_system/dynkin_diagram.py +900 -0
  160. sage/combinat/root_system/extended_affine_weyl_group.py +2993 -0
  161. sage/combinat/root_system/fundamental_group.py +795 -0
  162. sage/combinat/root_system/hecke_algebra_representation.py +1203 -0
  163. sage/combinat/root_system/integrable_representations.py +1227 -0
  164. sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +1965 -0
  165. sage/combinat/root_system/pieri_factors.py +1147 -0
  166. sage/combinat/root_system/plot.py +1615 -0
  167. sage/combinat/root_system/root_lattice_realization_algebras.py +1214 -0
  168. sage/combinat/root_system/root_lattice_realizations.py +4628 -0
  169. sage/combinat/root_system/root_space.py +487 -0
  170. sage/combinat/root_system/root_system.py +882 -0
  171. sage/combinat/root_system/type_A.py +348 -0
  172. sage/combinat/root_system/type_A_affine.py +227 -0
  173. sage/combinat/root_system/type_A_infinity.py +241 -0
  174. sage/combinat/root_system/type_B.py +347 -0
  175. sage/combinat/root_system/type_BC_affine.py +287 -0
  176. sage/combinat/root_system/type_B_affine.py +216 -0
  177. sage/combinat/root_system/type_C.py +317 -0
  178. sage/combinat/root_system/type_C_affine.py +188 -0
  179. sage/combinat/root_system/type_D.py +357 -0
  180. sage/combinat/root_system/type_D_affine.py +208 -0
  181. sage/combinat/root_system/type_E.py +641 -0
  182. sage/combinat/root_system/type_E_affine.py +231 -0
  183. sage/combinat/root_system/type_F.py +387 -0
  184. sage/combinat/root_system/type_F_affine.py +137 -0
  185. sage/combinat/root_system/type_G.py +293 -0
  186. sage/combinat/root_system/type_G_affine.py +132 -0
  187. sage/combinat/root_system/type_H.py +105 -0
  188. sage/combinat/root_system/type_I.py +110 -0
  189. sage/combinat/root_system/type_Q.py +150 -0
  190. sage/combinat/root_system/type_affine.py +509 -0
  191. sage/combinat/root_system/type_dual.py +704 -0
  192. sage/combinat/root_system/type_folded.py +301 -0
  193. sage/combinat/root_system/type_marked.py +748 -0
  194. sage/combinat/root_system/type_reducible.py +601 -0
  195. sage/combinat/root_system/type_relabel.py +730 -0
  196. sage/combinat/root_system/type_super_A.py +837 -0
  197. sage/combinat/root_system/weight_lattice_realizations.py +1188 -0
  198. sage/combinat/root_system/weight_space.py +639 -0
  199. sage/combinat/root_system/weyl_characters.py +2238 -0
  200. sage/crypto/__init__.py +4 -0
  201. sage/crypto/all.py +28 -0
  202. sage/crypto/block_cipher/all.py +7 -0
  203. sage/crypto/block_cipher/des.py +1065 -0
  204. sage/crypto/block_cipher/miniaes.py +2171 -0
  205. sage/crypto/block_cipher/present.py +909 -0
  206. sage/crypto/block_cipher/sdes.py +1527 -0
  207. sage/crypto/boolean_function.cpython-314-x86_64-linux-musl.so +0 -0
  208. sage/crypto/boolean_function.pxd +10 -0
  209. sage/crypto/boolean_function.pyx +1487 -0
  210. sage/crypto/cipher.py +78 -0
  211. sage/crypto/classical.py +3668 -0
  212. sage/crypto/classical_cipher.py +569 -0
  213. sage/crypto/cryptosystem.py +387 -0
  214. sage/crypto/key_exchange/all.py +7 -0
  215. sage/crypto/key_exchange/catalog.py +24 -0
  216. sage/crypto/key_exchange/diffie_hellman.py +323 -0
  217. sage/crypto/key_exchange/key_exchange_scheme.py +107 -0
  218. sage/crypto/lattice.py +312 -0
  219. sage/crypto/lfsr.py +295 -0
  220. sage/crypto/lwe.py +840 -0
  221. sage/crypto/mq/__init__.py +4 -0
  222. sage/crypto/mq/mpolynomialsystemgenerator.py +204 -0
  223. sage/crypto/mq/rijndael_gf.py +2345 -0
  224. sage/crypto/mq/sbox.py +7 -0
  225. sage/crypto/mq/sr.py +3344 -0
  226. sage/crypto/public_key/all.py +5 -0
  227. sage/crypto/public_key/blum_goldwasser.py +776 -0
  228. sage/crypto/sbox.cpython-314-x86_64-linux-musl.so +0 -0
  229. sage/crypto/sbox.pyx +2090 -0
  230. sage/crypto/sboxes.py +2090 -0
  231. sage/crypto/stream.py +390 -0
  232. sage/crypto/stream_cipher.py +297 -0
  233. sage/crypto/util.py +519 -0
  234. sage/ext/all__sagemath_modules.py +1 -0
  235. sage/ext/interpreters/__init__.py +1 -0
  236. sage/ext/interpreters/all__sagemath_modules.py +2 -0
  237. sage/ext/interpreters/wrapper_cc.cpython-314-x86_64-linux-musl.so +0 -0
  238. sage/ext/interpreters/wrapper_cc.pxd +30 -0
  239. sage/ext/interpreters/wrapper_cc.pyx +252 -0
  240. sage/ext/interpreters/wrapper_cdf.cpython-314-x86_64-linux-musl.so +0 -0
  241. sage/ext/interpreters/wrapper_cdf.pxd +26 -0
  242. sage/ext/interpreters/wrapper_cdf.pyx +245 -0
  243. sage/ext/interpreters/wrapper_rdf.cpython-314-x86_64-linux-musl.so +0 -0
  244. sage/ext/interpreters/wrapper_rdf.pxd +23 -0
  245. sage/ext/interpreters/wrapper_rdf.pyx +221 -0
  246. sage/ext/interpreters/wrapper_rr.cpython-314-x86_64-linux-musl.so +0 -0
  247. sage/ext/interpreters/wrapper_rr.pxd +28 -0
  248. sage/ext/interpreters/wrapper_rr.pyx +335 -0
  249. sage/geometry/all__sagemath_modules.py +5 -0
  250. sage/geometry/toric_lattice.py +1745 -0
  251. sage/geometry/toric_lattice_element.cpython-314-x86_64-linux-musl.so +0 -0
  252. sage/geometry/toric_lattice_element.pyx +432 -0
  253. sage/groups/abelian_gps/abelian_group.py +1925 -0
  254. sage/groups/abelian_gps/abelian_group_element.py +164 -0
  255. sage/groups/abelian_gps/all__sagemath_modules.py +5 -0
  256. sage/groups/abelian_gps/dual_abelian_group.py +421 -0
  257. sage/groups/abelian_gps/dual_abelian_group_element.py +179 -0
  258. sage/groups/abelian_gps/element_base.py +341 -0
  259. sage/groups/abelian_gps/values.py +488 -0
  260. sage/groups/additive_abelian/additive_abelian_group.py +476 -0
  261. sage/groups/additive_abelian/additive_abelian_wrapper.py +857 -0
  262. sage/groups/additive_abelian/all.py +4 -0
  263. sage/groups/additive_abelian/qmodnz.py +231 -0
  264. sage/groups/additive_abelian/qmodnz_element.py +349 -0
  265. sage/groups/affine_gps/affine_group.py +535 -0
  266. sage/groups/affine_gps/all.py +1 -0
  267. sage/groups/affine_gps/catalog.py +17 -0
  268. sage/groups/affine_gps/euclidean_group.py +246 -0
  269. sage/groups/affine_gps/group_element.py +562 -0
  270. sage/groups/all__sagemath_modules.py +12 -0
  271. sage/groups/galois_group.py +479 -0
  272. sage/groups/matrix_gps/all.py +4 -0
  273. sage/groups/matrix_gps/all__sagemath_modules.py +13 -0
  274. sage/groups/matrix_gps/catalog.py +26 -0
  275. sage/groups/matrix_gps/coxeter_group.py +927 -0
  276. sage/groups/matrix_gps/finitely_generated.py +487 -0
  277. sage/groups/matrix_gps/group_element.cpython-314-x86_64-linux-musl.so +0 -0
  278. sage/groups/matrix_gps/group_element.pxd +11 -0
  279. sage/groups/matrix_gps/group_element.pyx +431 -0
  280. sage/groups/matrix_gps/linear.py +440 -0
  281. sage/groups/matrix_gps/matrix_group.py +617 -0
  282. sage/groups/matrix_gps/named_group.py +296 -0
  283. sage/groups/matrix_gps/orthogonal.py +544 -0
  284. sage/groups/matrix_gps/symplectic.py +251 -0
  285. sage/groups/matrix_gps/unitary.py +436 -0
  286. sage/groups/misc_gps/all__sagemath_modules.py +1 -0
  287. sage/groups/misc_gps/argument_groups.py +1905 -0
  288. sage/groups/misc_gps/imaginary_groups.py +479 -0
  289. sage/groups/perm_gps/all__sagemath_modules.py +1 -0
  290. sage/groups/perm_gps/partn_ref/all__sagemath_modules.py +1 -0
  291. sage/groups/perm_gps/partn_ref/refinement_binary.cpython-314-x86_64-linux-musl.so +0 -0
  292. sage/groups/perm_gps/partn_ref/refinement_binary.pxd +41 -0
  293. sage/groups/perm_gps/partn_ref/refinement_binary.pyx +1167 -0
  294. sage/groups/perm_gps/partn_ref/refinement_matrices.cpython-314-x86_64-linux-musl.so +0 -0
  295. sage/groups/perm_gps/partn_ref/refinement_matrices.pxd +31 -0
  296. sage/groups/perm_gps/partn_ref/refinement_matrices.pyx +385 -0
  297. sage/homology/algebraic_topological_model.py +595 -0
  298. sage/homology/all.py +2 -0
  299. sage/homology/all__sagemath_modules.py +8 -0
  300. sage/homology/chain_complex.py +2148 -0
  301. sage/homology/chain_complex_homspace.py +165 -0
  302. sage/homology/chain_complex_morphism.py +629 -0
  303. sage/homology/chain_homotopy.py +604 -0
  304. sage/homology/chains.py +653 -0
  305. sage/homology/free_resolution.py +923 -0
  306. sage/homology/graded_resolution.py +567 -0
  307. sage/homology/hochschild_complex.py +756 -0
  308. sage/homology/homology_group.py +188 -0
  309. sage/homology/homology_morphism.py +422 -0
  310. sage/homology/homology_vector_space_with_basis.py +1454 -0
  311. sage/homology/koszul_complex.py +169 -0
  312. sage/homology/matrix_utils.py +205 -0
  313. sage/libs/all__sagemath_modules.py +1 -0
  314. sage/libs/gsl/__init__.py +1 -0
  315. sage/libs/gsl/airy.pxd +56 -0
  316. sage/libs/gsl/all.pxd +66 -0
  317. sage/libs/gsl/array.cpython-314-x86_64-linux-musl.so +0 -0
  318. sage/libs/gsl/array.pxd +5 -0
  319. sage/libs/gsl/array.pyx +102 -0
  320. sage/libs/gsl/bessel.pxd +208 -0
  321. sage/libs/gsl/blas.pxd +116 -0
  322. sage/libs/gsl/blas_types.pxd +34 -0
  323. sage/libs/gsl/block.pxd +52 -0
  324. sage/libs/gsl/chebyshev.pxd +37 -0
  325. sage/libs/gsl/clausen.pxd +12 -0
  326. sage/libs/gsl/combination.pxd +47 -0
  327. sage/libs/gsl/complex.pxd +151 -0
  328. sage/libs/gsl/coulomb.pxd +30 -0
  329. sage/libs/gsl/coupling.pxd +21 -0
  330. sage/libs/gsl/dawson.pxd +12 -0
  331. sage/libs/gsl/debye.pxd +24 -0
  332. sage/libs/gsl/dilog.pxd +14 -0
  333. sage/libs/gsl/eigen.pxd +46 -0
  334. sage/libs/gsl/elementary.pxd +12 -0
  335. sage/libs/gsl/ellint.pxd +48 -0
  336. sage/libs/gsl/elljac.pxd +8 -0
  337. sage/libs/gsl/erf.pxd +32 -0
  338. sage/libs/gsl/errno.pxd +26 -0
  339. sage/libs/gsl/exp.pxd +44 -0
  340. sage/libs/gsl/expint.pxd +44 -0
  341. sage/libs/gsl/fermi_dirac.pxd +44 -0
  342. sage/libs/gsl/fft.pxd +121 -0
  343. sage/libs/gsl/fit.pxd +50 -0
  344. sage/libs/gsl/gamma.pxd +94 -0
  345. sage/libs/gsl/gegenbauer.pxd +26 -0
  346. sage/libs/gsl/histogram.pxd +176 -0
  347. sage/libs/gsl/hyperg.pxd +52 -0
  348. sage/libs/gsl/integration.pxd +69 -0
  349. sage/libs/gsl/interp.pxd +109 -0
  350. sage/libs/gsl/laguerre.pxd +24 -0
  351. sage/libs/gsl/lambert.pxd +16 -0
  352. sage/libs/gsl/legendre.pxd +90 -0
  353. sage/libs/gsl/linalg.pxd +185 -0
  354. sage/libs/gsl/log.pxd +26 -0
  355. sage/libs/gsl/math.pxd +43 -0
  356. sage/libs/gsl/matrix.pxd +143 -0
  357. sage/libs/gsl/matrix_complex.pxd +130 -0
  358. sage/libs/gsl/min.pxd +67 -0
  359. sage/libs/gsl/monte.pxd +56 -0
  360. sage/libs/gsl/ntuple.pxd +32 -0
  361. sage/libs/gsl/odeiv.pxd +70 -0
  362. sage/libs/gsl/permutation.pxd +78 -0
  363. sage/libs/gsl/poly.pxd +40 -0
  364. sage/libs/gsl/pow_int.pxd +12 -0
  365. sage/libs/gsl/psi.pxd +28 -0
  366. sage/libs/gsl/qrng.pxd +29 -0
  367. sage/libs/gsl/random.pxd +257 -0
  368. sage/libs/gsl/rng.pxd +100 -0
  369. sage/libs/gsl/roots.pxd +72 -0
  370. sage/libs/gsl/sort.pxd +36 -0
  371. sage/libs/gsl/statistics.pxd +59 -0
  372. sage/libs/gsl/sum.pxd +55 -0
  373. sage/libs/gsl/synchrotron.pxd +16 -0
  374. sage/libs/gsl/transport.pxd +24 -0
  375. sage/libs/gsl/trig.pxd +58 -0
  376. sage/libs/gsl/types.pxd +137 -0
  377. sage/libs/gsl/vector.pxd +101 -0
  378. sage/libs/gsl/vector_complex.pxd +83 -0
  379. sage/libs/gsl/wavelet.pxd +49 -0
  380. sage/libs/gsl/zeta.pxd +28 -0
  381. sage/libs/mpc/__init__.pxd +114 -0
  382. sage/libs/mpc/types.pxd +28 -0
  383. sage/libs/mpfr/__init__.pxd +299 -0
  384. sage/libs/mpfr/types.pxd +26 -0
  385. sage/libs/mpmath/__init__.py +1 -0
  386. sage/libs/mpmath/all.py +27 -0
  387. sage/libs/mpmath/all__sagemath_modules.py +1 -0
  388. sage/libs/mpmath/utils.cpython-314-x86_64-linux-musl.so +0 -0
  389. sage/libs/mpmath/utils.pxd +4 -0
  390. sage/libs/mpmath/utils.pyx +319 -0
  391. sage/matrix/action.cpython-314-x86_64-linux-musl.so +0 -0
  392. sage/matrix/action.pxd +26 -0
  393. sage/matrix/action.pyx +596 -0
  394. sage/matrix/all.py +9 -0
  395. sage/matrix/args.cpython-314-x86_64-linux-musl.so +0 -0
  396. sage/matrix/args.pxd +144 -0
  397. sage/matrix/args.pyx +1668 -0
  398. sage/matrix/benchmark.py +1258 -0
  399. sage/matrix/berlekamp_massey.py +95 -0
  400. sage/matrix/compute_J_ideal.py +926 -0
  401. sage/matrix/constructor.cpython-314-x86_64-linux-musl.so +0 -0
  402. sage/matrix/constructor.pyx +750 -0
  403. sage/matrix/docs.py +430 -0
  404. sage/matrix/echelon_matrix.cpython-314-x86_64-linux-musl.so +0 -0
  405. sage/matrix/echelon_matrix.pyx +155 -0
  406. sage/matrix/matrix.pxd +2 -0
  407. sage/matrix/matrix0.cpython-314-x86_64-linux-musl.so +0 -0
  408. sage/matrix/matrix0.pxd +68 -0
  409. sage/matrix/matrix0.pyx +6324 -0
  410. sage/matrix/matrix1.cpython-314-x86_64-linux-musl.so +0 -0
  411. sage/matrix/matrix1.pxd +8 -0
  412. sage/matrix/matrix1.pyx +2851 -0
  413. sage/matrix/matrix2.cpython-314-x86_64-linux-musl.so +0 -0
  414. sage/matrix/matrix2.pxd +25 -0
  415. sage/matrix/matrix2.pyx +20181 -0
  416. sage/matrix/matrix_cdv.cpython-314-x86_64-linux-musl.so +0 -0
  417. sage/matrix/matrix_cdv.pxd +4 -0
  418. sage/matrix/matrix_cdv.pyx +93 -0
  419. sage/matrix/matrix_complex_double_dense.cpython-314-x86_64-linux-musl.so +0 -0
  420. sage/matrix/matrix_complex_double_dense.pxd +5 -0
  421. sage/matrix/matrix_complex_double_dense.pyx +98 -0
  422. sage/matrix/matrix_dense.cpython-314-x86_64-linux-musl.so +0 -0
  423. sage/matrix/matrix_dense.pxd +5 -0
  424. sage/matrix/matrix_dense.pyx +343 -0
  425. sage/matrix/matrix_domain_dense.pxd +5 -0
  426. sage/matrix/matrix_domain_sparse.pxd +5 -0
  427. sage/matrix/matrix_double_dense.cpython-314-x86_64-linux-musl.so +0 -0
  428. sage/matrix/matrix_double_dense.pxd +7 -0
  429. sage/matrix/matrix_double_dense.pyx +3906 -0
  430. sage/matrix/matrix_double_sparse.cpython-314-x86_64-linux-musl.so +0 -0
  431. sage/matrix/matrix_double_sparse.pxd +6 -0
  432. sage/matrix/matrix_double_sparse.pyx +248 -0
  433. sage/matrix/matrix_generic_dense.cpython-314-x86_64-linux-musl.so +0 -0
  434. sage/matrix/matrix_generic_dense.pxd +7 -0
  435. sage/matrix/matrix_generic_dense.pyx +354 -0
  436. sage/matrix/matrix_generic_sparse.cpython-314-x86_64-linux-musl.so +0 -0
  437. sage/matrix/matrix_generic_sparse.pxd +7 -0
  438. sage/matrix/matrix_generic_sparse.pyx +461 -0
  439. sage/matrix/matrix_laurent_mpolynomial_dense.cpython-314-x86_64-linux-musl.so +0 -0
  440. sage/matrix/matrix_laurent_mpolynomial_dense.pxd +5 -0
  441. sage/matrix/matrix_laurent_mpolynomial_dense.pyx +115 -0
  442. sage/matrix/matrix_misc.py +313 -0
  443. sage/matrix/matrix_numpy_dense.cpython-314-x86_64-linux-musl.so +0 -0
  444. sage/matrix/matrix_numpy_dense.pxd +14 -0
  445. sage/matrix/matrix_numpy_dense.pyx +450 -0
  446. sage/matrix/matrix_numpy_integer_dense.cpython-314-x86_64-linux-musl.so +0 -0
  447. sage/matrix/matrix_numpy_integer_dense.pxd +7 -0
  448. sage/matrix/matrix_numpy_integer_dense.pyx +59 -0
  449. sage/matrix/matrix_polynomial_dense.cpython-314-x86_64-linux-musl.so +0 -0
  450. sage/matrix/matrix_polynomial_dense.pxd +5 -0
  451. sage/matrix/matrix_polynomial_dense.pyx +5341 -0
  452. sage/matrix/matrix_real_double_dense.cpython-314-x86_64-linux-musl.so +0 -0
  453. sage/matrix/matrix_real_double_dense.pxd +7 -0
  454. sage/matrix/matrix_real_double_dense.pyx +122 -0
  455. sage/matrix/matrix_space.py +2848 -0
  456. sage/matrix/matrix_sparse.cpython-314-x86_64-linux-musl.so +0 -0
  457. sage/matrix/matrix_sparse.pxd +5 -0
  458. sage/matrix/matrix_sparse.pyx +1222 -0
  459. sage/matrix/matrix_window.cpython-314-x86_64-linux-musl.so +0 -0
  460. sage/matrix/matrix_window.pxd +37 -0
  461. sage/matrix/matrix_window.pyx +242 -0
  462. sage/matrix/misc_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  463. sage/matrix/misc_mpfr.pyx +80 -0
  464. sage/matrix/operation_table.py +1182 -0
  465. sage/matrix/special.py +3666 -0
  466. sage/matrix/strassen.cpython-314-x86_64-linux-musl.so +0 -0
  467. sage/matrix/strassen.pyx +851 -0
  468. sage/matrix/symplectic_basis.py +541 -0
  469. sage/matrix/template.pxd +6 -0
  470. sage/matrix/tests.py +71 -0
  471. sage/matroids/advanced.py +77 -0
  472. sage/matroids/all.py +13 -0
  473. sage/matroids/basis_exchange_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  474. sage/matroids/basis_exchange_matroid.pxd +96 -0
  475. sage/matroids/basis_exchange_matroid.pyx +2344 -0
  476. sage/matroids/basis_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  477. sage/matroids/basis_matroid.pxd +45 -0
  478. sage/matroids/basis_matroid.pyx +1217 -0
  479. sage/matroids/catalog.py +44 -0
  480. sage/matroids/chow_ring.py +473 -0
  481. sage/matroids/chow_ring_ideal.py +849 -0
  482. sage/matroids/circuit_closures_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  483. sage/matroids/circuit_closures_matroid.pxd +16 -0
  484. sage/matroids/circuit_closures_matroid.pyx +559 -0
  485. sage/matroids/circuits_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  486. sage/matroids/circuits_matroid.pxd +38 -0
  487. sage/matroids/circuits_matroid.pyx +947 -0
  488. sage/matroids/constructor.py +1086 -0
  489. sage/matroids/database_collections.py +365 -0
  490. sage/matroids/database_matroids.py +5338 -0
  491. sage/matroids/dual_matroid.py +583 -0
  492. sage/matroids/extension.cpython-314-x86_64-linux-musl.so +0 -0
  493. sage/matroids/extension.pxd +34 -0
  494. sage/matroids/extension.pyx +519 -0
  495. sage/matroids/flats_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  496. sage/matroids/flats_matroid.pxd +28 -0
  497. sage/matroids/flats_matroid.pyx +715 -0
  498. sage/matroids/gammoid.py +600 -0
  499. sage/matroids/graphic_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  500. sage/matroids/graphic_matroid.pxd +39 -0
  501. sage/matroids/graphic_matroid.pyx +2024 -0
  502. sage/matroids/lean_matrix.cpython-314-x86_64-linux-musl.so +0 -0
  503. sage/matroids/lean_matrix.pxd +126 -0
  504. sage/matroids/lean_matrix.pyx +3667 -0
  505. sage/matroids/linear_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  506. sage/matroids/linear_matroid.pxd +180 -0
  507. sage/matroids/linear_matroid.pyx +6649 -0
  508. sage/matroids/matroid.cpython-314-x86_64-linux-musl.so +0 -0
  509. sage/matroids/matroid.pxd +243 -0
  510. sage/matroids/matroid.pyx +8759 -0
  511. sage/matroids/matroids_catalog.py +190 -0
  512. sage/matroids/matroids_plot_helpers.py +890 -0
  513. sage/matroids/minor_matroid.py +480 -0
  514. sage/matroids/minorfix.h +9 -0
  515. sage/matroids/named_matroids.py +5 -0
  516. sage/matroids/rank_matroid.py +268 -0
  517. sage/matroids/set_system.cpython-314-x86_64-linux-musl.so +0 -0
  518. sage/matroids/set_system.pxd +38 -0
  519. sage/matroids/set_system.pyx +800 -0
  520. sage/matroids/transversal_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  521. sage/matroids/transversal_matroid.pxd +14 -0
  522. sage/matroids/transversal_matroid.pyx +893 -0
  523. sage/matroids/union_matroid.cpython-314-x86_64-linux-musl.so +0 -0
  524. sage/matroids/union_matroid.pxd +20 -0
  525. sage/matroids/union_matroid.pyx +331 -0
  526. sage/matroids/unpickling.cpython-314-x86_64-linux-musl.so +0 -0
  527. sage/matroids/unpickling.pyx +843 -0
  528. sage/matroids/utilities.py +809 -0
  529. sage/misc/all__sagemath_modules.py +20 -0
  530. sage/misc/c3.cpython-314-x86_64-linux-musl.so +0 -0
  531. sage/misc/c3.pyx +238 -0
  532. sage/misc/compat.py +87 -0
  533. sage/misc/element_with_label.py +173 -0
  534. sage/misc/func_persist.py +79 -0
  535. sage/misc/pickle_old.cpython-314-x86_64-linux-musl.so +0 -0
  536. sage/misc/pickle_old.pyx +19 -0
  537. sage/misc/proof.py +7 -0
  538. sage/misc/replace_dot_all.py +472 -0
  539. sage/misc/sagedoc_conf.py +168 -0
  540. sage/misc/sphinxify.py +167 -0
  541. sage/misc/test_class_pickling.py +85 -0
  542. sage/modules/all.py +42 -0
  543. sage/modules/complex_double_vector.py +25 -0
  544. sage/modules/diamond_cutting.py +380 -0
  545. sage/modules/fg_pid/all.py +1 -0
  546. sage/modules/fg_pid/fgp_element.py +456 -0
  547. sage/modules/fg_pid/fgp_module.py +2091 -0
  548. sage/modules/fg_pid/fgp_morphism.py +550 -0
  549. sage/modules/filtered_vector_space.py +1271 -0
  550. sage/modules/finite_submodule_iter.cpython-314-x86_64-linux-musl.so +0 -0
  551. sage/modules/finite_submodule_iter.pxd +27 -0
  552. sage/modules/finite_submodule_iter.pyx +452 -0
  553. sage/modules/fp_graded/all.py +1 -0
  554. sage/modules/fp_graded/element.py +346 -0
  555. sage/modules/fp_graded/free_element.py +298 -0
  556. sage/modules/fp_graded/free_homspace.py +53 -0
  557. sage/modules/fp_graded/free_module.py +1060 -0
  558. sage/modules/fp_graded/free_morphism.py +217 -0
  559. sage/modules/fp_graded/homspace.py +563 -0
  560. sage/modules/fp_graded/module.py +1340 -0
  561. sage/modules/fp_graded/morphism.py +1990 -0
  562. sage/modules/fp_graded/steenrod/all.py +1 -0
  563. sage/modules/fp_graded/steenrod/homspace.py +65 -0
  564. sage/modules/fp_graded/steenrod/module.py +477 -0
  565. sage/modules/fp_graded/steenrod/morphism.py +404 -0
  566. sage/modules/fp_graded/steenrod/profile.py +241 -0
  567. sage/modules/free_module.py +8447 -0
  568. sage/modules/free_module_element.cpython-314-x86_64-linux-musl.so +0 -0
  569. sage/modules/free_module_element.pxd +22 -0
  570. sage/modules/free_module_element.pyx +5445 -0
  571. sage/modules/free_module_homspace.py +369 -0
  572. sage/modules/free_module_integer.py +896 -0
  573. sage/modules/free_module_morphism.py +823 -0
  574. sage/modules/free_module_pseudohomspace.py +352 -0
  575. sage/modules/free_module_pseudomorphism.py +578 -0
  576. sage/modules/free_quadratic_module.py +1706 -0
  577. sage/modules/free_quadratic_module_integer_symmetric.py +1790 -0
  578. sage/modules/matrix_morphism.py +1745 -0
  579. sage/modules/misc.py +103 -0
  580. sage/modules/module_functors.py +192 -0
  581. sage/modules/multi_filtered_vector_space.py +719 -0
  582. sage/modules/ore_module.py +2208 -0
  583. sage/modules/ore_module_element.py +178 -0
  584. sage/modules/ore_module_homspace.py +147 -0
  585. sage/modules/ore_module_morphism.py +968 -0
  586. sage/modules/quotient_module.py +699 -0
  587. sage/modules/real_double_vector.py +22 -0
  588. sage/modules/submodule.py +255 -0
  589. sage/modules/tensor_operations.py +567 -0
  590. sage/modules/torsion_quadratic_module.py +1352 -0
  591. sage/modules/tutorial_free_modules.py +248 -0
  592. sage/modules/vector_complex_double_dense.cpython-314-x86_64-linux-musl.so +0 -0
  593. sage/modules/vector_complex_double_dense.pxd +6 -0
  594. sage/modules/vector_complex_double_dense.pyx +117 -0
  595. sage/modules/vector_double_dense.cpython-314-x86_64-linux-musl.so +0 -0
  596. sage/modules/vector_double_dense.pxd +6 -0
  597. sage/modules/vector_double_dense.pyx +604 -0
  598. sage/modules/vector_integer_dense.cpython-314-x86_64-linux-musl.so +0 -0
  599. sage/modules/vector_integer_dense.pxd +15 -0
  600. sage/modules/vector_integer_dense.pyx +361 -0
  601. sage/modules/vector_integer_sparse.cpython-314-x86_64-linux-musl.so +0 -0
  602. sage/modules/vector_integer_sparse.pxd +29 -0
  603. sage/modules/vector_integer_sparse.pyx +406 -0
  604. sage/modules/vector_modn_dense.cpython-314-x86_64-linux-musl.so +0 -0
  605. sage/modules/vector_modn_dense.pxd +12 -0
  606. sage/modules/vector_modn_dense.pyx +394 -0
  607. sage/modules/vector_modn_sparse.cpython-314-x86_64-linux-musl.so +0 -0
  608. sage/modules/vector_modn_sparse.pxd +21 -0
  609. sage/modules/vector_modn_sparse.pyx +298 -0
  610. sage/modules/vector_numpy_dense.cpython-314-x86_64-linux-musl.so +0 -0
  611. sage/modules/vector_numpy_dense.pxd +15 -0
  612. sage/modules/vector_numpy_dense.pyx +304 -0
  613. sage/modules/vector_numpy_integer_dense.cpython-314-x86_64-linux-musl.so +0 -0
  614. sage/modules/vector_numpy_integer_dense.pxd +7 -0
  615. sage/modules/vector_numpy_integer_dense.pyx +54 -0
  616. sage/modules/vector_rational_dense.cpython-314-x86_64-linux-musl.so +0 -0
  617. sage/modules/vector_rational_dense.pxd +15 -0
  618. sage/modules/vector_rational_dense.pyx +387 -0
  619. sage/modules/vector_rational_sparse.cpython-314-x86_64-linux-musl.so +0 -0
  620. sage/modules/vector_rational_sparse.pxd +30 -0
  621. sage/modules/vector_rational_sparse.pyx +413 -0
  622. sage/modules/vector_real_double_dense.cpython-314-x86_64-linux-musl.so +0 -0
  623. sage/modules/vector_real_double_dense.pxd +6 -0
  624. sage/modules/vector_real_double_dense.pyx +126 -0
  625. sage/modules/vector_space_homspace.py +430 -0
  626. sage/modules/vector_space_morphism.py +989 -0
  627. sage/modules/with_basis/all.py +15 -0
  628. sage/modules/with_basis/cell_module.py +494 -0
  629. sage/modules/with_basis/indexed_element.cpython-314-x86_64-linux-musl.so +0 -0
  630. sage/modules/with_basis/indexed_element.pxd +13 -0
  631. sage/modules/with_basis/indexed_element.pyx +1058 -0
  632. sage/modules/with_basis/invariant.py +1075 -0
  633. sage/modules/with_basis/morphism.py +1636 -0
  634. sage/modules/with_basis/representation.py +2939 -0
  635. sage/modules/with_basis/subquotient.py +685 -0
  636. sage/numerical/all__sagemath_modules.py +6 -0
  637. sage/numerical/gauss_legendre.cpython-314-x86_64-linux-musl.so +0 -0
  638. sage/numerical/gauss_legendre.pyx +381 -0
  639. sage/numerical/optimize.py +910 -0
  640. sage/probability/all.py +10 -0
  641. sage/probability/probability_distribution.cpython-314-x86_64-linux-musl.so +0 -0
  642. sage/probability/probability_distribution.pyx +1242 -0
  643. sage/probability/random_variable.py +411 -0
  644. sage/quadratic_forms/all.py +4 -0
  645. sage/quadratic_forms/all__sagemath_modules.py +15 -0
  646. sage/quadratic_forms/binary_qf.py +2042 -0
  647. sage/quadratic_forms/bqf_class_group.py +748 -0
  648. sage/quadratic_forms/constructions.py +93 -0
  649. sage/quadratic_forms/count_local_2.cpython-314-x86_64-linux-musl.so +0 -0
  650. sage/quadratic_forms/count_local_2.pyx +365 -0
  651. sage/quadratic_forms/extras.py +195 -0
  652. sage/quadratic_forms/quadratic_form.py +1753 -0
  653. sage/quadratic_forms/quadratic_form__count_local_2.py +221 -0
  654. sage/quadratic_forms/quadratic_form__equivalence_testing.py +708 -0
  655. sage/quadratic_forms/quadratic_form__evaluate.cpython-314-x86_64-linux-musl.so +0 -0
  656. sage/quadratic_forms/quadratic_form__evaluate.pyx +139 -0
  657. sage/quadratic_forms/quadratic_form__local_density_congruence.py +977 -0
  658. sage/quadratic_forms/quadratic_form__local_field_invariants.py +1072 -0
  659. sage/quadratic_forms/quadratic_form__neighbors.py +424 -0
  660. sage/quadratic_forms/quadratic_form__reduction_theory.py +488 -0
  661. sage/quadratic_forms/quadratic_form__split_local_covering.py +416 -0
  662. sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +657 -0
  663. sage/quadratic_forms/quadratic_form__theta.py +352 -0
  664. sage/quadratic_forms/quadratic_form__variable_substitutions.py +370 -0
  665. sage/quadratic_forms/random_quadraticform.py +209 -0
  666. sage/quadratic_forms/ternary.cpython-314-x86_64-linux-musl.so +0 -0
  667. sage/quadratic_forms/ternary.pyx +1154 -0
  668. sage/quadratic_forms/ternary_qf.py +2027 -0
  669. sage/rings/all__sagemath_modules.py +28 -0
  670. sage/rings/asymptotic/all__sagemath_modules.py +1 -0
  671. sage/rings/asymptotic/misc.py +1252 -0
  672. sage/rings/cc.py +4 -0
  673. sage/rings/cfinite_sequence.py +1306 -0
  674. sage/rings/complex_conversion.cpython-314-x86_64-linux-musl.so +0 -0
  675. sage/rings/complex_conversion.pxd +8 -0
  676. sage/rings/complex_conversion.pyx +23 -0
  677. sage/rings/complex_double.cpython-314-x86_64-linux-musl.so +0 -0
  678. sage/rings/complex_double.pxd +21 -0
  679. sage/rings/complex_double.pyx +2654 -0
  680. sage/rings/complex_mpc.cpython-314-x86_64-linux-musl.so +0 -0
  681. sage/rings/complex_mpc.pxd +21 -0
  682. sage/rings/complex_mpc.pyx +2576 -0
  683. sage/rings/complex_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  684. sage/rings/complex_mpfr.pxd +18 -0
  685. sage/rings/complex_mpfr.pyx +3602 -0
  686. sage/rings/derivation.py +2334 -0
  687. sage/rings/finite_rings/all__sagemath_modules.py +1 -0
  688. sage/rings/finite_rings/maps_finite_field.py +191 -0
  689. sage/rings/function_field/all__sagemath_modules.py +8 -0
  690. sage/rings/function_field/derivations.py +102 -0
  691. sage/rings/function_field/derivations_rational.py +132 -0
  692. sage/rings/function_field/differential.py +853 -0
  693. sage/rings/function_field/divisor.py +1107 -0
  694. sage/rings/function_field/drinfeld_modules/action.py +199 -0
  695. sage/rings/function_field/drinfeld_modules/all.py +1 -0
  696. sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py +673 -0
  697. sage/rings/function_field/drinfeld_modules/drinfeld_module.py +2087 -0
  698. sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py +1131 -0
  699. sage/rings/function_field/drinfeld_modules/homset.py +420 -0
  700. sage/rings/function_field/drinfeld_modules/morphism.py +820 -0
  701. sage/rings/function_field/hermite_form_polynomial.cpython-314-x86_64-linux-musl.so +0 -0
  702. sage/rings/function_field/hermite_form_polynomial.pyx +188 -0
  703. sage/rings/function_field/khuri_makdisi.cpython-314-x86_64-linux-musl.so +0 -0
  704. sage/rings/function_field/khuri_makdisi.pyx +935 -0
  705. sage/rings/invariants/all.py +4 -0
  706. sage/rings/invariants/invariant_theory.py +4597 -0
  707. sage/rings/invariants/reconstruction.py +395 -0
  708. sage/rings/polynomial/all__sagemath_modules.py +17 -0
  709. sage/rings/polynomial/integer_valued_polynomials.py +1230 -0
  710. sage/rings/polynomial/laurent_polynomial_mpair.cpython-314-x86_64-linux-musl.so +0 -0
  711. sage/rings/polynomial/laurent_polynomial_mpair.pxd +15 -0
  712. sage/rings/polynomial/laurent_polynomial_mpair.pyx +2023 -0
  713. sage/rings/polynomial/ore_function_element.py +952 -0
  714. sage/rings/polynomial/ore_function_field.py +1028 -0
  715. sage/rings/polynomial/ore_polynomial_element.cpython-314-x86_64-linux-musl.so +0 -0
  716. sage/rings/polynomial/ore_polynomial_element.pxd +48 -0
  717. sage/rings/polynomial/ore_polynomial_element.pyx +3145 -0
  718. sage/rings/polynomial/ore_polynomial_ring.py +1334 -0
  719. sage/rings/polynomial/polynomial_real_mpfr_dense.cpython-314-x86_64-linux-musl.so +0 -0
  720. sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +788 -0
  721. sage/rings/polynomial/q_integer_valued_polynomials.py +1264 -0
  722. sage/rings/polynomial/skew_polynomial_element.cpython-314-x86_64-linux-musl.so +0 -0
  723. sage/rings/polynomial/skew_polynomial_element.pxd +9 -0
  724. sage/rings/polynomial/skew_polynomial_element.pyx +684 -0
  725. sage/rings/polynomial/skew_polynomial_finite_field.cpython-314-x86_64-linux-musl.so +0 -0
  726. sage/rings/polynomial/skew_polynomial_finite_field.pxd +19 -0
  727. sage/rings/polynomial/skew_polynomial_finite_field.pyx +1093 -0
  728. sage/rings/polynomial/skew_polynomial_finite_order.cpython-314-x86_64-linux-musl.so +0 -0
  729. sage/rings/polynomial/skew_polynomial_finite_order.pxd +10 -0
  730. sage/rings/polynomial/skew_polynomial_finite_order.pyx +567 -0
  731. sage/rings/polynomial/skew_polynomial_ring.py +908 -0
  732. sage/rings/real_double_element_gsl.cpython-314-x86_64-linux-musl.so +0 -0
  733. sage/rings/real_double_element_gsl.pxd +8 -0
  734. sage/rings/real_double_element_gsl.pyx +794 -0
  735. sage/rings/real_field.py +58 -0
  736. sage/rings/real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  737. sage/rings/real_mpfr.pxd +29 -0
  738. sage/rings/real_mpfr.pyx +6122 -0
  739. sage/rings/ring_extension.cpython-314-x86_64-linux-musl.so +0 -0
  740. sage/rings/ring_extension.pxd +42 -0
  741. sage/rings/ring_extension.pyx +2779 -0
  742. sage/rings/ring_extension_conversion.cpython-314-x86_64-linux-musl.so +0 -0
  743. sage/rings/ring_extension_conversion.pxd +16 -0
  744. sage/rings/ring_extension_conversion.pyx +462 -0
  745. sage/rings/ring_extension_element.cpython-314-x86_64-linux-musl.so +0 -0
  746. sage/rings/ring_extension_element.pxd +21 -0
  747. sage/rings/ring_extension_element.pyx +1635 -0
  748. sage/rings/ring_extension_homset.py +64 -0
  749. sage/rings/ring_extension_morphism.cpython-314-x86_64-linux-musl.so +0 -0
  750. sage/rings/ring_extension_morphism.pxd +35 -0
  751. sage/rings/ring_extension_morphism.pyx +920 -0
  752. sage/schemes/all__sagemath_modules.py +1 -0
  753. sage/schemes/projective/all__sagemath_modules.py +1 -0
  754. sage/schemes/projective/coherent_sheaf.py +300 -0
  755. sage/schemes/projective/cohomology.py +510 -0
  756. sage/stats/all.py +15 -0
  757. sage/stats/basic_stats.py +489 -0
  758. sage/stats/distributions/all.py +7 -0
  759. sage/stats/distributions/catalog.py +34 -0
  760. sage/stats/distributions/dgs.h +50 -0
  761. sage/stats/distributions/dgs.pxd +111 -0
  762. sage/stats/distributions/dgs_bern.h +400 -0
  763. sage/stats/distributions/dgs_gauss.h +614 -0
  764. sage/stats/distributions/dgs_misc.h +104 -0
  765. sage/stats/distributions/discrete_gaussian_integer.cpython-314-x86_64-linux-musl.so +0 -0
  766. sage/stats/distributions/discrete_gaussian_integer.pxd +14 -0
  767. sage/stats/distributions/discrete_gaussian_integer.pyx +498 -0
  768. sage/stats/distributions/discrete_gaussian_lattice.py +908 -0
  769. sage/stats/distributions/discrete_gaussian_polynomial.py +141 -0
  770. sage/stats/hmm/all.py +15 -0
  771. sage/stats/hmm/chmm.cpython-314-x86_64-linux-musl.so +0 -0
  772. sage/stats/hmm/chmm.pyx +1595 -0
  773. sage/stats/hmm/distributions.cpython-314-x86_64-linux-musl.so +0 -0
  774. sage/stats/hmm/distributions.pxd +29 -0
  775. sage/stats/hmm/distributions.pyx +531 -0
  776. sage/stats/hmm/hmm.cpython-314-x86_64-linux-musl.so +0 -0
  777. sage/stats/hmm/hmm.pxd +17 -0
  778. sage/stats/hmm/hmm.pyx +1388 -0
  779. sage/stats/hmm/util.cpython-314-x86_64-linux-musl.so +0 -0
  780. sage/stats/hmm/util.pxd +7 -0
  781. sage/stats/hmm/util.pyx +165 -0
  782. sage/stats/intlist.cpython-314-x86_64-linux-musl.so +0 -0
  783. sage/stats/intlist.pxd +14 -0
  784. sage/stats/intlist.pyx +588 -0
  785. sage/stats/r.py +49 -0
  786. sage/stats/time_series.cpython-314-x86_64-linux-musl.so +0 -0
  787. sage/stats/time_series.pxd +6 -0
  788. sage/stats/time_series.pyx +2546 -0
  789. sage/tensor/all.py +2 -0
  790. sage/tensor/modules/all.py +8 -0
  791. sage/tensor/modules/alternating_contr_tensor.py +761 -0
  792. sage/tensor/modules/comp.py +5598 -0
  793. sage/tensor/modules/ext_pow_free_module.py +824 -0
  794. sage/tensor/modules/finite_rank_free_module.py +3589 -0
  795. sage/tensor/modules/format_utilities.py +333 -0
  796. sage/tensor/modules/free_module_alt_form.py +858 -0
  797. sage/tensor/modules/free_module_automorphism.py +1207 -0
  798. sage/tensor/modules/free_module_basis.py +1074 -0
  799. sage/tensor/modules/free_module_element.py +284 -0
  800. sage/tensor/modules/free_module_homset.py +652 -0
  801. sage/tensor/modules/free_module_linear_group.py +564 -0
  802. sage/tensor/modules/free_module_morphism.py +1581 -0
  803. sage/tensor/modules/free_module_tensor.py +3289 -0
  804. sage/tensor/modules/reflexive_module.py +386 -0
  805. sage/tensor/modules/tensor_free_module.py +780 -0
  806. sage/tensor/modules/tensor_free_submodule.py +538 -0
  807. sage/tensor/modules/tensor_free_submodule_basis.py +140 -0
  808. sage/tensor/modules/tensor_with_indices.py +1043 -0
@@ -0,0 +1,1706 @@
1
+ # sage_setup: distribution = sagemath-modules
2
+ r"""
3
+ Free quadratic modules
4
+
5
+ Sage supports computation with free quadratic modules over an arbitrary
6
+ commutative ring. Nontrivial functionality is available over `\ZZ` and
7
+ fields. All free modules over an integral domain are equipped with an
8
+ embedding in an ambient vector space and an inner product, which you
9
+ can specify and change.
10
+
11
+ Create the free module of rank `n` over an arbitrary commutative ring `R`
12
+ using the command ``FreeModule(R,n)`` with a given ``inner_product_matrix``.
13
+
14
+ The following example illustrates the creation of both a vector space
15
+ and a free module over the integers and a submodule of it. Use the functions
16
+ ``FreeModule``, ``span`` and member functions of free modules
17
+ to create free modules. ''Do not use the ``FreeModule_xxx`` constructors
18
+ directly.''
19
+
20
+ EXAMPLES::
21
+
22
+ sage: M = Matrix(QQ, [[2,1,0], [1,2,1], [0,1,2]])
23
+ sage: V = VectorSpace(QQ, 3, inner_product_matrix=M)
24
+ sage: type(V)
25
+ <class 'sage.modules.free_quadratic_module.FreeQuadraticModule_ambient_field_with_category'>
26
+ sage: V.inner_product_matrix()
27
+ [2 1 0]
28
+ [1 2 1]
29
+ [0 1 2]
30
+ sage: W = V.subspace([[1,2,7], [1,1,0]])
31
+ sage: type(W)
32
+ <class 'sage.modules.free_quadratic_module.FreeQuadraticModule_submodule_field_with_category'>
33
+ sage: W
34
+ Quadratic space of degree 3 and dimension 2 over Rational Field
35
+ Basis matrix:
36
+ [ 1 0 -7]
37
+ [ 0 1 7]
38
+ Inner product matrix:
39
+ [2 1 0]
40
+ [1 2 1]
41
+ [0 1 2]
42
+ sage: W.gram_matrix()
43
+ [ 100 -104]
44
+ [-104 114]
45
+
46
+ TESTS::
47
+
48
+ sage: M = Matrix(QQ, [[2,1,0], [1,2,1], [0,1,2]])
49
+ sage: V = VectorSpace(QQ, 3, inner_product_matrix=M)
50
+ sage: V == loads(dumps(V))
51
+ True
52
+ sage: W = QuadraticSpace(QQ, 3, M)
53
+ sage: W == V
54
+ True
55
+
56
+ AUTHORS:
57
+
58
+ - David Kohel (2008-06): First created (based on free_module.py)
59
+ """
60
+ # ****************************************************************************
61
+ # Copyright (C) 2008 David Kohel <kohel@iml.univ-mrs.fr>
62
+ #
63
+ # This program is free software: you can redistribute it and/or modify
64
+ # it under the terms of the GNU General Public License as published by
65
+ # the Free Software Foundation, either version 2 of the License, or
66
+ # (at your option) any later version.
67
+ # https://www.gnu.org/licenses/
68
+ # ****************************************************************************
69
+ import weakref
70
+
71
+ from sage.categories.commutative_rings import CommutativeRings
72
+ from sage.categories.principal_ideal_domains import PrincipalIdealDomains
73
+ from sage.categories.integral_domains import IntegralDomains
74
+ from sage.modules import free_module
75
+ from sage.rings.ring import Field
76
+ import sage.matrix.matrix_space
77
+ import sage.misc.latex as latex
78
+
79
+ # #############################################################################
80
+ #
81
+ # Constructor functions
82
+ #
83
+ # #############################################################################
84
+ _cache = {}
85
+
86
+
87
+ def FreeQuadraticModule(base_ring, rank, inner_product_matrix,
88
+ sparse=False, inner_product_ring=None):
89
+ r"""
90
+ Create the free quadratic module over the given commutative ring of the given rank.
91
+
92
+ INPUT:
93
+
94
+ - ``base_ring`` -- a commutative ring
95
+
96
+ - ``rank`` -- nonnegative integer
97
+
98
+ - ``inner_product_matrix`` -- the inner product matrix
99
+
100
+ - ``sparse`` -- boolean (default: ``False``)
101
+
102
+ - ``inner_product_ring`` -- the inner product codomain ring (default: ``None``)
103
+
104
+ OUTPUT:
105
+
106
+ A free quadratic module (with given inner product matrix).
107
+
108
+ .. NOTE::
109
+
110
+ In Sage, it is the case that there is only one dense and one
111
+ sparse free ambient quadratic module of rank `n` over `R` and
112
+ given inner product matrix.
113
+
114
+ EXAMPLES::
115
+
116
+ sage: M2 = FreeQuadraticModule(ZZ, 2, inner_product_matrix=[1,2,3,4])
117
+ sage: M2 is FreeQuadraticModule(ZZ, 2, inner_product_matrix=[1,2,3,4])
118
+ True
119
+ sage: M2.inner_product_matrix()
120
+ [1 2]
121
+ [3 4]
122
+ sage: M3 = FreeModule(ZZ, 2, inner_product_matrix=[[1,2],[3,4]])
123
+ sage: M3 is M2
124
+ True
125
+
126
+ TESTS:
127
+
128
+ Check for :issue:`10577`::
129
+
130
+ sage: m = matrix.diagonal(GF(2), [1,1])
131
+ sage: V2 = VectorSpace(GF(2), 2, inner_product_matrix=m)
132
+ sage: deepcopy(V2)
133
+ Ambient quadratic space of dimension 2 over Finite Field of size 2
134
+ Inner product matrix:
135
+ [1 0]
136
+ [0 1]
137
+ """
138
+ global _cache
139
+ rank = int(rank)
140
+
141
+ # In order to use coercion into the inner_product_ring we need to pass
142
+ # this ring into the vector classes.
143
+ if inner_product_ring is not None:
144
+ raise NotImplementedError("an inner_product_ring cannot currently be defined")
145
+
146
+ # We intentionally create a new matrix instead of using the given
147
+ # inner_product_matrix. This ensures that the matrix has the correct
148
+ # parent space. It also gets rid of subdivisions which is good
149
+ # because matrices with and without subdivisions compare equal.
150
+ # Because of uniqueness, we need a canonical matrix, which is the one
151
+ # without subdivisions.
152
+ MS = sage.matrix.matrix_space.MatrixSpace(base_ring, rank)
153
+ inner_product_matrix = MS(list(inner_product_matrix))
154
+ inner_product_matrix.set_immutable()
155
+
156
+ key = (base_ring, rank, inner_product_matrix, sparse)
157
+
158
+ if key in _cache:
159
+ M = _cache[key]()
160
+ if M is not None:
161
+ return M
162
+
163
+ if base_ring not in CommutativeRings():
164
+ raise TypeError("base_ring must be a commutative ring")
165
+
166
+ # elif not sparse and isinstance(base_ring,sage.rings.real_double.RealDoubleField_class):
167
+ # M = RealDoubleQuadraticSpace_class(rank, inner_product_matrix=inner_product_matrix, sparse=False)
168
+
169
+ # elif not sparse and isinstance(base_ring,sage.rings.complex_double.ComplexDoubleField_class):
170
+ # M = ComplexDoubleQuadraticSpace_class(rank, inner_product_matrix=inner_product_matrix, sparse=False)
171
+
172
+ elif base_ring.is_field():
173
+ M = FreeQuadraticModule_ambient_field(
174
+ base_ring, rank, sparse=sparse, inner_product_matrix=inner_product_matrix)
175
+
176
+ elif base_ring in PrincipalIdealDomains():
177
+ M = FreeQuadraticModule_ambient_pid(
178
+ base_ring, rank, sparse=sparse, inner_product_matrix=inner_product_matrix)
179
+
180
+ elif base_ring in IntegralDomains():
181
+ M = FreeQuadraticModule_ambient_domain(
182
+ base_ring, rank, sparse=sparse, inner_product_matrix=inner_product_matrix)
183
+ else:
184
+ M = FreeQuadraticModule_ambient(
185
+ base_ring, rank, sparse=sparse, inner_product_matrix=inner_product_matrix)
186
+
187
+ _cache[key] = weakref.ref(M)
188
+ return M
189
+
190
+
191
+ def QuadraticSpace(K, dimension, inner_product_matrix, sparse=False):
192
+ """
193
+ EXAMPLES:
194
+
195
+ The base can be complicated, as long as it is a field::
196
+
197
+ sage: F.<x> = FractionField(PolynomialRing(ZZ,'x'))
198
+ sage: D = diagonal_matrix([x, x - 1, x + 1])
199
+ sage: V = QuadraticSpace(F, 3, D)
200
+ sage: V
201
+ Ambient quadratic space of dimension 3 over
202
+ Fraction Field of Univariate Polynomial Ring in x over Integer Ring
203
+ Inner product matrix:
204
+ [ x 0 0]
205
+ [ 0 x - 1 0]
206
+ [ 0 0 x + 1]
207
+ sage: V.basis()
208
+ [(1, 0, 0), (0, 1, 0), (0, 0, 1)]
209
+
210
+ The base must be a field or a :exc:`TypeError` is raised::
211
+
212
+ sage: QuadraticSpace(ZZ, 5, identity_matrix(ZZ,2))
213
+ Traceback (most recent call last):
214
+ ...
215
+ TypeError: argument K (= Integer Ring) must be a field
216
+ """
217
+ if not K.is_field():
218
+ raise TypeError(f"argument K (= {K}) must be a field")
219
+ if sparse not in (True, False):
220
+ raise TypeError("Argument sparse (= %s) must be a boolean." % sparse)
221
+ return FreeQuadraticModule(K, rank=dimension, inner_product_matrix=inner_product_matrix, sparse=sparse)
222
+
223
+
224
+ InnerProductSpace = QuadraticSpace
225
+
226
+
227
+ # #############################################################################
228
+ #
229
+ # Base class for all free modules
230
+ #
231
+ # #############################################################################
232
+
233
+ def is_FreeQuadraticModule(M):
234
+ """
235
+ Return ``True`` if `M` is a free quadratic module.
236
+
237
+ EXAMPLES::
238
+
239
+ sage: from sage.modules.free_quadratic_module import is_FreeQuadraticModule
240
+ sage: U = FreeModule(QQ,3)
241
+ sage: is_FreeQuadraticModule(U)
242
+ doctest:warning...
243
+ DeprecationWarning: the function is_FreeQuadraticModule is deprecated;
244
+ use 'isinstance(..., FreeQuadraticModule_generic)' instead
245
+ See https://github.com/sagemath/sage/issues/37924 for details.
246
+ False
247
+ sage: V = FreeModule(QQ,3,inner_product_matrix=diagonal_matrix([1,1,1]))
248
+ sage: is_FreeQuadraticModule(V)
249
+ True
250
+ sage: W = FreeModule(QQ,3,inner_product_matrix=diagonal_matrix([2,3,3]))
251
+ sage: is_FreeQuadraticModule(W)
252
+ True
253
+ """
254
+ from sage.misc.superseded import deprecation
255
+ deprecation(37924, "the function is_FreeQuadraticModule is deprecated; use 'isinstance(..., FreeQuadraticModule_generic)' instead")
256
+ return isinstance(M, FreeQuadraticModule_generic)
257
+
258
+
259
+ class FreeQuadraticModule_generic(free_module.FreeModule_generic):
260
+ """
261
+ Base class for all free quadratic modules.
262
+
263
+ Modules are ordered by inclusion in the same ambient space.
264
+
265
+ TESTS:
266
+
267
+ We compare rank three free modules over the integers,
268
+ rationals, and complex numbers::
269
+
270
+ sage: Q3 = FreeQuadraticModule(QQ,3,matrix.identity(3))
271
+ sage: C3 = FreeQuadraticModule(CC,3,matrix.identity(3))
272
+ sage: Z3 = FreeQuadraticModule(ZZ,3,matrix.identity(3))
273
+ sage: Q3 < C3
274
+ False
275
+ sage: C3 < Q3
276
+ False
277
+ sage: C3 > Q3
278
+ False
279
+ sage: Q3 > Z3
280
+ True
281
+ sage: Q3 < Z3
282
+ False
283
+ sage: Z3 < Q3
284
+ True
285
+ sage: Z3 > Q3
286
+ False
287
+ sage: Q3 == Z3
288
+ False
289
+ sage: Q3 == Q3
290
+ True
291
+
292
+ sage: V = Q3.span([[1,2,3], [5,6,7], [8,9,10]])
293
+ sage: V < Q3
294
+ True
295
+ sage: Q3 < V
296
+ False
297
+
298
+ The :meth:`inner_product_matrix` is part of the comparison::
299
+
300
+ sage: Q3zero = FreeQuadraticModule(QQ,3,matrix.zero(3))
301
+ sage: Q3zero == Q3
302
+ False
303
+
304
+ We test that :issue:`23915` is fixed::
305
+
306
+ sage: M1 = FreeQuadraticModule(ZZ,1,matrix.identity(1))
307
+ sage: M2 = FreeQuadraticModule(ZZ,1,matrix.identity(1)*2)
308
+ sage: M1 == M2
309
+ False
310
+ """
311
+ def __init__(self, base_ring, rank, degree, inner_product_matrix, sparse=False):
312
+ """
313
+ Create the free module of given rank over the given ``base_ring``.
314
+
315
+ INPUT:
316
+
317
+ - ``base_ring`` -- a commutative ring
318
+
319
+ - ``rank`` -- nonnegative integer
320
+
321
+ EXAMPLES::
322
+
323
+ sage: R = PolynomialRing(QQ,3,'x')
324
+ sage: FreeModule(R,3,inner_product_matrix=diagonal_matrix(list(R.gens())))
325
+ Ambient free quadratic module of rank 3 over the integral domain Multivariate Polynomial Ring in x0, x1, x2 over Rational Field
326
+ Inner product matrix:
327
+ [x0 0 0]
328
+ [ 0 x1 0]
329
+ [ 0 0 x2]
330
+ """
331
+ free_module.FreeModule_generic.__init__(
332
+ self, base_ring=base_ring, rank=rank, degree=degree, sparse=sparse)
333
+ self._inner_product_matrix = inner_product_matrix
334
+
335
+ def _dense_module(self):
336
+ """
337
+ Create a dense module with the same defining data as ``self``.
338
+
339
+ .. NOTE:: This function is for internal use only! See ``dense_module`` for use.
340
+
341
+ EXAMPLES::
342
+
343
+ sage: A = diagonal_matrix([1,2,2])
344
+ sage: M = FreeModule(Integers(8),3,inner_product_matrix=A)
345
+ sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True)
346
+ sage: M is S._dense_module()
347
+ True
348
+ """
349
+ A = self.ambient_module().dense_module()
350
+ return A.span(self.basis())
351
+
352
+ def _sparse_module(self):
353
+ """
354
+ Create a sparse module with the same defining data as ``self``.
355
+
356
+ .. NOTE:: This function is for internal use only! See ``sparse_module`` for use.
357
+
358
+ EXAMPLES::
359
+
360
+ sage: A = diagonal_matrix([1,2,2])
361
+ sage: M = FreeModule(Integers(8),3,inner_product_matrix=A)
362
+ sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True)
363
+ sage: M._sparse_module() is S
364
+ True
365
+ """
366
+ A = self.ambient_module().sparse_module()
367
+ return A.span(self.basis())
368
+
369
+ def ambient_module(self):
370
+ """
371
+ Return the ambient module associated to this module.
372
+
373
+ EXAMPLES::
374
+
375
+ sage: R.<x,y> = QQ[]
376
+ sage: M = FreeModule(R,2)
377
+ sage: M.ambient_module()
378
+ Ambient free module of rank 2 over the integral domain Multivariate Polynomial Ring in x, y over Rational Field
379
+
380
+ sage: V = FreeModule(QQ, 4).span([[1,2,3,4], [1,0,0,0]]); V
381
+ Vector space of degree 4 and dimension 2 over Rational Field
382
+ Basis matrix:
383
+ [ 1 0 0 0]
384
+ [ 0 1 3/2 2]
385
+ sage: V.ambient_module()
386
+ Vector space of dimension 4 over Rational Field
387
+ """
388
+ return FreeQuadraticModule(self.base_ring(), self.degree(), self.inner_product_matrix())
389
+
390
+ def determinant(self):
391
+ """
392
+ Return the determinant of this free module.
393
+
394
+ EXAMPLES::
395
+
396
+ sage: M = FreeModule(ZZ, 3, inner_product_matrix=1)
397
+ sage: M.determinant()
398
+ 1
399
+ sage: N = M.span([[1,2,3]])
400
+ sage: N.determinant()
401
+ 14
402
+ sage: P = M.span([[1,2,3], [1,1,1]])
403
+ sage: P.determinant()
404
+ 6
405
+ """
406
+ return self.gram_matrix().determinant()
407
+
408
+ def discriminant(self):
409
+ """
410
+ Return the discriminant of this free module.
411
+
412
+ This is defined to be `(-1)^r` of the determinant, where `r = n/2`
413
+ (`n` even) or `(n-1)/2` (`n` odd) for a module of rank `n`.
414
+
415
+ EXAMPLES::
416
+
417
+ sage: M = FreeModule(ZZ, 3)
418
+ sage: M.discriminant()
419
+ 1
420
+ sage: N = M.span([[1,2,3]])
421
+ sage: N.discriminant()
422
+ 14
423
+ sage: P = M.span([[1,2,3], [1,1,1]])
424
+ sage: P.discriminant()
425
+ 6
426
+
427
+ TESTS::
428
+
429
+ sage: M = FreeQuadraticModule(ZZ, 2, matrix.identity(2))
430
+ sage: M.discriminant()
431
+ -1
432
+ sage: M = FreeQuadraticModule(QQ, 3, matrix.identity(3))
433
+ sage: M.discriminant()
434
+ -1
435
+ """
436
+ r = self.rank() // 2
437
+ return (-1)**r * self.gram_matrix().determinant()
438
+
439
+ def gram_matrix(self):
440
+ """
441
+ Return the Gram matrix associated to this free module.
442
+
443
+ This is defined to be ``B*A*B.transpose()``, where ``A`` is the
444
+ inner product matrix (induced from the ambient space), and ``B``
445
+ the basis matrix.
446
+
447
+ EXAMPLES::
448
+
449
+ sage: V = VectorSpace(QQ,4)
450
+ sage: u = V([1/2,1/2,1/2,1/2])
451
+ sage: v = V([0,1,1,0])
452
+ sage: w = V([0,0,1,1])
453
+ sage: M = span([u,v,w], ZZ)
454
+ sage: M.inner_product_matrix() == V.inner_product_matrix()
455
+ True
456
+ sage: L = M.submodule_with_basis([u,v,w])
457
+ sage: L.inner_product_matrix() == M.inner_product_matrix()
458
+ True
459
+ sage: L.gram_matrix()
460
+ [1 1 1]
461
+ [1 2 1]
462
+ [1 1 2]
463
+ """
464
+ if self.is_ambient():
465
+ return self.inner_product_matrix()
466
+ if self._gram_matrix is None:
467
+ A = self.inner_product_matrix()
468
+ B = self.basis_matrix()
469
+ self._gram_matrix = B * A * B.transpose()
470
+ return self._gram_matrix
471
+
472
+ def inner_product_matrix(self):
473
+ """
474
+ Return the inner product matrix associated to this module.
475
+
476
+ By definition, this is the inner product matrix of the ambient
477
+ space, hence may be of degree greater than the rank of the
478
+ module.
479
+
480
+ .. NOTE:: The inner product does not have to be symmetric (see examples).
481
+
482
+ .. TODO::
483
+
484
+ Differentiate the image ring of the inner product from the base ring of
485
+ the module and/or ambient space. E.g. On an integral module over ZZ the inner
486
+ product pairing could naturally take values in ZZ, QQ, RR, or CC.
487
+
488
+ EXAMPLES::
489
+
490
+ sage: M = FreeModule(ZZ, 3)
491
+ sage: M.inner_product_matrix()
492
+ [1 0 0]
493
+ [0 1 0]
494
+ [0 0 1]
495
+
496
+ The inner product does not have to be symmetric or definite::
497
+
498
+ sage: N = FreeModule(ZZ,2,inner_product_matrix=[[1,-1],[2,5]])
499
+ sage: N.inner_product_matrix()
500
+ [ 1 -1]
501
+ [ 2 5]
502
+ sage: u, v = N.basis()
503
+ sage: u.inner_product(v)
504
+ -1
505
+ sage: v.inner_product(u)
506
+ 2
507
+
508
+ The inner product matrix is defined with respect to the ambient space::
509
+
510
+ sage: V = QQ^3
511
+ sage: u = V([1/2,1,1])
512
+ sage: v = V([1,1,1/2])
513
+ sage: M = span([u,v], ZZ)
514
+ sage: M.inner_product_matrix()
515
+ [1 0 0]
516
+ [0 1 0]
517
+ [0 0 1]
518
+ sage: M.inner_product_matrix() == V.inner_product_matrix()
519
+ True
520
+ sage: M.gram_matrix()
521
+ [ 1/2 -3/4]
522
+ [-3/4 13/4]
523
+ """
524
+ return self._inner_product_matrix
525
+
526
+ def _inner_product_is_dot_product(self):
527
+ """
528
+ Return whether or not the inner product on this module is induced by
529
+ the dot product on the ambient vector space.
530
+
531
+ This is used internally by the ``inner_product`` function for
532
+ optimization.
533
+
534
+ EXAMPLES::
535
+
536
+ sage: FreeModule(ZZ, 3)._inner_product_is_dot_product()
537
+ True
538
+ sage: FreeModule(ZZ, 3, inner_product_matrix=1)._inner_product_is_dot_product()
539
+ True
540
+ sage: FreeModule(ZZ, 2, inner_product_matrix=[1,0,-1,0])._inner_product_is_dot_product()
541
+ False
542
+
543
+ sage: M = FreeModule(QQ, 3)
544
+ sage: M2 = M.span([[1,2,3]])
545
+ sage: M2._inner_product_is_dot_product()
546
+ True
547
+ """
548
+ return self.inner_product_matrix() == 1
549
+
550
+ def _inner_product_is_diagonal(self):
551
+ """
552
+ Return whether or not the inner product on this module is induced by
553
+ the dot product on the ambient vector space.
554
+
555
+ This is used internally by the ``inner_product`` function for
556
+ optimization.
557
+
558
+ .. NOTE::
559
+
560
+ The ``FreeModule`` classes have the identity inner product matrix,
561
+ while ``FreeQuadraticModules`` must have an ``inner_product_matrix``, although
562
+ it can be diagonal.
563
+
564
+ EXAMPLES::
565
+
566
+ sage: M0 = FreeModule(ZZ, 3, inner_product_matrix=1)
567
+ sage: M0._inner_product_is_diagonal()
568
+ True
569
+ sage: D = diagonal_matrix([3,5,7])
570
+ sage: M1 = FreeModule(ZZ, 3, inner_product_matrix=D)
571
+ sage: M1._inner_product_is_diagonal()
572
+ True
573
+ sage: A = Matrix([[2,1,0],[1,2,1],[0,1,2]])
574
+ sage: M2 = FreeModule(ZZ, 3, inner_product_matrix=A)
575
+ sage: M2._inner_product_is_diagonal()
576
+ False
577
+ sage: M3 = FreeModule(ZZ, 2, inner_product_matrix=[1,0,-1,0])
578
+ sage: M3._inner_product_is_diagonal()
579
+ False
580
+
581
+ .. TODO:: Actually use the diagonal form of the inner product.
582
+ """
583
+ A = self.inner_product_matrix()
584
+ D = sage.matrix.constructor.diagonal_matrix(A.diagonal())
585
+ return A == D
586
+
587
+
588
+ class FreeQuadraticModule_generic_pid(free_module.FreeModule_generic_pid,
589
+ FreeQuadraticModule_generic):
590
+ """
591
+ Class of all free modules over a PID.
592
+ """
593
+ def __init__(self, base_ring, rank, degree, inner_product_matrix, sparse=False):
594
+ """
595
+ Create a free module over a PID.
596
+
597
+ EXAMPLES::
598
+
599
+ sage: FreeModule(ZZ, 2, inner_product_matrix=Matrix([[2,1],[1,2]]))
600
+ Ambient free quadratic module of rank 2 over the principal ideal domain Integer Ring
601
+ Inner product matrix:
602
+ [2 1]
603
+ [1 2]
604
+ """
605
+ free_module.FreeModule_generic_pid.__init__(
606
+ self, base_ring=base_ring, rank=rank, degree=degree, sparse=sparse)
607
+ self._inner_product_matrix = inner_product_matrix
608
+
609
+ def span(self, gens, check=True, already_echelonized=False):
610
+ """
611
+ Return the `R`-span of the given list of gens, where `R`
612
+ is the base ring of ``self``.
613
+
614
+ Note that this span need not be a submodule of ``self``, nor even
615
+ of the ambient space. It must, however, be contained in the
616
+ ambient vector space, i.e., the ambient space tensored with
617
+ the fraction field of `R`.
618
+
619
+ EXAMPLES::
620
+
621
+ sage: V = FreeModule(ZZ,3)
622
+ sage: W = V.submodule([V.gen(0)])
623
+ sage: W.span([V.gen(1)])
624
+ Free module of degree 3 and rank 1 over Integer Ring
625
+ Echelon basis matrix:
626
+ [0 1 0]
627
+ sage: W.submodule([V.gen(1)])
628
+ Traceback (most recent call last):
629
+ ...
630
+ ArithmeticError: argument gens (= [(0, 1, 0)]) does not generate a submodule of self
631
+ """
632
+ return FreeQuadraticModule_submodule_pid(
633
+ self.ambient_module(), gens, inner_product_matrix=self.inner_product_matrix(),
634
+ check=check, already_echelonized=already_echelonized)
635
+
636
+ def span_of_basis(self, basis, check=True, already_echelonized=False):
637
+ r"""
638
+ Return the free `R`-module with the given basis, where `R`
639
+ is the base ring of ``self``.
640
+
641
+ Note that this `R`-module need not be a submodule of ``self``, nor
642
+ even of the ambient space. It must, however, be contained in
643
+ the ambient vector space, i.e., the ambient space tensored
644
+ with the fraction field of `R`.
645
+
646
+ EXAMPLES::
647
+
648
+ sage: M = FreeModule(ZZ,3)
649
+ sage: W = M.span_of_basis([M([1,2,3])])
650
+
651
+ Next we create two free `\ZZ`-modules, neither of which is a
652
+ submodule of `W`::
653
+
654
+ sage: W.span_of_basis([M([2,4,0])])
655
+ Free module of degree 3 and rank 1 over Integer Ring
656
+ User basis matrix:
657
+ [2 4 0]
658
+
659
+ The following module is not even in the ambient space::
660
+
661
+ sage: Q = QQ
662
+ sage: W.span_of_basis([ Q('1/5')*M([1,2,0]), Q('1/7')*M([1,1,0]) ])
663
+ Free module of degree 3 and rank 2 over Integer Ring
664
+ User basis matrix:
665
+ [1/5 2/5 0]
666
+ [1/7 1/7 0]
667
+
668
+ Of course the input basis vectors must be linearly independent::
669
+
670
+ sage: W.span_of_basis([ [1,2,0], [2,4,0] ])
671
+ Traceback (most recent call last):
672
+ ...
673
+ ValueError: The given basis vectors must be linearly independent.
674
+ """
675
+ return FreeQuadraticModule_submodule_with_basis_pid(
676
+ self.ambient_module(), basis=basis, inner_product_matrix=self.inner_product_matrix(),
677
+ check=check, already_echelonized=already_echelonized)
678
+
679
+ def zero_submodule(self):
680
+ """
681
+ Return the zero submodule of this module.
682
+
683
+ EXAMPLES::
684
+
685
+ sage: V = FreeModule(ZZ,2)
686
+ sage: V.zero_submodule()
687
+ Free module of degree 2 and rank 0 over Integer Ring
688
+ Echelon basis matrix:
689
+ []
690
+ """
691
+ return FreeQuadraticModule_submodule_pid(
692
+ self.ambient_module(), [], self.inner_product_matrix(), check=False)
693
+
694
+
695
+ class FreeQuadraticModule_generic_field(free_module.FreeModule_generic_field,
696
+ FreeQuadraticModule_generic_pid):
697
+ """
698
+ Base class for all free modules over fields.
699
+ """
700
+ def __init__(self, base_field, dimension, degree, inner_product_matrix, sparse=False):
701
+ """
702
+ Create a vector space over a field.
703
+
704
+ EXAMPLES::
705
+
706
+ sage: FreeModule(QQ, 2, inner_product_matrix=[[2,1],[1,2]])
707
+ Ambient quadratic space of dimension 2 over Rational Field
708
+ Inner product matrix:
709
+ [2 1]
710
+ [1 2]
711
+ sage: FreeModule(FiniteField(2), 7, inner_product_matrix=1)
712
+ Ambient quadratic space of dimension 7 over Finite Field of size 2
713
+ Inner product matrix:
714
+ [1 0 0 0 0 0 0]
715
+ [0 1 0 0 0 0 0]
716
+ [0 0 1 0 0 0 0]
717
+ [0 0 0 1 0 0 0]
718
+ [0 0 0 0 1 0 0]
719
+ [0 0 0 0 0 1 0]
720
+ [0 0 0 0 0 0 1]
721
+ """
722
+ if not isinstance(base_field, Field):
723
+ raise TypeError("the base_field (=%s) must be a field" % base_field)
724
+ free_module.FreeModule_generic_field.__init__(
725
+ self, base_field=base_field, dimension=dimension, degree=degree, sparse=sparse)
726
+ self._inner_product_matrix = inner_product_matrix
727
+
728
+ def span(self, gens, check=True, already_echelonized=False):
729
+ """
730
+ Return the `K`-span of the given list of gens, where `K` is the
731
+ base field of ``self``.
732
+
733
+ Note that this span is a subspace of the ambient vector space,
734
+ but need not be a subspace of ``self``.
735
+
736
+ INPUT:
737
+
738
+ - ``gens`` -- list of vectors
739
+
740
+ - ``check`` -- boolean (default: ``True``); whether or not to coerce
741
+ entries of gens into base field
742
+
743
+ - ``already_echelonized`` -- boolean (default: ``False``); set this if
744
+ you know the gens are already in echelon form
745
+
746
+ EXAMPLES::
747
+
748
+ sage: V = VectorSpace(GF(7), 3)
749
+ sage: W = V.subspace([[2,3,4]]); W
750
+ Vector space of degree 3 and dimension 1 over Finite Field of size 7
751
+ Basis matrix:
752
+ [1 5 2]
753
+ sage: W.span([[1,1,1]])
754
+ Vector space of degree 3 and dimension 1 over Finite Field of size 7
755
+ Basis matrix:
756
+ [1 1 1]
757
+ """
758
+ if isinstance(gens, free_module.FreeModule_generic):
759
+ gens = gens.gens()
760
+ if not isinstance(gens, (list, tuple)):
761
+ raise TypeError("gens (=%s) must be a list or tuple" % gens)
762
+
763
+ return FreeQuadraticModule_submodule_field(
764
+ self.ambient_module(), gens,
765
+ inner_product_matrix=self.inner_product_matrix(),
766
+ check=check, already_echelonized=already_echelonized)
767
+
768
+ def span_of_basis(self, basis, check=True, already_echelonized=False):
769
+ r"""
770
+ Return the free `K`-module with the given basis, where `K`
771
+ is the base field of ``self``.
772
+
773
+ Note that this span is a subspace of the ambient vector space,
774
+ but need not be a subspace of ``self``.
775
+
776
+ INPUT:
777
+
778
+ - ``basis`` -- list of vectors
779
+
780
+ - ``check`` -- boolean (default: ``True``); whether or not to coerce
781
+ entries of gens into base field
782
+
783
+ - ``already_echelonized`` -- boolean (default: ``False``); set this if
784
+ you know the gens are already in echelon form
785
+
786
+ EXAMPLES::
787
+
788
+ sage: V = VectorSpace(GF(7), 3)
789
+ sage: W = V.subspace([[2,3,4]]); W
790
+ Vector space of degree 3 and dimension 1 over Finite Field of size 7
791
+ Basis matrix:
792
+ [1 5 2]
793
+ sage: W.span_of_basis([[2,2,2], [3,3,0]])
794
+ Vector space of degree 3 and dimension 2 over Finite Field of size 7
795
+ User basis matrix:
796
+ [2 2 2]
797
+ [3 3 0]
798
+
799
+ The basis vectors must be linearly independent or a
800
+ :exc:`ValueError` exception is raised::
801
+
802
+ sage: W.span_of_basis([[2,2,2], [3,3,3]])
803
+ Traceback (most recent call last):
804
+ ...
805
+ ValueError: The given basis vectors must be linearly independent.
806
+ """
807
+ return FreeQuadraticModule_submodule_with_basis_field(
808
+ self.ambient_module(), basis=basis,
809
+ inner_product_matrix=self.inner_product_matrix(),
810
+ check=check, already_echelonized=already_echelonized)
811
+
812
+
813
+ # #############################################################################
814
+ #
815
+ # Generic ambient free modules, i.e., of the form R^n for some commutative ring R.
816
+ #
817
+ # #############################################################################
818
+
819
+ class FreeQuadraticModule_ambient(free_module.FreeModule_ambient,
820
+ FreeQuadraticModule_generic):
821
+ """
822
+ Ambient free module over a commutative ring.
823
+ """
824
+ def __init__(self, base_ring, rank, inner_product_matrix, sparse=False):
825
+ """
826
+ The free module of given rank over the given ``base_ring``.
827
+
828
+ INPUT:
829
+
830
+ - ``base_ring`` -- a commutative ring
831
+
832
+ - ``rank`` -- nonnegative integer
833
+
834
+ EXAMPLES::
835
+
836
+ sage: FreeModule(ZZ, 4)
837
+ Ambient free module of rank 4 over the principal ideal domain Integer Ring
838
+ """
839
+ free_module.FreeModule_ambient.__init__(self, base_ring=base_ring, rank=rank, sparse=sparse)
840
+ self._inner_product_matrix = inner_product_matrix
841
+
842
+ def _repr_(self):
843
+ """
844
+ The printing representation of ``self``.
845
+
846
+ EXAMPLES::
847
+
848
+ sage: R = ZZ.quo(12)
849
+ sage: M = R^12
850
+ sage: M
851
+ Ambient free module of rank 12 over Ring of integers modulo 12
852
+ sage: print(M._repr_())
853
+ Ambient free module of rank 12 over Ring of integers modulo 12
854
+
855
+ The system representation can be overwritten, but leaves
856
+ :meth:`_repr_` unmodified::
857
+
858
+ sage: M.rename('M')
859
+ sage: M
860
+ M
861
+ sage: print(M._repr_())
862
+ Ambient free module of rank 12 over Ring of integers modulo 12
863
+
864
+ Sparse modules print this fact::
865
+
866
+ sage: N = FreeModule(R,12,sparse=True)
867
+ sage: N
868
+ Ambient sparse free module of rank 12 over Ring of integers modulo 12
869
+ """
870
+ if self.is_sparse():
871
+ return "Ambient sparse free quadratic module of rank %s over %s\n" % (self.rank(), self.base_ring()) + \
872
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
873
+ return "Ambient free quadratic module of rank %s over %s\n" % (self.rank(), self.base_ring()) + \
874
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
875
+
876
+ def _latex_(self):
877
+ r"""
878
+ Return a latex representation of this ambient free quadratic module.
879
+
880
+ EXAMPLES::
881
+
882
+ sage: latex(QQ^3) # indirect doctest
883
+ \Bold{Q}^{3}
884
+
885
+ sage: A = GF(5)^20; latex(A)
886
+ \Bold{F}_{5}^{20}
887
+
888
+ sage: A = PolynomialRing(QQ,3,'x')^20; latex(A)
889
+ (\Bold{Q}[x_{0}, x_{1}, x_{2}])^{20}
890
+
891
+ sage: V = QuadraticSpace(QQ,3,inner_product_matrix=[[2,1,0],[1,4,1],[0,1,8]])
892
+ sage: latex(V)
893
+ Traceback (most recent call last):
894
+ ...
895
+ NotImplementedError
896
+ """
897
+ # How do we want to represent this object?
898
+ raise NotImplementedError
899
+
900
+ def _dense_module(self):
901
+ """
902
+ Create a dense module with the same defining data as ``self``.
903
+
904
+ .. NOTE:: This function is for internal use only! See dense_module for use.
905
+
906
+ EXAMPLES::
907
+
908
+ sage: A = diagonal_matrix([1,2,2])
909
+ sage: M = FreeModule(Integers(8),3,inner_product_matrix=A)
910
+ sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True)
911
+ sage: M is S._dense_module()
912
+ True
913
+ """
914
+ return FreeQuadraticModule(base_ring=self.base_ring(), rank=self.rank(),
915
+ inner_product_matrix=self.inner_product_matrix(),
916
+ sparse=False)
917
+
918
+ def _sparse_module(self):
919
+ """
920
+ Create a sparse module with the same defining data as ``self``.
921
+
922
+ .. NOTE:: This function is for internal use only! See sparse_module for use.
923
+
924
+ EXAMPLES::
925
+
926
+ sage: A = diagonal_matrix([1,2,2])
927
+ sage: M = FreeModule(Integers(8),3,inner_product_matrix=A)
928
+ sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True)
929
+ sage: M._sparse_module() is S
930
+ True
931
+ """
932
+ return FreeQuadraticModule(base_ring=self.base_ring(), rank=self.rank(),
933
+ inner_product_matrix=self.inner_product_matrix(),
934
+ sparse=True)
935
+
936
+
937
+ # #############################################################################
938
+ #
939
+ # Ambient free modules over an integral domain.
940
+ #
941
+ # #############################################################################
942
+
943
+ class FreeQuadraticModule_ambient_domain(free_module.FreeModule_ambient_domain,
944
+ FreeQuadraticModule_ambient):
945
+ """
946
+ Ambient free quadratic module over an integral domain.
947
+ """
948
+ def __init__(self, base_ring, rank, inner_product_matrix, sparse=False):
949
+ """
950
+ EXAMPLES::
951
+
952
+ sage: FreeModule(PolynomialRing(GF(5),'x'), 3)
953
+ Ambient free module of rank 3 over the principal ideal domain
954
+ Univariate Polynomial Ring in x over Finite Field of size 5
955
+ """
956
+ free_module.FreeModule_ambient.__init__(self, base_ring=base_ring, rank=rank, sparse=sparse)
957
+ self._inner_product_matrix = inner_product_matrix
958
+
959
+ def _repr_(self):
960
+ """
961
+ The printing representation of ``self``.
962
+
963
+ EXAMPLES::
964
+
965
+ sage: R = PolynomialRing(ZZ,'x')
966
+ sage: M = FreeModule(R,7)
967
+ sage: M
968
+ Ambient free module of rank 7 over the integral domain Univariate Polynomial Ring in x over Integer Ring
969
+ sage: print(M._repr_())
970
+ Ambient free module of rank 7 over the integral domain Univariate Polynomial Ring in x over Integer Ring
971
+
972
+ The system representation can be overwritten, but leaves
973
+ :meth:`_repr_` unmodified::
974
+
975
+ sage: M.rename('M')
976
+ sage: M
977
+ M
978
+ sage: print(M._repr_())
979
+ Ambient free module of rank 7 over the integral domain Univariate Polynomial Ring in x over Integer Ring
980
+
981
+ Sparse modules print this fact::
982
+
983
+ sage: N = FreeModule(R,7,sparse=True)
984
+ sage: N
985
+ Ambient sparse free module of rank 7 over the integral domain Univariate Polynomial Ring in x over Integer Ring
986
+
987
+ Here is a construction of a free quadratic module with generic
988
+ symmetric inner product matrix::
989
+
990
+ sage: R.<a,b,c> = PolynomialRing(QQ,3)
991
+ sage: M = FreeModule(R, 2, inner_product_matrix=[[2*a,b],[b,2*c]])
992
+ sage: M
993
+ Ambient free quadratic module of rank 2 over the integral domain Multivariate Polynomial Ring in a, b, c over Rational Field
994
+ Inner product matrix:
995
+ [2*a b]
996
+ [ b 2*c]
997
+ sage: M.determinant()
998
+ -b^2 + 4*a*c
999
+ """
1000
+ if self.is_sparse():
1001
+ return "Ambient sparse free quadratic module of rank %s over the integral domain %s\n" % (
1002
+ self.rank(), self.base_ring()) + \
1003
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
1004
+ return "Ambient free quadratic module of rank %s over the integral domain %s\n" % (
1005
+ self.rank(), self.base_ring()) + \
1006
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
1007
+
1008
+ def ambient_vector_space(self):
1009
+ """
1010
+ Return the ambient vector space, which is this free module tensored
1011
+ with its fraction field.
1012
+
1013
+ EXAMPLES::
1014
+
1015
+ sage: M = ZZ^3; M.ambient_vector_space()
1016
+ Vector space of dimension 3 over Rational Field
1017
+ """
1018
+ try:
1019
+ return self.__ambient_vector_space
1020
+ except AttributeError:
1021
+ self.__ambient_vector_space = FreeQuadraticModule(
1022
+ self.base_field(), self.rank(),
1023
+ inner_product_matrix=self.inner_product_matrix(), sparse=self.is_sparse())
1024
+ return self.__ambient_vector_space
1025
+
1026
+
1027
+ # #############################################################################
1028
+ #
1029
+ # Ambient free modules over a principal ideal domain.
1030
+ #
1031
+ # #############################################################################
1032
+
1033
+ class FreeQuadraticModule_ambient_pid(free_module.FreeModule_ambient_pid,
1034
+ FreeQuadraticModule_generic_pid,
1035
+ FreeQuadraticModule_ambient_domain):
1036
+ """
1037
+ Ambient free quadratic module over a principal ideal domain.
1038
+ """
1039
+ def __init__(self, base_ring, rank, inner_product_matrix, sparse=False):
1040
+ """
1041
+ Create the ambient free module of given rank over the given
1042
+ principal ideal domain.
1043
+
1044
+ INPUT:
1045
+
1046
+ - ``base_ring`` -- a principal ideal domain
1047
+
1048
+ - ``rank`` -- nonnegative integer
1049
+
1050
+ - ``sparse`` -- boolean (default: ``False``)
1051
+
1052
+ - ``inner_product_matrix`` -- boolean (default: ``None``)
1053
+
1054
+ EXAMPLES::
1055
+
1056
+ sage: ZZ^3
1057
+ Ambient free module of rank 3 over the principal ideal domain Integer Ring
1058
+ sage: FreeModule(ZZ,3,inner_product_matrix=Matrix([[2,-1,0],[-1,2,-1],[0,-1,2]]))
1059
+ Ambient free quadratic module of rank 3 over the principal ideal domain Integer Ring
1060
+ Inner product matrix:
1061
+ [ 2 -1 0]
1062
+ [-1 2 -1]
1063
+ [ 0 -1 2]
1064
+ """
1065
+ free_module.FreeModule_ambient_pid.__init__(self, base_ring=base_ring, rank=rank, sparse=sparse)
1066
+ self._inner_product_matrix = inner_product_matrix
1067
+
1068
+ def _repr_(self):
1069
+ """
1070
+ The printing representation of ``self``.
1071
+
1072
+ EXAMPLES::
1073
+
1074
+ sage: M = FreeModule(ZZ, 2, inner_product_matrix=[[2,-1],[-1,2]])
1075
+ sage: M
1076
+ Ambient free quadratic module of rank 2 over the principal ideal domain Integer Ring
1077
+ Inner product matrix:
1078
+ [ 2 -1]
1079
+ [-1 2]
1080
+
1081
+ Without a user specified inner product the class and printing
1082
+ is simpler::
1083
+
1084
+ sage: M = FreeModule(ZZ,7)
1085
+ sage: M
1086
+ Ambient free module of rank 7 over the principal ideal domain Integer Ring
1087
+ sage: print(M._repr_())
1088
+ Ambient free module of rank 7 over the principal ideal domain Integer Ring
1089
+
1090
+ The system representation can be overwritten, but leaves
1091
+ :meth:`_repr_` unmodified::
1092
+
1093
+ sage: M.rename('M')
1094
+ sage: M
1095
+ M
1096
+ sage: print(M._repr_())
1097
+ Ambient free module of rank 7 over the principal ideal domain Integer Ring
1098
+
1099
+ Sparse modules print this fact::
1100
+
1101
+ sage: N = FreeModule(ZZ,7,sparse=True)
1102
+ sage: N
1103
+ Ambient sparse free module of rank 7 over the principal ideal domain Integer Ring
1104
+ """
1105
+ if self.is_sparse():
1106
+ return "Ambient sparse free quadratic module of rank %s over the principal ideal domain %s\n" % (
1107
+ self.rank(), self.base_ring()) + \
1108
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
1109
+ return "Ambient free quadratic module of rank %s over the principal ideal domain %s\n" % (
1110
+ self.rank(), self.base_ring()) + \
1111
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
1112
+
1113
+
1114
+ # #############################################################################
1115
+ #
1116
+ # Ambient free modules over a field (i.e., a vector space).
1117
+ #
1118
+ # #############################################################################
1119
+
1120
+ class FreeQuadraticModule_ambient_field(free_module.FreeModule_ambient_field,
1121
+ FreeQuadraticModule_generic_field,
1122
+ FreeQuadraticModule_ambient_pid):
1123
+
1124
+ def __init__(self, base_field, dimension, inner_product_matrix, sparse=False):
1125
+ """
1126
+ Create the ambient vector space of given dimension over the given field.
1127
+
1128
+ INPUT:
1129
+
1130
+ - ``base_field`` -- a field
1131
+
1132
+ - ``dimension`` -- nonnegative integer
1133
+
1134
+ - ``sparse`` -- boolean (default: ``False``)
1135
+
1136
+ EXAMPLES::
1137
+
1138
+ sage: VectorSpace(QQ,3,inner_product_matrix=[[2,1,0],[1,2,0],[0,1,2]])
1139
+ Ambient quadratic space of dimension 3 over Rational Field
1140
+ Inner product matrix:
1141
+ [2 1 0]
1142
+ [1 2 0]
1143
+ [0 1 2]
1144
+
1145
+ TESTS:
1146
+
1147
+ Check for :issue:`10606`::
1148
+
1149
+ sage: D = matrix.diagonal(ZZ, [1,1])
1150
+ sage: V = VectorSpace(GF(46349), 2, inner_product_matrix=D) # needs sage.rings.finite_rings
1151
+ sage: deepcopy(V) # needs sage.rings.finite_rings
1152
+ Ambient quadratic space of dimension 2 over Finite Field
1153
+ of size 46349
1154
+ Inner product matrix:
1155
+ [1 0]
1156
+ [0 1]
1157
+ """
1158
+ free_module.FreeModule_ambient_field.__init__(
1159
+ self, base_field=base_field, dimension=dimension, sparse=sparse)
1160
+ self._inner_product_matrix = inner_product_matrix
1161
+
1162
+ def _repr_(self):
1163
+ """
1164
+ The printing representation of ``self``.
1165
+
1166
+ EXAMPLES::
1167
+
1168
+ sage: V = FreeModule(QQ,7)
1169
+ sage: V
1170
+ Vector space of dimension 7 over Rational Field
1171
+ sage: print(V._repr_())
1172
+ Vector space of dimension 7 over Rational Field
1173
+
1174
+ The system representation can be overwritten, but leaves
1175
+ :meth:`_repr_` unmodified::
1176
+
1177
+ sage: V.rename('V')
1178
+ sage: V
1179
+ V
1180
+ sage: print(V._repr_())
1181
+ Vector space of dimension 7 over Rational Field
1182
+
1183
+ Sparse modules print this fact::
1184
+
1185
+ sage: U = FreeModule(QQ,7,sparse=True)
1186
+ sage: U
1187
+ Sparse vector space of dimension 7 over Rational Field
1188
+ """
1189
+ if self.is_sparse():
1190
+ return "Ambient sparse free quadratic space of dimension %s over %s\n" % (self.rank(), self.base_ring()) + \
1191
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
1192
+ return "Ambient quadratic space of dimension %s over %s\n" % (self.rank(), self.base_ring()) + \
1193
+ "Inner product matrix:\n%s" % self.inner_product_matrix()
1194
+
1195
+
1196
+ # #############################################################################
1197
+ #
1198
+ # R-Submodule of K^n where K is the fraction field of a principal ideal domain R.
1199
+ #
1200
+ # #############################################################################
1201
+
1202
+
1203
+ class FreeQuadraticModule_submodule_with_basis_pid(free_module.FreeModule_submodule_with_basis_pid,
1204
+ FreeQuadraticModule_generic_pid):
1205
+ r"""
1206
+ An `R`-submodule of `K^n` with distinguished basis, where `K` is
1207
+ the fraction field of a principal ideal domain `R`.
1208
+
1209
+ Modules are ordered by inclusion.
1210
+
1211
+ EXAMPLES:
1212
+
1213
+ First we compare two equal vector spaces::
1214
+
1215
+ sage: A = FreeQuadraticModule(QQ,3,2*matrix.identity(3))
1216
+ sage: V = A.span([[1,2,3], [5,6,7], [8,9,10]])
1217
+ sage: W = A.span([[5,6,7], [8,9,10]])
1218
+ sage: V == W
1219
+ True
1220
+
1221
+ Next we compare a one dimensional space to the two dimensional
1222
+ space defined above::
1223
+
1224
+ sage: M = A.span([[5,6,7]])
1225
+ sage: V == M
1226
+ False
1227
+ sage: M < V
1228
+ True
1229
+ sage: V < M
1230
+ False
1231
+
1232
+ We compare a `\ZZ`-module to the one-dimensional space above::
1233
+
1234
+ sage: V = A.span([[5,6,7]])
1235
+ sage: V = V.change_ring(ZZ).scale(1/11)
1236
+ sage: V < M
1237
+ True
1238
+ sage: M < V
1239
+ False
1240
+ """
1241
+ def __init__(self, ambient, basis, inner_product_matrix,
1242
+ check=True, echelonize=False, echelonized_basis=None,
1243
+ already_echelonized=False):
1244
+ """
1245
+ Create a free module with basis over a PID.
1246
+
1247
+ EXAMPLES::
1248
+
1249
+ sage: A = diagonal_matrix([1,2,2])
1250
+ sage: M = FreeQuadraticModule(ZZ,3,inner_product_matrix=A)
1251
+ sage: W = M.span_of_basis([[1,2,3],[4,5,6]]); W
1252
+ Free quadratic module of degree 3 and rank 2 over Integer Ring
1253
+ Basis matrix:
1254
+ [1 2 3]
1255
+ [4 5 6]
1256
+ Inner product matrix:
1257
+ [1 0 0]
1258
+ [0 2 0]
1259
+ [0 0 2]
1260
+
1261
+ sage: W = M.span_of_basis([[1,2,3/2],[4,5,6]]); W
1262
+ Free quadratic module of degree 3 and rank 2 over Integer Ring
1263
+ Basis matrix:
1264
+ [ 1 2 3/2]
1265
+ [ 4 5 6]
1266
+ Inner product matrix:
1267
+ [1 0 0]
1268
+ [0 2 0]
1269
+ [0 0 2]
1270
+
1271
+ TESTS:
1272
+
1273
+ We test that :issue:`23703` is fixed::
1274
+
1275
+ sage: A = FreeQuadraticModule(ZZ, 1, matrix.identity(1))
1276
+ sage: B = A.span([[1/2]])
1277
+ sage: C = B.span([[1]])
1278
+ sage: B.intersection(C) == C.intersection(B)
1279
+ True
1280
+ """
1281
+ free_module.FreeModule_submodule_with_basis_pid.__init__(
1282
+ self, ambient=ambient, basis=basis, check=check,
1283
+ echelonize=echelonize, echelonized_basis=echelonized_basis, already_echelonized=already_echelonized)
1284
+ self._inner_product_matrix = inner_product_matrix
1285
+
1286
+ def _repr_(self):
1287
+ """
1288
+ The printing representation of ``self``.
1289
+
1290
+ EXAMPLES::
1291
+
1292
+ sage: L = ZZ^8
1293
+ sage: E = L.submodule_with_basis([ L.gen(i) - L.gen(0) for i in range(1,8) ])
1294
+ sage: E # indirect doctest
1295
+ Free module of degree 8 and rank 7 over Integer Ring
1296
+ User basis matrix:
1297
+ [-1 1 0 0 0 0 0 0]
1298
+ [-1 0 1 0 0 0 0 0]
1299
+ [-1 0 0 1 0 0 0 0]
1300
+ [-1 0 0 0 1 0 0 0]
1301
+ [-1 0 0 0 0 1 0 0]
1302
+ [-1 0 0 0 0 0 1 0]
1303
+ [-1 0 0 0 0 0 0 1]
1304
+
1305
+ sage: M = FreeModule(ZZ,8,sparse=True)
1306
+ sage: N = M.submodule_with_basis([ M.gen(i) - M.gen(0) for i in range(1,8) ])
1307
+ sage: N # indirect doctest
1308
+ Sparse free module of degree 8 and rank 7 over Integer Ring
1309
+ User basis matrix:
1310
+ [-1 1 0 0 0 0 0 0]
1311
+ [-1 0 1 0 0 0 0 0]
1312
+ [-1 0 0 1 0 0 0 0]
1313
+ [-1 0 0 0 1 0 0 0]
1314
+ [-1 0 0 0 0 1 0 0]
1315
+ [-1 0 0 0 0 0 1 0]
1316
+ [-1 0 0 0 0 0 0 1]
1317
+ """
1318
+ if self.is_sparse():
1319
+ s = "Sparse free quadratic module of degree %s and rank %s over %s\n" % (
1320
+ self.degree(), self.rank(), self.base_ring()) + \
1321
+ "Basis matrix:\n%r\n" % self.basis_matrix() + \
1322
+ "Inner product matrix:\n%r" % self.inner_product_matrix()
1323
+ else:
1324
+ s = "Free quadratic module of degree %s and rank %s over %s\n" % (
1325
+ self.degree(), self.rank(), self.base_ring()) + \
1326
+ "Basis matrix:\n%r\n" % self.basis_matrix() + \
1327
+ "Inner product matrix:\n%r" % self.inner_product_matrix()
1328
+ return s
1329
+
1330
+ def _latex_(self):
1331
+ r"""
1332
+ Return latex representation of this free module.
1333
+
1334
+ EXAMPLES::
1335
+
1336
+ sage: A = ZZ^3
1337
+ sage: M = A.span_of_basis([[1,2,3],[4,5,6]])
1338
+ sage: M._latex_()
1339
+ '\\mathrm{RowSpan}_{\\Bold{Z}}\\left(\\begin{array}{rrr}\n1 & 2 & 3 \\\\\n4 & 5 & 6\n\\end{array}\\right)'
1340
+ """
1341
+ return "\\mathrm{RowSpan}_{%s}%s" % (latex.latex(self.base_ring()),
1342
+ latex.latex(self.basis_matrix()))
1343
+
1344
+ def change_ring(self, R):
1345
+ """
1346
+ Return the free module over `R` obtained by coercing each
1347
+ element of ``self`` into a vector over the fraction field of `R`,
1348
+ then taking the resulting `R`-module.
1349
+
1350
+ This raises a :exc:`TypeError` if coercion is not possible.
1351
+
1352
+ INPUT:
1353
+
1354
+ - ``R`` -- a principal ideal domain
1355
+
1356
+ EXAMPLES:
1357
+
1358
+ Changing rings preserves the inner product and the user basis::
1359
+
1360
+ sage: V = QQ^3
1361
+ sage: W = V.subspace([[2, '1/2', 1]]); W
1362
+ Vector space of degree 3 and dimension 1 over Rational Field
1363
+ Basis matrix:
1364
+ [ 1 1/4 1/2]
1365
+ sage: W.change_ring(GF(7))
1366
+ Vector space of degree 3 and dimension 1 over Finite Field of size 7
1367
+ Basis matrix:
1368
+ [1 2 4]
1369
+
1370
+ sage: N = FreeModule(ZZ, 2, inner_product_matrix=[[1,-1], [2,5]])
1371
+ sage: N.inner_product_matrix()
1372
+ [ 1 -1]
1373
+ [ 2 5]
1374
+ sage: Np = N.change_ring(RDF)
1375
+ sage: Np.inner_product_matrix()
1376
+ [ 1.0 -1.0]
1377
+ [ 2.0 5.0]
1378
+ """
1379
+ if self.base_ring() is R:
1380
+ return self
1381
+ K = R.fraction_field()
1382
+ A = self.inner_product_matrix()
1383
+ V = QuadraticSpace(K, self.degree(), inner_product_matrix=A)
1384
+ B = [V(b) for b in self.basis()]
1385
+ M = FreeQuadraticModule(R, self.degree(), inner_product_matrix=A)
1386
+ if self.has_user_basis():
1387
+ return M.span_of_basis(B)
1388
+ return M.span(B)
1389
+
1390
+
1391
+ class FreeQuadraticModule_submodule_pid(free_module.FreeModule_submodule_pid,
1392
+ FreeQuadraticModule_submodule_with_basis_pid):
1393
+ """
1394
+ An `R`-submodule of `K^n` where `K` is the fraction field of a
1395
+ principal ideal domain `R`.
1396
+
1397
+ EXAMPLES::
1398
+
1399
+ sage: M = ZZ^3
1400
+ sage: W = M.span_of_basis([[1,2,3], [4,5,19]]); W
1401
+ Free module of degree 3 and rank 2 over Integer Ring
1402
+ User basis matrix:
1403
+ [ 1 2 3]
1404
+ [ 4 5 19]
1405
+
1406
+ We can save and load submodules and elements::
1407
+
1408
+ sage: loads(W.dumps()) == W
1409
+ True
1410
+ sage: v = W.0 + W.1
1411
+ sage: loads(v.dumps()) == v
1412
+ True
1413
+ """
1414
+ def __init__(self, ambient, gens, inner_product_matrix, check=True, already_echelonized=False):
1415
+ """
1416
+ Create an embedded free module over a PID.
1417
+
1418
+ EXAMPLES::
1419
+
1420
+ sage: V = ZZ^3
1421
+ sage: W = V.span([[1,2,3],[4,5,6]])
1422
+ sage: W
1423
+ Free module of degree 3 and rank 2 over Integer Ring
1424
+ Echelon basis matrix:
1425
+ [1 2 3]
1426
+ [0 3 6]
1427
+ """
1428
+ free_module.FreeModule_submodule_pid.__init__(
1429
+ self, ambient=ambient, gens=gens, check=check, already_echelonized=already_echelonized)
1430
+ self._inner_product_matrix = inner_product_matrix
1431
+
1432
+ def _repr_(self):
1433
+ """
1434
+ The printing representation of ``self``.
1435
+
1436
+ EXAMPLES::
1437
+
1438
+ sage: M = FreeModule(ZZ,8,inner_product_matrix=1)
1439
+ sage: L = M.submodule([ M.gen(i) - M.gen(0) for i in range(1,8) ])
1440
+ sage: L # indirect doctest
1441
+ Free module of degree 8 and rank 7 over Integer Ring
1442
+ Echelon basis matrix:
1443
+ [ 1 0 0 0 0 0 0 -1]
1444
+ [ 0 1 0 0 0 0 0 -1]
1445
+ [ 0 0 1 0 0 0 0 -1]
1446
+ [ 0 0 0 1 0 0 0 -1]
1447
+ [ 0 0 0 0 1 0 0 -1]
1448
+ [ 0 0 0 0 0 1 0 -1]
1449
+ [ 0 0 0 0 0 0 1 -1]
1450
+ """
1451
+ if self.is_sparse():
1452
+ s = "Sparse free module of degree %s and rank %s over %s\n" % (
1453
+ self.degree(), self.rank(), self.base_ring()) + \
1454
+ "Echelon basis matrix:\n%s" % self.basis_matrix()
1455
+ else:
1456
+ s = "Free module of degree %s and rank %s over %s\n" % (
1457
+ self.degree(), self.rank(), self.base_ring()) + \
1458
+ "Echelon basis matrix:\n%s" % self.basis_matrix()
1459
+ return s
1460
+
1461
+
1462
+ class FreeQuadraticModule_submodule_with_basis_field(free_module.FreeModule_submodule_with_basis_field,
1463
+ FreeQuadraticModule_generic_field,
1464
+ FreeQuadraticModule_submodule_with_basis_pid):
1465
+ """
1466
+ An embedded vector subspace with a distinguished user basis.
1467
+
1468
+ EXAMPLES::
1469
+
1470
+ sage: M = QQ^3; W = M.submodule_with_basis([[1,2,3], [4,5,19]]); W
1471
+ Vector space of degree 3 and dimension 2 over Rational Field
1472
+ User basis matrix:
1473
+ [ 1 2 3]
1474
+ [ 4 5 19]
1475
+
1476
+ Since this is an embedded vector subspace with a distinguished user
1477
+ basis possibly different than the echelonized basis, the
1478
+ ``echelon_coordinates()`` and user ``coordinates()`` do not agree::
1479
+
1480
+ sage: V = QQ^3
1481
+ sage: W = V.submodule_with_basis([[1,2,3], [4,5,6]])
1482
+ sage: W
1483
+ Vector space of degree 3 and dimension 2 over Rational Field
1484
+ User basis matrix:
1485
+ [1 2 3]
1486
+ [4 5 6]
1487
+
1488
+ sage: v = V([1,5,9])
1489
+ sage: W.echelon_coordinates(v)
1490
+ [1, 5]
1491
+ sage: vector(QQ, W.echelon_coordinates(v)) * W.echelonized_basis_matrix()
1492
+ (1, 5, 9)
1493
+
1494
+ sage: v = V([1,5,9])
1495
+ sage: W.coordinates(v)
1496
+ [5, -1]
1497
+ sage: vector(QQ, W.coordinates(v)) * W.basis_matrix()
1498
+ (1, 5, 9)
1499
+
1500
+ We can load and save submodules::
1501
+
1502
+ sage: loads(W.dumps()) == W
1503
+ True
1504
+
1505
+ sage: K.<x> = FractionField(PolynomialRing(QQ,'x'))
1506
+ sage: M = K^3; W = M.span_of_basis([[1,1,x]])
1507
+ sage: loads(W.dumps()) == W
1508
+ True
1509
+ """
1510
+ def __init__(self, ambient, basis, inner_product_matrix,
1511
+ check=True, echelonize=False, echelonized_basis=None, already_echelonized=False):
1512
+ """
1513
+ Create a vector space with given basis.
1514
+
1515
+ EXAMPLES::
1516
+
1517
+ sage: V = QQ^3
1518
+ sage: W = V.span_of_basis([[1,2,3], [4,5,6]])
1519
+ sage: W
1520
+ Vector space of degree 3 and dimension 2 over Rational Field
1521
+ User basis matrix:
1522
+ [1 2 3]
1523
+ [4 5 6]
1524
+ sage: V = VectorSpace(QQ, 3, inner_product_matrix=1)
1525
+ sage: V.span_of_basis([[1,2,3], [4,5,6]])
1526
+ Quadratic space of degree 3 and dimension 2 over Rational Field
1527
+ Basis matrix:
1528
+ [1 2 3]
1529
+ [4 5 6]
1530
+ Inner product matrix:
1531
+ [1 0 0]
1532
+ [0 1 0]
1533
+ [0 0 1]
1534
+ """
1535
+ free_module.FreeModule_submodule_with_basis_field.__init__(
1536
+ self, ambient=ambient, basis=basis, check=check,
1537
+ echelonize=echelonize, echelonized_basis=echelonized_basis, already_echelonized=already_echelonized)
1538
+ self._inner_product_matrix = inner_product_matrix
1539
+
1540
+ def _repr_(self):
1541
+ """
1542
+ The printing representation of ``self``.
1543
+
1544
+ EXAMPLES::
1545
+
1546
+ sage: V = VectorSpace(QQ,5)
1547
+ sage: U = V.submodule([ V.gen(i) - V.gen(0) for i in range(1,5) ])
1548
+ sage: U # indirect doctest
1549
+ Vector space of degree 5 and dimension 4 over Rational Field
1550
+ Basis matrix:
1551
+ [ 1 0 0 0 -1]
1552
+ [ 0 1 0 0 -1]
1553
+ [ 0 0 1 0 -1]
1554
+ [ 0 0 0 1 -1]
1555
+ sage: print(U._repr_())
1556
+ Vector space of degree 5 and dimension 4 over Rational Field
1557
+ Basis matrix:
1558
+ [ 1 0 0 0 -1]
1559
+ [ 0 1 0 0 -1]
1560
+ [ 0 0 1 0 -1]
1561
+ [ 0 0 0 1 -1]
1562
+
1563
+ The system representation can be overwritten, but leaves
1564
+ :meth:`_repr_` unmodified::
1565
+
1566
+ sage: U.rename('U')
1567
+ sage: U
1568
+ U
1569
+ sage: print(U._repr_())
1570
+ Vector space of degree 5 and dimension 4 over Rational Field
1571
+ Basis matrix:
1572
+ [ 1 0 0 0 -1]
1573
+ [ 0 1 0 0 -1]
1574
+ [ 0 0 1 0 -1]
1575
+ [ 0 0 0 1 -1]
1576
+
1577
+ Sparse vector spaces print this fact::
1578
+
1579
+ sage: V = VectorSpace(QQ,5,sparse=True)
1580
+ sage: U = V.submodule([ V.gen(i) - V.gen(0) for i in range(1,5) ])
1581
+ sage: U # indirect doctest
1582
+ Sparse vector space of degree 5 and dimension 4 over Rational Field
1583
+ Basis matrix:
1584
+ [ 1 0 0 0 -1]
1585
+ [ 0 1 0 0 -1]
1586
+ [ 0 0 1 0 -1]
1587
+ [ 0 0 0 1 -1]
1588
+ """
1589
+ if self.is_sparse():
1590
+ return "Sparse quadratic space of degree %s and dimension %s over %s\n" % (
1591
+ self.degree(), self.dimension(), self.base_field()) + \
1592
+ "Basis matrix:\n%r" % self.basis_matrix() + \
1593
+ "Inner product matrix:\n%r" % self.inner_product_matrix()
1594
+ return "Quadratic space of degree %s and dimension %s over %s\n" % (
1595
+ self.degree(), self.dimension(), self.base_field()) + \
1596
+ "Basis matrix:\n%r\n" % self.basis_matrix() + \
1597
+ "Inner product matrix:\n%r" % self.inner_product_matrix()
1598
+
1599
+
1600
+ class FreeQuadraticModule_submodule_field(free_module.FreeModule_submodule_field,
1601
+ FreeQuadraticModule_submodule_with_basis_field):
1602
+ """
1603
+ An embedded vector subspace with echelonized basis.
1604
+
1605
+ EXAMPLES:
1606
+
1607
+ Since this is an embedded vector subspace with echelonized basis,
1608
+ the methods :meth:`echelon_coordinates` and :meth:`coordinates` return the same
1609
+ coordinates::
1610
+
1611
+ sage: V = QQ^3
1612
+ sage: W = V.span([[1,2,3], [4,5,6]])
1613
+ sage: W
1614
+ Vector space of degree 3 and dimension 2 over Rational Field
1615
+ Basis matrix:
1616
+ [ 1 0 -1]
1617
+ [ 0 1 2]
1618
+
1619
+ sage: v = V([1,5,9])
1620
+ sage: W.echelon_coordinates(v)
1621
+ [1, 5]
1622
+ sage: vector(QQ, W.echelon_coordinates(v)) * W.basis_matrix()
1623
+ (1, 5, 9)
1624
+
1625
+ sage: v = V([1,5,9])
1626
+ sage: W.coordinates(v)
1627
+ [1, 5]
1628
+ sage: vector(QQ, W.coordinates(v)) * W.basis_matrix()
1629
+ (1, 5, 9)
1630
+ """
1631
+ def __init__(self, ambient, gens, inner_product_matrix, check=True, already_echelonized=False):
1632
+ """
1633
+ Create an embedded vector subspace with echelonized basis.
1634
+
1635
+ EXAMPLES::
1636
+
1637
+ sage: V = QQ^3
1638
+ sage: W = V.span([[1,2,3], [4,5,6]])
1639
+ sage: W
1640
+ Vector space of degree 3 and dimension 2 over Rational Field
1641
+ Basis matrix:
1642
+ [ 1 0 -1]
1643
+ [ 0 1 2]
1644
+ """
1645
+ free_module.FreeModule_submodule_field.__init__(
1646
+ self, ambient=ambient, gens=gens, check=check, already_echelonized=already_echelonized)
1647
+ self._inner_product_matrix = inner_product_matrix
1648
+
1649
+ def _repr_(self):
1650
+ """
1651
+ The default printing representation of ``self``.
1652
+
1653
+ EXAMPLES::
1654
+
1655
+ sage: V = VectorSpace(QQ, 5)
1656
+ sage: U = V.submodule([ V.gen(i) - V.gen(0) for i in range(1,5) ])
1657
+ sage: U # indirect doctest
1658
+ Vector space of degree 5 and dimension 4 over Rational Field
1659
+ Basis matrix:
1660
+ [ 1 0 0 0 -1]
1661
+ [ 0 1 0 0 -1]
1662
+ [ 0 0 1 0 -1]
1663
+ [ 0 0 0 1 -1]
1664
+ sage: print(U._repr_())
1665
+ Vector space of degree 5 and dimension 4 over Rational Field
1666
+ Basis matrix:
1667
+ [ 1 0 0 0 -1]
1668
+ [ 0 1 0 0 -1]
1669
+ [ 0 0 1 0 -1]
1670
+ [ 0 0 0 1 -1]
1671
+
1672
+ The system representation can be overwritten, but leaves
1673
+ :meth:`_repr_` unmodified::
1674
+
1675
+ sage: U.rename('U')
1676
+ sage: U
1677
+ U
1678
+ sage: print(U._repr_())
1679
+ Vector space of degree 5 and dimension 4 over Rational Field
1680
+ Basis matrix:
1681
+ [ 1 0 0 0 -1]
1682
+ [ 0 1 0 0 -1]
1683
+ [ 0 0 1 0 -1]
1684
+ [ 0 0 0 1 -1]
1685
+
1686
+ Sparse vector spaces print this fact::
1687
+
1688
+ sage: V = VectorSpace(QQ, 5, sparse=True)
1689
+ sage: U = V.submodule([ V.gen(i) - V.gen(0) for i in range(1,5) ])
1690
+ sage: U # indirect doctest
1691
+ Sparse vector space of degree 5 and dimension 4 over Rational Field
1692
+ Basis matrix:
1693
+ [ 1 0 0 0 -1]
1694
+ [ 0 1 0 0 -1]
1695
+ [ 0 0 1 0 -1]
1696
+ [ 0 0 0 1 -1]
1697
+ """
1698
+ if self.is_sparse():
1699
+ return "Sparse quadratic space of degree %s and dimension %s over %s\n" % (
1700
+ self.degree(), self.dimension(), self.base_field()) + \
1701
+ "Basis matrix:\n%r\n" % self.basis_matrix() + \
1702
+ "Inner product matrix:\n%r" % self.inner_product_matrix()
1703
+ return "Quadratic space of degree %s and dimension %s over %s\n" % (
1704
+ self.degree(), self.dimension(), self.base_field()) + \
1705
+ "Basis matrix:\n%r\n" % self.basis_matrix() + \
1706
+ "Inner product matrix:\n%r" % self.inner_product_matrix()