passagemath-modules 10.6.31rc3__cp314-cp314-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-modules might be problematic. Click here for more details.
- passagemath_modules-10.6.31rc3.dist-info/METADATA +281 -0
- passagemath_modules-10.6.31rc3.dist-info/RECORD +807 -0
- passagemath_modules-10.6.31rc3.dist-info/WHEEL +5 -0
- passagemath_modules-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_modules.libs/libgcc_s-2d945d6c.so.1 +0 -0
- passagemath_modules.libs/libgfortran-67378ab2.so.5.0.0 +0 -0
- passagemath_modules.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_modules.libs/libgsl-23768756.so.28.0.0 +0 -0
- passagemath_modules.libs/libmpc-7897025b.so.3.3.1 +0 -0
- passagemath_modules.libs/libmpfr-e34bb864.so.6.2.1 +0 -0
- passagemath_modules.libs/libopenblasp-r0-503f0c35.3.29.so +0 -0
- sage/algebras/all__sagemath_modules.py +20 -0
- sage/algebras/catalog.py +148 -0
- sage/algebras/clifford_algebra.py +3107 -0
- sage/algebras/clifford_algebra_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/algebras/clifford_algebra_element.pxd +16 -0
- sage/algebras/clifford_algebra_element.pyx +997 -0
- sage/algebras/commutative_dga.py +4252 -0
- sage/algebras/exterior_algebra_groebner.cpython-314-aarch64-linux-musl.so +0 -0
- sage/algebras/exterior_algebra_groebner.pxd +55 -0
- sage/algebras/exterior_algebra_groebner.pyx +727 -0
- sage/algebras/finite_dimensional_algebras/all.py +2 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +1029 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd +12 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +706 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py +196 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +255 -0
- sage/algebras/finite_gca.py +528 -0
- sage/algebras/group_algebra.py +232 -0
- sage/algebras/lie_algebras/abelian.py +197 -0
- sage/algebras/lie_algebras/affine_lie_algebra.py +1213 -0
- sage/algebras/lie_algebras/all.py +25 -0
- sage/algebras/lie_algebras/all__sagemath_modules.py +1 -0
- sage/algebras/lie_algebras/bch.py +177 -0
- sage/algebras/lie_algebras/bgg_dual_module.py +1184 -0
- sage/algebras/lie_algebras/bgg_resolution.py +232 -0
- sage/algebras/lie_algebras/center_uea.py +767 -0
- sage/algebras/lie_algebras/classical_lie_algebra.py +2516 -0
- sage/algebras/lie_algebras/examples.py +683 -0
- sage/algebras/lie_algebras/free_lie_algebra.py +973 -0
- sage/algebras/lie_algebras/heisenberg.py +820 -0
- sage/algebras/lie_algebras/lie_algebra.py +1562 -0
- sage/algebras/lie_algebras/lie_algebra_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/algebras/lie_algebras/lie_algebra_element.pxd +68 -0
- sage/algebras/lie_algebras/lie_algebra_element.pyx +2122 -0
- sage/algebras/lie_algebras/morphism.py +661 -0
- sage/algebras/lie_algebras/nilpotent_lie_algebra.py +457 -0
- sage/algebras/lie_algebras/onsager.py +1324 -0
- sage/algebras/lie_algebras/poincare_birkhoff_witt.py +816 -0
- sage/algebras/lie_algebras/quotient.py +462 -0
- sage/algebras/lie_algebras/rank_two_heisenberg_virasoro.py +355 -0
- sage/algebras/lie_algebras/representation.py +1040 -0
- sage/algebras/lie_algebras/structure_coefficients.py +459 -0
- sage/algebras/lie_algebras/subalgebra.py +967 -0
- sage/algebras/lie_algebras/symplectic_derivation.py +289 -0
- sage/algebras/lie_algebras/verma_module.py +1630 -0
- sage/algebras/lie_algebras/virasoro.py +1186 -0
- sage/algebras/octonion_algebra.cpython-314-aarch64-linux-musl.so +0 -0
- sage/algebras/octonion_algebra.pxd +20 -0
- sage/algebras/octonion_algebra.pyx +987 -0
- sage/algebras/orlik_solomon.py +907 -0
- sage/algebras/orlik_terao.py +779 -0
- sage/algebras/steenrod/all.py +7 -0
- sage/algebras/steenrod/steenrod_algebra.py +4258 -0
- sage/algebras/steenrod/steenrod_algebra_bases.py +1179 -0
- sage/algebras/steenrod/steenrod_algebra_misc.py +1167 -0
- sage/algebras/steenrod/steenrod_algebra_mult.py +954 -0
- sage/algebras/weyl_algebra.py +1126 -0
- sage/all__sagemath_modules.py +62 -0
- sage/calculus/all__sagemath_modules.py +19 -0
- sage/calculus/expr.py +205 -0
- sage/calculus/integration.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/integration.pyx +698 -0
- sage/calculus/interpolation.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/interpolation.pxd +13 -0
- sage/calculus/interpolation.pyx +387 -0
- sage/calculus/interpolators.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/interpolators.pyx +326 -0
- sage/calculus/ode.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/ode.pxd +5 -0
- sage/calculus/ode.pyx +610 -0
- sage/calculus/riemann.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/riemann.pyx +1521 -0
- sage/calculus/test_sympy.py +201 -0
- sage/calculus/transforms/all.py +7 -0
- sage/calculus/transforms/dft.py +844 -0
- sage/calculus/transforms/dwt.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/transforms/dwt.pxd +7 -0
- sage/calculus/transforms/dwt.pyx +160 -0
- sage/calculus/transforms/fft.cpython-314-aarch64-linux-musl.so +0 -0
- sage/calculus/transforms/fft.pxd +12 -0
- sage/calculus/transforms/fft.pyx +487 -0
- sage/calculus/wester.py +662 -0
- sage/coding/abstract_code.py +1108 -0
- sage/coding/ag_code.py +868 -0
- sage/coding/ag_code_decoders.cpython-314-aarch64-linux-musl.so +0 -0
- sage/coding/ag_code_decoders.pyx +2639 -0
- sage/coding/all.py +15 -0
- sage/coding/bch_code.py +494 -0
- sage/coding/binary_code.cpython-314-aarch64-linux-musl.so +0 -0
- sage/coding/binary_code.pxd +124 -0
- sage/coding/binary_code.pyx +4139 -0
- sage/coding/bounds_catalog.py +43 -0
- sage/coding/channel.py +819 -0
- sage/coding/channels_catalog.py +29 -0
- sage/coding/code_bounds.py +755 -0
- sage/coding/code_constructions.py +804 -0
- sage/coding/codes_catalog.py +111 -0
- sage/coding/cyclic_code.py +1329 -0
- sage/coding/databases.py +316 -0
- sage/coding/decoder.py +373 -0
- sage/coding/decoders_catalog.py +88 -0
- sage/coding/delsarte_bounds.py +709 -0
- sage/coding/encoder.py +390 -0
- sage/coding/encoders_catalog.py +64 -0
- sage/coding/extended_code.py +468 -0
- sage/coding/gabidulin_code.py +1058 -0
- sage/coding/golay_code.py +404 -0
- sage/coding/goppa_code.py +441 -0
- sage/coding/grs_code.py +2371 -0
- sage/coding/guava.py +107 -0
- sage/coding/guruswami_sudan/all.py +1 -0
- sage/coding/guruswami_sudan/gs_decoder.py +897 -0
- sage/coding/guruswami_sudan/interpolation.py +409 -0
- sage/coding/guruswami_sudan/utils.py +176 -0
- sage/coding/hamming_code.py +176 -0
- sage/coding/information_set_decoder.py +1032 -0
- sage/coding/kasami_codes.cpython-314-aarch64-linux-musl.so +0 -0
- sage/coding/kasami_codes.pyx +351 -0
- sage/coding/linear_code.py +3067 -0
- sage/coding/linear_code_no_metric.py +1354 -0
- sage/coding/linear_rank_metric.py +961 -0
- sage/coding/parity_check_code.py +353 -0
- sage/coding/punctured_code.py +719 -0
- sage/coding/reed_muller_code.py +999 -0
- sage/coding/self_dual_codes.py +942 -0
- sage/coding/source_coding/all.py +2 -0
- sage/coding/source_coding/huffman.py +553 -0
- sage/coding/subfield_subcode.py +423 -0
- sage/coding/two_weight_db.py +399 -0
- sage/combinat/all__sagemath_modules.py +7 -0
- sage/combinat/cartesian_product.py +347 -0
- sage/combinat/family.py +11 -0
- sage/combinat/free_module.py +1977 -0
- sage/combinat/root_system/all.py +147 -0
- sage/combinat/root_system/ambient_space.py +527 -0
- sage/combinat/root_system/associahedron.py +471 -0
- sage/combinat/root_system/braid_move_calculator.py +143 -0
- sage/combinat/root_system/braid_orbit.cpython-314-aarch64-linux-musl.so +0 -0
- sage/combinat/root_system/braid_orbit.pyx +144 -0
- sage/combinat/root_system/branching_rules.py +2301 -0
- sage/combinat/root_system/cartan_matrix.py +1245 -0
- sage/combinat/root_system/cartan_type.py +3069 -0
- sage/combinat/root_system/coxeter_group.py +162 -0
- sage/combinat/root_system/coxeter_matrix.py +1261 -0
- sage/combinat/root_system/coxeter_type.py +681 -0
- sage/combinat/root_system/dynkin_diagram.py +900 -0
- sage/combinat/root_system/extended_affine_weyl_group.py +2993 -0
- sage/combinat/root_system/fundamental_group.py +795 -0
- sage/combinat/root_system/hecke_algebra_representation.py +1203 -0
- sage/combinat/root_system/integrable_representations.py +1227 -0
- sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +1965 -0
- sage/combinat/root_system/pieri_factors.py +1147 -0
- sage/combinat/root_system/plot.py +1615 -0
- sage/combinat/root_system/root_lattice_realization_algebras.py +1214 -0
- sage/combinat/root_system/root_lattice_realizations.py +4628 -0
- sage/combinat/root_system/root_space.py +487 -0
- sage/combinat/root_system/root_system.py +882 -0
- sage/combinat/root_system/type_A.py +348 -0
- sage/combinat/root_system/type_A_affine.py +227 -0
- sage/combinat/root_system/type_A_infinity.py +241 -0
- sage/combinat/root_system/type_B.py +347 -0
- sage/combinat/root_system/type_BC_affine.py +287 -0
- sage/combinat/root_system/type_B_affine.py +216 -0
- sage/combinat/root_system/type_C.py +317 -0
- sage/combinat/root_system/type_C_affine.py +188 -0
- sage/combinat/root_system/type_D.py +357 -0
- sage/combinat/root_system/type_D_affine.py +208 -0
- sage/combinat/root_system/type_E.py +641 -0
- sage/combinat/root_system/type_E_affine.py +231 -0
- sage/combinat/root_system/type_F.py +387 -0
- sage/combinat/root_system/type_F_affine.py +137 -0
- sage/combinat/root_system/type_G.py +293 -0
- sage/combinat/root_system/type_G_affine.py +132 -0
- sage/combinat/root_system/type_H.py +105 -0
- sage/combinat/root_system/type_I.py +110 -0
- sage/combinat/root_system/type_Q.py +150 -0
- sage/combinat/root_system/type_affine.py +509 -0
- sage/combinat/root_system/type_dual.py +704 -0
- sage/combinat/root_system/type_folded.py +301 -0
- sage/combinat/root_system/type_marked.py +748 -0
- sage/combinat/root_system/type_reducible.py +601 -0
- sage/combinat/root_system/type_relabel.py +730 -0
- sage/combinat/root_system/type_super_A.py +837 -0
- sage/combinat/root_system/weight_lattice_realizations.py +1188 -0
- sage/combinat/root_system/weight_space.py +639 -0
- sage/combinat/root_system/weyl_characters.py +2238 -0
- sage/crypto/__init__.py +4 -0
- sage/crypto/all.py +28 -0
- sage/crypto/block_cipher/all.py +7 -0
- sage/crypto/block_cipher/des.py +1065 -0
- sage/crypto/block_cipher/miniaes.py +2171 -0
- sage/crypto/block_cipher/present.py +909 -0
- sage/crypto/block_cipher/sdes.py +1527 -0
- sage/crypto/boolean_function.cpython-314-aarch64-linux-musl.so +0 -0
- sage/crypto/boolean_function.pxd +10 -0
- sage/crypto/boolean_function.pyx +1487 -0
- sage/crypto/cipher.py +78 -0
- sage/crypto/classical.py +3668 -0
- sage/crypto/classical_cipher.py +569 -0
- sage/crypto/cryptosystem.py +387 -0
- sage/crypto/key_exchange/all.py +7 -0
- sage/crypto/key_exchange/catalog.py +24 -0
- sage/crypto/key_exchange/diffie_hellman.py +323 -0
- sage/crypto/key_exchange/key_exchange_scheme.py +107 -0
- sage/crypto/lattice.py +312 -0
- sage/crypto/lfsr.py +295 -0
- sage/crypto/lwe.py +840 -0
- sage/crypto/mq/__init__.py +4 -0
- sage/crypto/mq/mpolynomialsystemgenerator.py +204 -0
- sage/crypto/mq/rijndael_gf.py +2345 -0
- sage/crypto/mq/sbox.py +7 -0
- sage/crypto/mq/sr.py +3344 -0
- sage/crypto/public_key/all.py +5 -0
- sage/crypto/public_key/blum_goldwasser.py +776 -0
- sage/crypto/sbox.cpython-314-aarch64-linux-musl.so +0 -0
- sage/crypto/sbox.pyx +2090 -0
- sage/crypto/sboxes.py +2090 -0
- sage/crypto/stream.py +390 -0
- sage/crypto/stream_cipher.py +297 -0
- sage/crypto/util.py +519 -0
- sage/ext/all__sagemath_modules.py +1 -0
- sage/ext/interpreters/__init__.py +1 -0
- sage/ext/interpreters/all__sagemath_modules.py +2 -0
- sage/ext/interpreters/wrapper_cc.cpython-314-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_cc.pxd +30 -0
- sage/ext/interpreters/wrapper_cc.pyx +252 -0
- sage/ext/interpreters/wrapper_cdf.cpython-314-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_cdf.pxd +26 -0
- sage/ext/interpreters/wrapper_cdf.pyx +245 -0
- sage/ext/interpreters/wrapper_rdf.cpython-314-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_rdf.pxd +23 -0
- sage/ext/interpreters/wrapper_rdf.pyx +221 -0
- sage/ext/interpreters/wrapper_rr.cpython-314-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_rr.pxd +28 -0
- sage/ext/interpreters/wrapper_rr.pyx +335 -0
- sage/geometry/all__sagemath_modules.py +5 -0
- sage/geometry/toric_lattice.py +1745 -0
- sage/geometry/toric_lattice_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/geometry/toric_lattice_element.pyx +432 -0
- sage/groups/abelian_gps/abelian_group.py +1925 -0
- sage/groups/abelian_gps/abelian_group_element.py +164 -0
- sage/groups/abelian_gps/all__sagemath_modules.py +5 -0
- sage/groups/abelian_gps/dual_abelian_group.py +421 -0
- sage/groups/abelian_gps/dual_abelian_group_element.py +179 -0
- sage/groups/abelian_gps/element_base.py +341 -0
- sage/groups/abelian_gps/values.py +488 -0
- sage/groups/additive_abelian/additive_abelian_group.py +476 -0
- sage/groups/additive_abelian/additive_abelian_wrapper.py +857 -0
- sage/groups/additive_abelian/all.py +4 -0
- sage/groups/additive_abelian/qmodnz.py +231 -0
- sage/groups/additive_abelian/qmodnz_element.py +349 -0
- sage/groups/affine_gps/affine_group.py +535 -0
- sage/groups/affine_gps/all.py +1 -0
- sage/groups/affine_gps/catalog.py +17 -0
- sage/groups/affine_gps/euclidean_group.py +246 -0
- sage/groups/affine_gps/group_element.py +562 -0
- sage/groups/all__sagemath_modules.py +12 -0
- sage/groups/galois_group.py +479 -0
- sage/groups/matrix_gps/all.py +4 -0
- sage/groups/matrix_gps/all__sagemath_modules.py +13 -0
- sage/groups/matrix_gps/catalog.py +26 -0
- sage/groups/matrix_gps/coxeter_group.py +927 -0
- sage/groups/matrix_gps/finitely_generated.py +487 -0
- sage/groups/matrix_gps/group_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/groups/matrix_gps/group_element.pxd +11 -0
- sage/groups/matrix_gps/group_element.pyx +431 -0
- sage/groups/matrix_gps/linear.py +440 -0
- sage/groups/matrix_gps/matrix_group.py +617 -0
- sage/groups/matrix_gps/named_group.py +296 -0
- sage/groups/matrix_gps/orthogonal.py +544 -0
- sage/groups/matrix_gps/symplectic.py +251 -0
- sage/groups/matrix_gps/unitary.py +436 -0
- sage/groups/misc_gps/all__sagemath_modules.py +1 -0
- sage/groups/misc_gps/argument_groups.py +1905 -0
- sage/groups/misc_gps/imaginary_groups.py +479 -0
- sage/groups/perm_gps/all__sagemath_modules.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_modules.py +1 -0
- sage/groups/perm_gps/partn_ref/refinement_binary.cpython-314-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_binary.pxd +41 -0
- sage/groups/perm_gps/partn_ref/refinement_binary.pyx +1167 -0
- sage/groups/perm_gps/partn_ref/refinement_matrices.cpython-314-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_matrices.pxd +31 -0
- sage/groups/perm_gps/partn_ref/refinement_matrices.pyx +385 -0
- sage/homology/algebraic_topological_model.py +595 -0
- sage/homology/all.py +2 -0
- sage/homology/all__sagemath_modules.py +8 -0
- sage/homology/chain_complex.py +2148 -0
- sage/homology/chain_complex_homspace.py +165 -0
- sage/homology/chain_complex_morphism.py +629 -0
- sage/homology/chain_homotopy.py +604 -0
- sage/homology/chains.py +653 -0
- sage/homology/free_resolution.py +923 -0
- sage/homology/graded_resolution.py +567 -0
- sage/homology/hochschild_complex.py +756 -0
- sage/homology/homology_group.py +188 -0
- sage/homology/homology_morphism.py +422 -0
- sage/homology/homology_vector_space_with_basis.py +1454 -0
- sage/homology/koszul_complex.py +169 -0
- sage/homology/matrix_utils.py +205 -0
- sage/libs/all__sagemath_modules.py +1 -0
- sage/libs/gsl/__init__.py +1 -0
- sage/libs/gsl/airy.pxd +56 -0
- sage/libs/gsl/all.pxd +66 -0
- sage/libs/gsl/array.cpython-314-aarch64-linux-musl.so +0 -0
- sage/libs/gsl/array.pxd +5 -0
- sage/libs/gsl/array.pyx +102 -0
- sage/libs/gsl/bessel.pxd +208 -0
- sage/libs/gsl/blas.pxd +116 -0
- sage/libs/gsl/blas_types.pxd +34 -0
- sage/libs/gsl/block.pxd +52 -0
- sage/libs/gsl/chebyshev.pxd +37 -0
- sage/libs/gsl/clausen.pxd +12 -0
- sage/libs/gsl/combination.pxd +47 -0
- sage/libs/gsl/complex.pxd +151 -0
- sage/libs/gsl/coulomb.pxd +30 -0
- sage/libs/gsl/coupling.pxd +21 -0
- sage/libs/gsl/dawson.pxd +12 -0
- sage/libs/gsl/debye.pxd +24 -0
- sage/libs/gsl/dilog.pxd +14 -0
- sage/libs/gsl/eigen.pxd +46 -0
- sage/libs/gsl/elementary.pxd +12 -0
- sage/libs/gsl/ellint.pxd +48 -0
- sage/libs/gsl/elljac.pxd +8 -0
- sage/libs/gsl/erf.pxd +32 -0
- sage/libs/gsl/errno.pxd +26 -0
- sage/libs/gsl/exp.pxd +44 -0
- sage/libs/gsl/expint.pxd +44 -0
- sage/libs/gsl/fermi_dirac.pxd +44 -0
- sage/libs/gsl/fft.pxd +121 -0
- sage/libs/gsl/fit.pxd +50 -0
- sage/libs/gsl/gamma.pxd +94 -0
- sage/libs/gsl/gegenbauer.pxd +26 -0
- sage/libs/gsl/histogram.pxd +176 -0
- sage/libs/gsl/hyperg.pxd +52 -0
- sage/libs/gsl/integration.pxd +69 -0
- sage/libs/gsl/interp.pxd +109 -0
- sage/libs/gsl/laguerre.pxd +24 -0
- sage/libs/gsl/lambert.pxd +16 -0
- sage/libs/gsl/legendre.pxd +90 -0
- sage/libs/gsl/linalg.pxd +185 -0
- sage/libs/gsl/log.pxd +26 -0
- sage/libs/gsl/math.pxd +43 -0
- sage/libs/gsl/matrix.pxd +143 -0
- sage/libs/gsl/matrix_complex.pxd +130 -0
- sage/libs/gsl/min.pxd +67 -0
- sage/libs/gsl/monte.pxd +56 -0
- sage/libs/gsl/ntuple.pxd +32 -0
- sage/libs/gsl/odeiv.pxd +70 -0
- sage/libs/gsl/permutation.pxd +78 -0
- sage/libs/gsl/poly.pxd +40 -0
- sage/libs/gsl/pow_int.pxd +12 -0
- sage/libs/gsl/psi.pxd +28 -0
- sage/libs/gsl/qrng.pxd +29 -0
- sage/libs/gsl/random.pxd +257 -0
- sage/libs/gsl/rng.pxd +100 -0
- sage/libs/gsl/roots.pxd +72 -0
- sage/libs/gsl/sort.pxd +36 -0
- sage/libs/gsl/statistics.pxd +59 -0
- sage/libs/gsl/sum.pxd +55 -0
- sage/libs/gsl/synchrotron.pxd +16 -0
- sage/libs/gsl/transport.pxd +24 -0
- sage/libs/gsl/trig.pxd +58 -0
- sage/libs/gsl/types.pxd +137 -0
- sage/libs/gsl/vector.pxd +101 -0
- sage/libs/gsl/vector_complex.pxd +83 -0
- sage/libs/gsl/wavelet.pxd +49 -0
- sage/libs/gsl/zeta.pxd +28 -0
- sage/libs/mpc/__init__.pxd +114 -0
- sage/libs/mpc/types.pxd +28 -0
- sage/libs/mpfr/__init__.pxd +299 -0
- sage/libs/mpfr/types.pxd +26 -0
- sage/libs/mpmath/__init__.py +1 -0
- sage/libs/mpmath/all.py +27 -0
- sage/libs/mpmath/all__sagemath_modules.py +1 -0
- sage/libs/mpmath/utils.cpython-314-aarch64-linux-musl.so +0 -0
- sage/libs/mpmath/utils.pxd +4 -0
- sage/libs/mpmath/utils.pyx +319 -0
- sage/matrix/action.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/action.pxd +26 -0
- sage/matrix/action.pyx +596 -0
- sage/matrix/all.py +9 -0
- sage/matrix/args.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/args.pxd +144 -0
- sage/matrix/args.pyx +1668 -0
- sage/matrix/benchmark.py +1258 -0
- sage/matrix/berlekamp_massey.py +95 -0
- sage/matrix/compute_J_ideal.py +926 -0
- sage/matrix/constructor.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/constructor.pyx +750 -0
- sage/matrix/docs.py +430 -0
- sage/matrix/echelon_matrix.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/echelon_matrix.pyx +155 -0
- sage/matrix/matrix.pxd +2 -0
- sage/matrix/matrix0.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix0.pxd +68 -0
- sage/matrix/matrix0.pyx +6324 -0
- sage/matrix/matrix1.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix1.pxd +8 -0
- sage/matrix/matrix1.pyx +2851 -0
- sage/matrix/matrix2.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix2.pxd +25 -0
- sage/matrix/matrix2.pyx +20181 -0
- sage/matrix/matrix_cdv.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_cdv.pxd +4 -0
- sage/matrix/matrix_cdv.pyx +93 -0
- sage/matrix/matrix_complex_double_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_complex_double_dense.pxd +5 -0
- sage/matrix/matrix_complex_double_dense.pyx +98 -0
- sage/matrix/matrix_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_dense.pxd +5 -0
- sage/matrix/matrix_dense.pyx +343 -0
- sage/matrix/matrix_domain_dense.pxd +5 -0
- sage/matrix/matrix_domain_sparse.pxd +5 -0
- sage/matrix/matrix_double_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_double_dense.pxd +7 -0
- sage/matrix/matrix_double_dense.pyx +3906 -0
- sage/matrix/matrix_double_sparse.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_double_sparse.pxd +6 -0
- sage/matrix/matrix_double_sparse.pyx +248 -0
- sage/matrix/matrix_generic_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_generic_dense.pxd +7 -0
- sage/matrix/matrix_generic_dense.pyx +354 -0
- sage/matrix/matrix_generic_sparse.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_generic_sparse.pxd +7 -0
- sage/matrix/matrix_generic_sparse.pyx +461 -0
- sage/matrix/matrix_laurent_mpolynomial_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_laurent_mpolynomial_dense.pxd +5 -0
- sage/matrix/matrix_laurent_mpolynomial_dense.pyx +115 -0
- sage/matrix/matrix_misc.py +313 -0
- sage/matrix/matrix_numpy_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_numpy_dense.pxd +14 -0
- sage/matrix/matrix_numpy_dense.pyx +450 -0
- sage/matrix/matrix_numpy_integer_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_numpy_integer_dense.pxd +7 -0
- sage/matrix/matrix_numpy_integer_dense.pyx +59 -0
- sage/matrix/matrix_polynomial_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_polynomial_dense.pxd +5 -0
- sage/matrix/matrix_polynomial_dense.pyx +5341 -0
- sage/matrix/matrix_real_double_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_real_double_dense.pxd +7 -0
- sage/matrix/matrix_real_double_dense.pyx +122 -0
- sage/matrix/matrix_space.py +2848 -0
- sage/matrix/matrix_sparse.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_sparse.pxd +5 -0
- sage/matrix/matrix_sparse.pyx +1222 -0
- sage/matrix/matrix_window.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/matrix_window.pxd +37 -0
- sage/matrix/matrix_window.pyx +242 -0
- sage/matrix/misc_mpfr.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/misc_mpfr.pyx +80 -0
- sage/matrix/operation_table.py +1182 -0
- sage/matrix/special.py +3666 -0
- sage/matrix/strassen.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matrix/strassen.pyx +851 -0
- sage/matrix/symplectic_basis.py +541 -0
- sage/matrix/template.pxd +6 -0
- sage/matrix/tests.py +71 -0
- sage/matroids/advanced.py +77 -0
- sage/matroids/all.py +13 -0
- sage/matroids/basis_exchange_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/basis_exchange_matroid.pxd +96 -0
- sage/matroids/basis_exchange_matroid.pyx +2344 -0
- sage/matroids/basis_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/basis_matroid.pxd +45 -0
- sage/matroids/basis_matroid.pyx +1217 -0
- sage/matroids/catalog.py +44 -0
- sage/matroids/chow_ring.py +473 -0
- sage/matroids/chow_ring_ideal.py +849 -0
- sage/matroids/circuit_closures_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/circuit_closures_matroid.pxd +16 -0
- sage/matroids/circuit_closures_matroid.pyx +559 -0
- sage/matroids/circuits_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/circuits_matroid.pxd +38 -0
- sage/matroids/circuits_matroid.pyx +947 -0
- sage/matroids/constructor.py +1086 -0
- sage/matroids/database_collections.py +365 -0
- sage/matroids/database_matroids.py +5338 -0
- sage/matroids/dual_matroid.py +583 -0
- sage/matroids/extension.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/extension.pxd +34 -0
- sage/matroids/extension.pyx +519 -0
- sage/matroids/flats_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/flats_matroid.pxd +28 -0
- sage/matroids/flats_matroid.pyx +715 -0
- sage/matroids/gammoid.py +600 -0
- sage/matroids/graphic_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/graphic_matroid.pxd +39 -0
- sage/matroids/graphic_matroid.pyx +2024 -0
- sage/matroids/lean_matrix.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/lean_matrix.pxd +126 -0
- sage/matroids/lean_matrix.pyx +3667 -0
- sage/matroids/linear_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/linear_matroid.pxd +180 -0
- sage/matroids/linear_matroid.pyx +6649 -0
- sage/matroids/matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/matroid.pxd +243 -0
- sage/matroids/matroid.pyx +8759 -0
- sage/matroids/matroids_catalog.py +190 -0
- sage/matroids/matroids_plot_helpers.py +890 -0
- sage/matroids/minor_matroid.py +480 -0
- sage/matroids/minorfix.h +9 -0
- sage/matroids/named_matroids.py +5 -0
- sage/matroids/rank_matroid.py +268 -0
- sage/matroids/set_system.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/set_system.pxd +38 -0
- sage/matroids/set_system.pyx +800 -0
- sage/matroids/transversal_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/transversal_matroid.pxd +14 -0
- sage/matroids/transversal_matroid.pyx +893 -0
- sage/matroids/union_matroid.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/union_matroid.pxd +20 -0
- sage/matroids/union_matroid.pyx +331 -0
- sage/matroids/unpickling.cpython-314-aarch64-linux-musl.so +0 -0
- sage/matroids/unpickling.pyx +843 -0
- sage/matroids/utilities.py +809 -0
- sage/misc/all__sagemath_modules.py +20 -0
- sage/misc/c3.cpython-314-aarch64-linux-musl.so +0 -0
- sage/misc/c3.pyx +238 -0
- sage/misc/compat.py +87 -0
- sage/misc/element_with_label.py +173 -0
- sage/misc/func_persist.py +79 -0
- sage/misc/pickle_old.cpython-314-aarch64-linux-musl.so +0 -0
- sage/misc/pickle_old.pyx +19 -0
- sage/misc/proof.py +7 -0
- sage/misc/replace_dot_all.py +472 -0
- sage/misc/sagedoc_conf.py +168 -0
- sage/misc/sphinxify.py +167 -0
- sage/misc/test_class_pickling.py +85 -0
- sage/modules/all.py +42 -0
- sage/modules/complex_double_vector.py +25 -0
- sage/modules/diamond_cutting.py +380 -0
- sage/modules/fg_pid/all.py +1 -0
- sage/modules/fg_pid/fgp_element.py +456 -0
- sage/modules/fg_pid/fgp_module.py +2091 -0
- sage/modules/fg_pid/fgp_morphism.py +550 -0
- sage/modules/filtered_vector_space.py +1271 -0
- sage/modules/finite_submodule_iter.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/finite_submodule_iter.pxd +27 -0
- sage/modules/finite_submodule_iter.pyx +452 -0
- sage/modules/fp_graded/all.py +1 -0
- sage/modules/fp_graded/element.py +346 -0
- sage/modules/fp_graded/free_element.py +298 -0
- sage/modules/fp_graded/free_homspace.py +53 -0
- sage/modules/fp_graded/free_module.py +1060 -0
- sage/modules/fp_graded/free_morphism.py +217 -0
- sage/modules/fp_graded/homspace.py +563 -0
- sage/modules/fp_graded/module.py +1340 -0
- sage/modules/fp_graded/morphism.py +1990 -0
- sage/modules/fp_graded/steenrod/all.py +1 -0
- sage/modules/fp_graded/steenrod/homspace.py +65 -0
- sage/modules/fp_graded/steenrod/module.py +477 -0
- sage/modules/fp_graded/steenrod/morphism.py +404 -0
- sage/modules/fp_graded/steenrod/profile.py +241 -0
- sage/modules/free_module.py +8447 -0
- sage/modules/free_module_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/free_module_element.pxd +22 -0
- sage/modules/free_module_element.pyx +5445 -0
- sage/modules/free_module_homspace.py +369 -0
- sage/modules/free_module_integer.py +896 -0
- sage/modules/free_module_morphism.py +823 -0
- sage/modules/free_module_pseudohomspace.py +352 -0
- sage/modules/free_module_pseudomorphism.py +578 -0
- sage/modules/free_quadratic_module.py +1706 -0
- sage/modules/free_quadratic_module_integer_symmetric.py +1790 -0
- sage/modules/matrix_morphism.py +1745 -0
- sage/modules/misc.py +103 -0
- sage/modules/module_functors.py +192 -0
- sage/modules/multi_filtered_vector_space.py +719 -0
- sage/modules/ore_module.py +2208 -0
- sage/modules/ore_module_element.py +178 -0
- sage/modules/ore_module_homspace.py +147 -0
- sage/modules/ore_module_morphism.py +968 -0
- sage/modules/quotient_module.py +699 -0
- sage/modules/real_double_vector.py +22 -0
- sage/modules/submodule.py +255 -0
- sage/modules/tensor_operations.py +567 -0
- sage/modules/torsion_quadratic_module.py +1352 -0
- sage/modules/tutorial_free_modules.py +248 -0
- sage/modules/vector_complex_double_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_complex_double_dense.pxd +6 -0
- sage/modules/vector_complex_double_dense.pyx +117 -0
- sage/modules/vector_double_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_double_dense.pxd +6 -0
- sage/modules/vector_double_dense.pyx +604 -0
- sage/modules/vector_integer_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_integer_dense.pxd +15 -0
- sage/modules/vector_integer_dense.pyx +361 -0
- sage/modules/vector_integer_sparse.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_integer_sparse.pxd +29 -0
- sage/modules/vector_integer_sparse.pyx +406 -0
- sage/modules/vector_modn_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_modn_dense.pxd +12 -0
- sage/modules/vector_modn_dense.pyx +394 -0
- sage/modules/vector_modn_sparse.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_modn_sparse.pxd +21 -0
- sage/modules/vector_modn_sparse.pyx +298 -0
- sage/modules/vector_numpy_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_numpy_dense.pxd +15 -0
- sage/modules/vector_numpy_dense.pyx +304 -0
- sage/modules/vector_numpy_integer_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_numpy_integer_dense.pxd +7 -0
- sage/modules/vector_numpy_integer_dense.pyx +54 -0
- sage/modules/vector_rational_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_rational_dense.pxd +15 -0
- sage/modules/vector_rational_dense.pyx +387 -0
- sage/modules/vector_rational_sparse.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_rational_sparse.pxd +30 -0
- sage/modules/vector_rational_sparse.pyx +413 -0
- sage/modules/vector_real_double_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/vector_real_double_dense.pxd +6 -0
- sage/modules/vector_real_double_dense.pyx +126 -0
- sage/modules/vector_space_homspace.py +430 -0
- sage/modules/vector_space_morphism.py +989 -0
- sage/modules/with_basis/all.py +15 -0
- sage/modules/with_basis/cell_module.py +494 -0
- sage/modules/with_basis/indexed_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/modules/with_basis/indexed_element.pxd +13 -0
- sage/modules/with_basis/indexed_element.pyx +1058 -0
- sage/modules/with_basis/invariant.py +1075 -0
- sage/modules/with_basis/morphism.py +1636 -0
- sage/modules/with_basis/representation.py +2939 -0
- sage/modules/with_basis/subquotient.py +685 -0
- sage/numerical/all__sagemath_modules.py +6 -0
- sage/numerical/gauss_legendre.cpython-314-aarch64-linux-musl.so +0 -0
- sage/numerical/gauss_legendre.pyx +381 -0
- sage/numerical/optimize.py +910 -0
- sage/probability/all.py +10 -0
- sage/probability/probability_distribution.cpython-314-aarch64-linux-musl.so +0 -0
- sage/probability/probability_distribution.pyx +1242 -0
- sage/probability/random_variable.py +411 -0
- sage/quadratic_forms/all.py +4 -0
- sage/quadratic_forms/all__sagemath_modules.py +15 -0
- sage/quadratic_forms/binary_qf.py +2042 -0
- sage/quadratic_forms/bqf_class_group.py +748 -0
- sage/quadratic_forms/constructions.py +93 -0
- sage/quadratic_forms/count_local_2.cpython-314-aarch64-linux-musl.so +0 -0
- sage/quadratic_forms/count_local_2.pyx +365 -0
- sage/quadratic_forms/extras.py +195 -0
- sage/quadratic_forms/quadratic_form.py +1753 -0
- sage/quadratic_forms/quadratic_form__count_local_2.py +221 -0
- sage/quadratic_forms/quadratic_form__equivalence_testing.py +708 -0
- sage/quadratic_forms/quadratic_form__evaluate.cpython-314-aarch64-linux-musl.so +0 -0
- sage/quadratic_forms/quadratic_form__evaluate.pyx +139 -0
- sage/quadratic_forms/quadratic_form__local_density_congruence.py +977 -0
- sage/quadratic_forms/quadratic_form__local_field_invariants.py +1072 -0
- sage/quadratic_forms/quadratic_form__neighbors.py +424 -0
- sage/quadratic_forms/quadratic_form__reduction_theory.py +488 -0
- sage/quadratic_forms/quadratic_form__split_local_covering.py +416 -0
- sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +657 -0
- sage/quadratic_forms/quadratic_form__theta.py +352 -0
- sage/quadratic_forms/quadratic_form__variable_substitutions.py +370 -0
- sage/quadratic_forms/random_quadraticform.py +209 -0
- sage/quadratic_forms/ternary.cpython-314-aarch64-linux-musl.so +0 -0
- sage/quadratic_forms/ternary.pyx +1154 -0
- sage/quadratic_forms/ternary_qf.py +2027 -0
- sage/rings/all__sagemath_modules.py +28 -0
- sage/rings/asymptotic/all__sagemath_modules.py +1 -0
- sage/rings/asymptotic/misc.py +1252 -0
- sage/rings/cc.py +4 -0
- sage/rings/cfinite_sequence.py +1306 -0
- sage/rings/complex_conversion.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/complex_conversion.pxd +8 -0
- sage/rings/complex_conversion.pyx +23 -0
- sage/rings/complex_double.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/complex_double.pxd +21 -0
- sage/rings/complex_double.pyx +2654 -0
- sage/rings/complex_mpc.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/complex_mpc.pxd +21 -0
- sage/rings/complex_mpc.pyx +2576 -0
- sage/rings/complex_mpfr.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/complex_mpfr.pxd +18 -0
- sage/rings/complex_mpfr.pyx +3602 -0
- sage/rings/derivation.py +2334 -0
- sage/rings/finite_rings/all__sagemath_modules.py +1 -0
- sage/rings/finite_rings/maps_finite_field.py +191 -0
- sage/rings/function_field/all__sagemath_modules.py +8 -0
- sage/rings/function_field/derivations.py +102 -0
- sage/rings/function_field/derivations_rational.py +132 -0
- sage/rings/function_field/differential.py +853 -0
- sage/rings/function_field/divisor.py +1107 -0
- sage/rings/function_field/drinfeld_modules/action.py +199 -0
- sage/rings/function_field/drinfeld_modules/all.py +1 -0
- sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py +673 -0
- sage/rings/function_field/drinfeld_modules/drinfeld_module.py +2087 -0
- sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py +1131 -0
- sage/rings/function_field/drinfeld_modules/homset.py +420 -0
- sage/rings/function_field/drinfeld_modules/morphism.py +820 -0
- sage/rings/function_field/hermite_form_polynomial.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/hermite_form_polynomial.pyx +188 -0
- sage/rings/function_field/khuri_makdisi.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/khuri_makdisi.pyx +935 -0
- sage/rings/invariants/all.py +4 -0
- sage/rings/invariants/invariant_theory.py +4597 -0
- sage/rings/invariants/reconstruction.py +395 -0
- sage/rings/polynomial/all__sagemath_modules.py +17 -0
- sage/rings/polynomial/integer_valued_polynomials.py +1230 -0
- sage/rings/polynomial/laurent_polynomial_mpair.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/laurent_polynomial_mpair.pxd +15 -0
- sage/rings/polynomial/laurent_polynomial_mpair.pyx +2023 -0
- sage/rings/polynomial/ore_function_element.py +952 -0
- sage/rings/polynomial/ore_function_field.py +1028 -0
- sage/rings/polynomial/ore_polynomial_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/ore_polynomial_element.pxd +48 -0
- sage/rings/polynomial/ore_polynomial_element.pyx +3145 -0
- sage/rings/polynomial/ore_polynomial_ring.py +1334 -0
- sage/rings/polynomial/polynomial_real_mpfr_dense.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +788 -0
- sage/rings/polynomial/q_integer_valued_polynomials.py +1264 -0
- sage/rings/polynomial/skew_polynomial_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/skew_polynomial_element.pxd +9 -0
- sage/rings/polynomial/skew_polynomial_element.pyx +684 -0
- sage/rings/polynomial/skew_polynomial_finite_field.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/skew_polynomial_finite_field.pxd +19 -0
- sage/rings/polynomial/skew_polynomial_finite_field.pyx +1093 -0
- sage/rings/polynomial/skew_polynomial_finite_order.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/skew_polynomial_finite_order.pxd +10 -0
- sage/rings/polynomial/skew_polynomial_finite_order.pyx +567 -0
- sage/rings/polynomial/skew_polynomial_ring.py +908 -0
- sage/rings/real_double_element_gsl.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/real_double_element_gsl.pxd +8 -0
- sage/rings/real_double_element_gsl.pyx +794 -0
- sage/rings/real_field.py +58 -0
- sage/rings/real_mpfr.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/real_mpfr.pxd +29 -0
- sage/rings/real_mpfr.pyx +6122 -0
- sage/rings/ring_extension.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/ring_extension.pxd +42 -0
- sage/rings/ring_extension.pyx +2779 -0
- sage/rings/ring_extension_conversion.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/ring_extension_conversion.pxd +16 -0
- sage/rings/ring_extension_conversion.pyx +462 -0
- sage/rings/ring_extension_element.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/ring_extension_element.pxd +21 -0
- sage/rings/ring_extension_element.pyx +1635 -0
- sage/rings/ring_extension_homset.py +64 -0
- sage/rings/ring_extension_morphism.cpython-314-aarch64-linux-musl.so +0 -0
- sage/rings/ring_extension_morphism.pxd +35 -0
- sage/rings/ring_extension_morphism.pyx +920 -0
- sage/schemes/all__sagemath_modules.py +1 -0
- sage/schemes/projective/all__sagemath_modules.py +1 -0
- sage/schemes/projective/coherent_sheaf.py +300 -0
- sage/schemes/projective/cohomology.py +510 -0
- sage/stats/all.py +15 -0
- sage/stats/basic_stats.py +489 -0
- sage/stats/distributions/all.py +7 -0
- sage/stats/distributions/catalog.py +34 -0
- sage/stats/distributions/dgs.h +50 -0
- sage/stats/distributions/dgs.pxd +111 -0
- sage/stats/distributions/dgs_bern.h +400 -0
- sage/stats/distributions/dgs_gauss.h +614 -0
- sage/stats/distributions/dgs_misc.h +104 -0
- sage/stats/distributions/discrete_gaussian_integer.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/distributions/discrete_gaussian_integer.pxd +14 -0
- sage/stats/distributions/discrete_gaussian_integer.pyx +498 -0
- sage/stats/distributions/discrete_gaussian_lattice.py +908 -0
- sage/stats/distributions/discrete_gaussian_polynomial.py +141 -0
- sage/stats/hmm/all.py +15 -0
- sage/stats/hmm/chmm.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/hmm/chmm.pyx +1595 -0
- sage/stats/hmm/distributions.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/hmm/distributions.pxd +29 -0
- sage/stats/hmm/distributions.pyx +531 -0
- sage/stats/hmm/hmm.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/hmm/hmm.pxd +17 -0
- sage/stats/hmm/hmm.pyx +1388 -0
- sage/stats/hmm/util.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/hmm/util.pxd +7 -0
- sage/stats/hmm/util.pyx +165 -0
- sage/stats/intlist.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/intlist.pxd +14 -0
- sage/stats/intlist.pyx +588 -0
- sage/stats/r.py +49 -0
- sage/stats/time_series.cpython-314-aarch64-linux-musl.so +0 -0
- sage/stats/time_series.pxd +6 -0
- sage/stats/time_series.pyx +2546 -0
- sage/tensor/all.py +2 -0
- sage/tensor/modules/all.py +8 -0
- sage/tensor/modules/alternating_contr_tensor.py +761 -0
- sage/tensor/modules/comp.py +5598 -0
- sage/tensor/modules/ext_pow_free_module.py +824 -0
- sage/tensor/modules/finite_rank_free_module.py +3589 -0
- sage/tensor/modules/format_utilities.py +333 -0
- sage/tensor/modules/free_module_alt_form.py +858 -0
- sage/tensor/modules/free_module_automorphism.py +1207 -0
- sage/tensor/modules/free_module_basis.py +1074 -0
- sage/tensor/modules/free_module_element.py +284 -0
- sage/tensor/modules/free_module_homset.py +652 -0
- sage/tensor/modules/free_module_linear_group.py +564 -0
- sage/tensor/modules/free_module_morphism.py +1581 -0
- sage/tensor/modules/free_module_tensor.py +3289 -0
- sage/tensor/modules/reflexive_module.py +386 -0
- sage/tensor/modules/tensor_free_module.py +780 -0
- sage/tensor/modules/tensor_free_submodule.py +538 -0
- sage/tensor/modules/tensor_free_submodule_basis.py +140 -0
- sage/tensor/modules/tensor_with_indices.py +1043 -0
|
@@ -0,0 +1,1635 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-modules
|
|
2
|
+
r"""
|
|
3
|
+
Elements lying in extension of rings
|
|
4
|
+
|
|
5
|
+
AUTHOR:
|
|
6
|
+
|
|
7
|
+
- Xavier Caruso (2019)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# ###########################################################################
|
|
11
|
+
# Copyright (C) 2019 Xavier Caruso <xavier.caruso@normalesup.org>
|
|
12
|
+
#
|
|
13
|
+
# This program is free software: you can redistribute it and/or modify
|
|
14
|
+
# it under the terms of the GNU General Public License as published by
|
|
15
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
16
|
+
# (at your option) any later version.
|
|
17
|
+
# https://www.gnu.org/licenses/
|
|
18
|
+
# ***************************************************************************
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
cimport cython
|
|
22
|
+
from sage.ext.stdsage cimport PY_NEW
|
|
23
|
+
from sage.cpython.getattr cimport AttributeErrorMessage
|
|
24
|
+
from sage.cpython.getattr import dir_with_other_class
|
|
25
|
+
from sage.misc.latex import latex
|
|
26
|
+
|
|
27
|
+
from sage.structure.category_object import normalize_names
|
|
28
|
+
from sage.structure.element cimport CommutativeAlgebraElement
|
|
29
|
+
from sage.structure.parent cimport Parent
|
|
30
|
+
from sage.rings.integer_ring import ZZ
|
|
31
|
+
from sage.categories.fields import Fields
|
|
32
|
+
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
|
|
33
|
+
|
|
34
|
+
from sage.rings.ring_extension cimport RingExtension_generic, RingExtensionWithGen, RingExtensionFractionField
|
|
35
|
+
from sage.rings.ring_extension_morphism cimport MapRelativeRingToFreeModule, are_equal_morphisms
|
|
36
|
+
from sage.rings.ring_extension_conversion cimport backend_parent, backend_element
|
|
37
|
+
from sage.rings.ring_extension_conversion cimport to_backend, from_backend
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Classes
|
|
41
|
+
#########
|
|
42
|
+
|
|
43
|
+
cdef class RingExtensionElement(CommutativeAlgebraElement):
|
|
44
|
+
r"""
|
|
45
|
+
Generic class for elements lying in ring extensions.
|
|
46
|
+
|
|
47
|
+
TESTS::
|
|
48
|
+
|
|
49
|
+
sage: K = GF(5^4).over() # needs sage.rings.finite_rings
|
|
50
|
+
sage: x = K.random_element() # needs sage.rings.finite_rings
|
|
51
|
+
sage: TestSuite(x).run() # needs sage.rings.finite_rings
|
|
52
|
+
"""
|
|
53
|
+
def __init__(self, RingExtension_generic parent, x, *args, **kwds):
|
|
54
|
+
r"""
|
|
55
|
+
Initialize this element.
|
|
56
|
+
|
|
57
|
+
INPUT:
|
|
58
|
+
|
|
59
|
+
- ``parent`` -- the parent of this element
|
|
60
|
+
|
|
61
|
+
- ``x`` -- some data to construct this element
|
|
62
|
+
|
|
63
|
+
TESTS::
|
|
64
|
+
|
|
65
|
+
sage: Q = QQ.over(ZZ)
|
|
66
|
+
sage: x = Q(1/2)
|
|
67
|
+
sage: x
|
|
68
|
+
1/2
|
|
69
|
+
"""
|
|
70
|
+
if not isinstance(parent, RingExtension_generic):
|
|
71
|
+
raise TypeError("%s is not a ring extension" % parent)
|
|
72
|
+
x = backend_element(x)
|
|
73
|
+
try:
|
|
74
|
+
parentx = x.parent()
|
|
75
|
+
if parent._base.has_coerce_map_from(parentx):
|
|
76
|
+
x = parent._base.coerce_map_from(parentx)(x)
|
|
77
|
+
x = parent._backend_defining_morphism(x)
|
|
78
|
+
except AttributeError:
|
|
79
|
+
pass
|
|
80
|
+
CommutativeAlgebraElement.__init__(self, parent)
|
|
81
|
+
ring = parent._backend
|
|
82
|
+
self._backend = ring(x, *args, **kwds)
|
|
83
|
+
|
|
84
|
+
def __reduce__(self):
|
|
85
|
+
"""
|
|
86
|
+
Return a tuple of a function and data that can be used to unpickle this
|
|
87
|
+
element.
|
|
88
|
+
|
|
89
|
+
TESTS::
|
|
90
|
+
|
|
91
|
+
sage: # needs sage.rings.finite_rings
|
|
92
|
+
sage: K = GF(5^3).over()
|
|
93
|
+
sage: x = K.random_element()
|
|
94
|
+
sage: type(x)
|
|
95
|
+
<class 'sage.rings.ring_extension_element.RingExtensionWithBasisElement'>
|
|
96
|
+
sage: loads(dumps(x)) == x
|
|
97
|
+
True
|
|
98
|
+
"""
|
|
99
|
+
return self._parent, (self._backend,)
|
|
100
|
+
|
|
101
|
+
@cython.binding(True)
|
|
102
|
+
def __getattr__(self, name):
|
|
103
|
+
"""
|
|
104
|
+
If the parent of this element was created with ``import_methods = True``,
|
|
105
|
+
return a wrapper to the corresponding method of the backend element
|
|
106
|
+
(if it exists).
|
|
107
|
+
|
|
108
|
+
EXAMPLES::
|
|
109
|
+
|
|
110
|
+
sage: # needs sage.rings.number_field
|
|
111
|
+
sage: x = polygen(ZZ, 'x')
|
|
112
|
+
sage: A.<a> = QQ.extension(x^2 - 2)
|
|
113
|
+
sage: K.<a> = A.over() # over QQ
|
|
114
|
+
sage: hasattr(a, 'continued_fraction')
|
|
115
|
+
True
|
|
116
|
+
sage: a.continued_fraction()
|
|
117
|
+
[1; (2)*]
|
|
118
|
+
"""
|
|
119
|
+
try:
|
|
120
|
+
return self.getattr_from_category(name)
|
|
121
|
+
except AttributeError:
|
|
122
|
+
pass
|
|
123
|
+
method = None
|
|
124
|
+
if (<RingExtension_generic>self._parent)._import_methods and hasattr(self._backend, name):
|
|
125
|
+
method = getattr(self._backend, name)
|
|
126
|
+
if not callable(method):
|
|
127
|
+
raise AttributeError(AttributeErrorMessage(self, name))
|
|
128
|
+
|
|
129
|
+
def wrapper(*args, **kwargs):
|
|
130
|
+
output = method(*to_backend(args), **to_backend(kwargs))
|
|
131
|
+
return from_backend(output, self._parent)
|
|
132
|
+
wrapper.__doc__ = method.__doc__
|
|
133
|
+
return wrapper
|
|
134
|
+
|
|
135
|
+
def __getitem__(self, i):
|
|
136
|
+
r"""
|
|
137
|
+
Return the `i`-th item of this element.
|
|
138
|
+
|
|
139
|
+
This methods calls the appropriate method of the backend if
|
|
140
|
+
``import_methods`` is set to ``True``
|
|
141
|
+
|
|
142
|
+
EXAMPLES::
|
|
143
|
+
|
|
144
|
+
sage: R.<x> = QQ[]
|
|
145
|
+
sage: E = R.over()
|
|
146
|
+
sage: P = E(x^2 + 2*x + 3)
|
|
147
|
+
sage: P[0]
|
|
148
|
+
3
|
|
149
|
+
"""
|
|
150
|
+
if (<RingExtension_generic>self._parent)._import_methods:
|
|
151
|
+
output = self._backend[to_backend(i)]
|
|
152
|
+
return from_backend(output, self._parent)
|
|
153
|
+
return TypeError("this element is not subscriptable")
|
|
154
|
+
|
|
155
|
+
def __call__(self, *args, **kwargs):
|
|
156
|
+
r"""
|
|
157
|
+
Call this element.
|
|
158
|
+
|
|
159
|
+
This methods calls the appropriate method of the backend if
|
|
160
|
+
``import_methods`` is set to ``True``
|
|
161
|
+
|
|
162
|
+
EXAMPLES::
|
|
163
|
+
|
|
164
|
+
sage: R.<x> = QQ[]
|
|
165
|
+
sage: E = R.over()
|
|
166
|
+
sage: P = E(x^2 + 2*x + 3)
|
|
167
|
+
sage: P(1)
|
|
168
|
+
6
|
|
169
|
+
"""
|
|
170
|
+
if (<RingExtension_generic>self._parent)._import_methods:
|
|
171
|
+
output = self._backend(*to_backend(args), **to_backend(kwargs))
|
|
172
|
+
return from_backend(output, self._parent)
|
|
173
|
+
return TypeError("this element is not callable")
|
|
174
|
+
|
|
175
|
+
def __dir__(self):
|
|
176
|
+
"""
|
|
177
|
+
Return the list of all the attributes of this element;
|
|
178
|
+
if the parent of this element was created with ``import_methods = True``,
|
|
179
|
+
concatenate this list with the list of all the methods of the backend
|
|
180
|
+
element.
|
|
181
|
+
|
|
182
|
+
EXAMPLES::
|
|
183
|
+
|
|
184
|
+
sage: # needs sage.rings.number_field
|
|
185
|
+
sage: x = polygen(ZZ, 'x')
|
|
186
|
+
sage: A.<a> = QQ.extension(x^2 - 2)
|
|
187
|
+
sage: K.<a> = A.over()
|
|
188
|
+
sage: dir(a)
|
|
189
|
+
['__abs__',
|
|
190
|
+
'__add__',
|
|
191
|
+
...
|
|
192
|
+
'complex_embeddings',
|
|
193
|
+
'conjugate',
|
|
194
|
+
'continued_fraction',
|
|
195
|
+
'continued_fraction_list',
|
|
196
|
+
...
|
|
197
|
+
'trace',
|
|
198
|
+
'valuation',
|
|
199
|
+
'vector',
|
|
200
|
+
'xgcd']
|
|
201
|
+
"""
|
|
202
|
+
d = dir_with_other_class(self, self._parent.category().element_class)
|
|
203
|
+
if not (<RingExtension_generic>self._parent)._import_methods:
|
|
204
|
+
return d
|
|
205
|
+
for name in dir(self._backend):
|
|
206
|
+
try:
|
|
207
|
+
attribute = getattr(self._backend, name)
|
|
208
|
+
if callable(attribute):
|
|
209
|
+
d.append(name)
|
|
210
|
+
except AttributeError:
|
|
211
|
+
pass
|
|
212
|
+
return sorted(set(d))
|
|
213
|
+
|
|
214
|
+
def __hash__(self):
|
|
215
|
+
"""
|
|
216
|
+
Return a hash of this element.
|
|
217
|
+
|
|
218
|
+
EXAMPLES:
|
|
219
|
+
|
|
220
|
+
sage: E.<a> = GF(5^3).over() # needs sage.rings.finite_rings
|
|
221
|
+
sage: hash(a) # needs sage.rings.finite_rings
|
|
222
|
+
5
|
|
223
|
+
"""
|
|
224
|
+
return hash(self._backend)
|
|
225
|
+
|
|
226
|
+
def _repr_(self, **options):
|
|
227
|
+
r"""
|
|
228
|
+
Return a string representation of this element.
|
|
229
|
+
|
|
230
|
+
Do not override this method in subclasses;
|
|
231
|
+
instead override the method :meth:`_repr_extension`.
|
|
232
|
+
|
|
233
|
+
TESTS::
|
|
234
|
+
|
|
235
|
+
sage: K.<a> = GF(5^2).over() # needs sage.rings.finite_rings
|
|
236
|
+
sage: L.<b> = GF(5^4).over(K) # needs sage.rings.finite_rings
|
|
237
|
+
sage: b._repr_() # needs sage.rings.finite_rings
|
|
238
|
+
'b'
|
|
239
|
+
"""
|
|
240
|
+
cdef RingExtension_generic parent = self._parent
|
|
241
|
+
if 'print_elements_as' in options:
|
|
242
|
+
print_as = options.pop('print_elements_as')
|
|
243
|
+
else:
|
|
244
|
+
print_as = parent._print_options.get('print_elements_as')
|
|
245
|
+
if print_as is not None:
|
|
246
|
+
return print_as(self._backend)._repr_(**options)
|
|
247
|
+
print_options = parent._print_options.copy()
|
|
248
|
+
for (name, value) in options.items():
|
|
249
|
+
method = None
|
|
250
|
+
if hasattr(parent, '_print_option_' + name):
|
|
251
|
+
method = getattr(parent, '_print_option_' + name)
|
|
252
|
+
if not callable(method):
|
|
253
|
+
raise ValueError("option '%s' does not exist" % name)
|
|
254
|
+
print_options[name] = method(value)
|
|
255
|
+
return self._repr_extension(**print_options)
|
|
256
|
+
|
|
257
|
+
def _repr_extension(self, **options):
|
|
258
|
+
r"""
|
|
259
|
+
Return a string representation of this element.
|
|
260
|
+
|
|
261
|
+
TESTS::
|
|
262
|
+
|
|
263
|
+
sage: K = QQ.over(ZZ)
|
|
264
|
+
sage: x = K(1/2)
|
|
265
|
+
sage: x._repr_extension()
|
|
266
|
+
'1/2'
|
|
267
|
+
"""
|
|
268
|
+
return str(self._backend)
|
|
269
|
+
|
|
270
|
+
def _latex_(self, **options):
|
|
271
|
+
r"""
|
|
272
|
+
Return a LaTeX representation of this element.
|
|
273
|
+
|
|
274
|
+
Do not override this method in subclasses;
|
|
275
|
+
instead override the method :meth:`_latex_extension`.
|
|
276
|
+
|
|
277
|
+
TESTS::
|
|
278
|
+
|
|
279
|
+
sage: K.<a> = GF(5^2).over() # needs sage.rings.finite_rings
|
|
280
|
+
sage: L.<b> = GF(5^4).over(K) # needs sage.rings.finite_rings
|
|
281
|
+
sage: b._latex_() # needs sage.rings.finite_rings
|
|
282
|
+
'b'
|
|
283
|
+
"""
|
|
284
|
+
cdef RingExtension_generic parent = self._parent
|
|
285
|
+
if 'print_elements_as' in options:
|
|
286
|
+
print_as = options.pop('print_elements_as')
|
|
287
|
+
else:
|
|
288
|
+
print_as = parent._print_options.get('print_elements_as')
|
|
289
|
+
if print_as is not None:
|
|
290
|
+
return print_as(self._backend)._latex_(**options)
|
|
291
|
+
print_options = parent._print_options.copy()
|
|
292
|
+
for (name, value) in options.items():
|
|
293
|
+
method = None
|
|
294
|
+
if hasattr(parent, '_print_option_' + name):
|
|
295
|
+
method = getattr(parent, '_print_option_' + name)
|
|
296
|
+
if not callable(method):
|
|
297
|
+
raise ValueError("option '%s' does not exist" % name)
|
|
298
|
+
print_options[name] = method(value)
|
|
299
|
+
return self._latex_extension(**print_options)
|
|
300
|
+
|
|
301
|
+
def _latex_extension(self, **options):
|
|
302
|
+
r"""
|
|
303
|
+
Return a LaTeX representation of this element.
|
|
304
|
+
|
|
305
|
+
TESTS::
|
|
306
|
+
|
|
307
|
+
sage: K = QQ.over(ZZ)
|
|
308
|
+
sage: x = K(1/2)
|
|
309
|
+
sage: x._latex_extension()
|
|
310
|
+
\frac{1}{2}
|
|
311
|
+
"""
|
|
312
|
+
return latex(self._backend)
|
|
313
|
+
|
|
314
|
+
def backend(self, force=False):
|
|
315
|
+
"""
|
|
316
|
+
Return the backend of this element.
|
|
317
|
+
|
|
318
|
+
INPUT:
|
|
319
|
+
|
|
320
|
+
- ``force`` -- boolean (default: ``False``); if ``False``,
|
|
321
|
+
raise an error if the backend is not exposed
|
|
322
|
+
|
|
323
|
+
EXAMPLES::
|
|
324
|
+
|
|
325
|
+
sage: # needs sage.rings.finite_rings
|
|
326
|
+
sage: F = GF(5^2)
|
|
327
|
+
sage: K.<z> = GF(5^4).over(F)
|
|
328
|
+
sage: x = z^10
|
|
329
|
+
sage: x
|
|
330
|
+
(z2 + 2) + (3*z2 + 1)*z
|
|
331
|
+
sage: y = x.backend()
|
|
332
|
+
sage: y
|
|
333
|
+
4*z4^3 + 2*z4^2 + 4*z4 + 4
|
|
334
|
+
sage: y.parent()
|
|
335
|
+
Finite Field in z4 of size 5^4
|
|
336
|
+
"""
|
|
337
|
+
if force or (<RingExtension_generic>(self._parent))._is_backend_exposed:
|
|
338
|
+
return self._backend
|
|
339
|
+
raise ValueError("backend is not exposed; try force=True")
|
|
340
|
+
|
|
341
|
+
def in_base(self):
|
|
342
|
+
r"""
|
|
343
|
+
Return this element as an element of the base.
|
|
344
|
+
|
|
345
|
+
EXAMPLES::
|
|
346
|
+
|
|
347
|
+
sage: # needs sage.rings.finite_rings
|
|
348
|
+
sage: F = GF(5^2)
|
|
349
|
+
sage: K.<z> = GF(5^4).over(F)
|
|
350
|
+
sage: x = z^3 + z^2 + z + 4
|
|
351
|
+
sage: y = x.in_base()
|
|
352
|
+
sage: y
|
|
353
|
+
z2 + 1
|
|
354
|
+
sage: y.parent()
|
|
355
|
+
Finite Field in z2 of size 5^2
|
|
356
|
+
|
|
357
|
+
When the element is not in the base, an error is raised::
|
|
358
|
+
|
|
359
|
+
sage: z.in_base() # needs sage.rings.finite_rings
|
|
360
|
+
Traceback (most recent call last):
|
|
361
|
+
...
|
|
362
|
+
ValueError: z is not in the base
|
|
363
|
+
|
|
364
|
+
::
|
|
365
|
+
|
|
366
|
+
sage: # needs sage.rings.finite_rings
|
|
367
|
+
sage: S.<X> = F[]
|
|
368
|
+
sage: E = S.over(F)
|
|
369
|
+
sage: f = E(1)
|
|
370
|
+
sage: g = f.in_base(); g
|
|
371
|
+
1
|
|
372
|
+
sage: g.parent()
|
|
373
|
+
Finite Field in z2 of size 5^2
|
|
374
|
+
|
|
375
|
+
TESTS:
|
|
376
|
+
|
|
377
|
+
We check the case of a tower of extensions::
|
|
378
|
+
|
|
379
|
+
sage: # needs sage.rings.finite_rings
|
|
380
|
+
sage: F = GF(5^2)
|
|
381
|
+
sage: K.<u> = GF(5^4).over(F)
|
|
382
|
+
sage: L.<v> = GF(5^8).over(K)
|
|
383
|
+
sage: x = 4*v^7 + v^6 + 3*v^4 + v^3 + v^2 + 4
|
|
384
|
+
sage: x.in_base()
|
|
385
|
+
u
|
|
386
|
+
"""
|
|
387
|
+
cdef RingExtension_generic parent = <RingExtension_generic>self._parent
|
|
388
|
+
if isinstance(parent, RingExtensionWithGen):
|
|
389
|
+
v = self.vector()
|
|
390
|
+
for i in range(1, len(v)):
|
|
391
|
+
if v[i]:
|
|
392
|
+
raise ValueError("%s is not in the base" % self)
|
|
393
|
+
return v[0]
|
|
394
|
+
else:
|
|
395
|
+
f = parent._backend_defining_morphism
|
|
396
|
+
base = f.domain()
|
|
397
|
+
ring = f.codomain()
|
|
398
|
+
if ring.has_coerce_map_from(base) and are_equal_morphisms(f, None):
|
|
399
|
+
return parent.base()(base(self._backend))
|
|
400
|
+
raise NotImplementedError("cannot cast %s to the base" % self)
|
|
401
|
+
|
|
402
|
+
cpdef _richcmp_(left, right, int op):
|
|
403
|
+
r"""
|
|
404
|
+
Compare this element with ``right`` according to
|
|
405
|
+
the rich comparison operator ``op``.
|
|
406
|
+
|
|
407
|
+
The comparison is performed by comparing the backend
|
|
408
|
+
elements.
|
|
409
|
+
|
|
410
|
+
INPUT:
|
|
411
|
+
|
|
412
|
+
- ``right`` -- an element in the same parent
|
|
413
|
+
|
|
414
|
+
- ``op`` -- the comparison operator
|
|
415
|
+
|
|
416
|
+
EXAMPLES::
|
|
417
|
+
|
|
418
|
+
sage: # needs sage.rings.finite_rings
|
|
419
|
+
sage: K.<a> = GF(5^2).over()
|
|
420
|
+
sage: x = K.random_element()
|
|
421
|
+
sage: x == x
|
|
422
|
+
True
|
|
423
|
+
sage: x == x + 1
|
|
424
|
+
False
|
|
425
|
+
sage: x == x^25
|
|
426
|
+
True
|
|
427
|
+
"""
|
|
428
|
+
return left._backend._richcmp_(backend_element(right), op)
|
|
429
|
+
|
|
430
|
+
cpdef _add_(self, other):
|
|
431
|
+
r"""
|
|
432
|
+
Return the sum of this element and ``other``.
|
|
433
|
+
|
|
434
|
+
TESTS::
|
|
435
|
+
|
|
436
|
+
sage: # needs sage.rings.finite_rings
|
|
437
|
+
sage: K = GF(5^4).over(GF(5^2))
|
|
438
|
+
sage: x = K.random_element()
|
|
439
|
+
sage: y = K.random_element()
|
|
440
|
+
sage: (x+y).parent() is K
|
|
441
|
+
True
|
|
442
|
+
sage: x + y == y + x
|
|
443
|
+
True
|
|
444
|
+
"""
|
|
445
|
+
cdef RingExtensionElement ans = PY_NEW(type(self))
|
|
446
|
+
ans._parent = self._parent
|
|
447
|
+
ans._backend = self._backend + (<RingExtensionElement>other)._backend
|
|
448
|
+
return ans
|
|
449
|
+
|
|
450
|
+
cpdef _neg_(self):
|
|
451
|
+
r"""
|
|
452
|
+
Return the opposite of this element.
|
|
453
|
+
|
|
454
|
+
TESTS::
|
|
455
|
+
|
|
456
|
+
sage: # needs sage.rings.finite_rings
|
|
457
|
+
sage: K = GF(5^4).over(GF(5^2))
|
|
458
|
+
sage: x = K.random_element()
|
|
459
|
+
sage: y = -x
|
|
460
|
+
sage: y.parent() is K
|
|
461
|
+
True
|
|
462
|
+
sage: x + y == 0
|
|
463
|
+
True
|
|
464
|
+
"""
|
|
465
|
+
cdef RingExtensionElement ans = PY_NEW(type(self))
|
|
466
|
+
ans._parent = self._parent
|
|
467
|
+
ans._backend = -self._backend
|
|
468
|
+
return ans
|
|
469
|
+
|
|
470
|
+
cpdef _sub_(self, other):
|
|
471
|
+
r"""
|
|
472
|
+
Return the difference of this element and ``other``.
|
|
473
|
+
|
|
474
|
+
TESTS::
|
|
475
|
+
|
|
476
|
+
sage: # needs sage.rings.finite_rings
|
|
477
|
+
sage: K = GF(5^4).over(GF(5^2))
|
|
478
|
+
sage: x = K.random_element()
|
|
479
|
+
sage: y = K.random_element()
|
|
480
|
+
sage: (x - y).parent() is K
|
|
481
|
+
True
|
|
482
|
+
sage: x - y == x + (-y)
|
|
483
|
+
True
|
|
484
|
+
"""
|
|
485
|
+
cdef RingExtensionElement ans = PY_NEW(type(self))
|
|
486
|
+
ans._parent = self._parent
|
|
487
|
+
ans._backend = self._backend - (<RingExtensionElement>other)._backend
|
|
488
|
+
return ans
|
|
489
|
+
|
|
490
|
+
cpdef _mul_(self, other):
|
|
491
|
+
r"""
|
|
492
|
+
Return the product of this element and ``other``.
|
|
493
|
+
|
|
494
|
+
TESTS::
|
|
495
|
+
|
|
496
|
+
sage: # needs sage.rings.finite_rings
|
|
497
|
+
sage: K = GF(5^4).over(GF(5^2))
|
|
498
|
+
sage: x = K.random_element()
|
|
499
|
+
sage: y = K.random_element()
|
|
500
|
+
sage: (x*y).parent() is K
|
|
501
|
+
True
|
|
502
|
+
sage: x * y == y * x
|
|
503
|
+
True
|
|
504
|
+
"""
|
|
505
|
+
cdef RingExtensionElement ans = PY_NEW(type(self))
|
|
506
|
+
ans._parent = self._parent
|
|
507
|
+
ans._backend = self._backend * (<RingExtensionElement>other)._backend
|
|
508
|
+
return ans
|
|
509
|
+
|
|
510
|
+
cpdef _div_(self, other):
|
|
511
|
+
r"""
|
|
512
|
+
Return the quotient of this element by ``other``,
|
|
513
|
+
considered as an element of the fraction field.
|
|
514
|
+
|
|
515
|
+
TESTS::
|
|
516
|
+
|
|
517
|
+
sage: # needs sage.rings.number_field
|
|
518
|
+
sage: x = polygen(ZZ, 'x')
|
|
519
|
+
sage: A.<a> = ZZ.extension(x^2 - 2)
|
|
520
|
+
sage: OK = A.over()
|
|
521
|
+
sage: a = OK(a)
|
|
522
|
+
sage: b = 1/a; b
|
|
523
|
+
a/2
|
|
524
|
+
sage: b.parent()
|
|
525
|
+
Fraction Field of
|
|
526
|
+
Maximal Order generated by a in Number Field in a
|
|
527
|
+
with defining polynomial x^2 - 2 over its base
|
|
528
|
+
sage: a*b
|
|
529
|
+
1
|
|
530
|
+
"""
|
|
531
|
+
cdef RingExtensionElement ans
|
|
532
|
+
cdef RingExtension_generic parent = self._parent
|
|
533
|
+
if parent._fraction_field is None:
|
|
534
|
+
parent._fraction_field = parent.fraction_field()
|
|
535
|
+
parent._fraction_field_type = <type>parent._fraction_field.element_class
|
|
536
|
+
ans = PY_NEW(parent._fraction_field_type)
|
|
537
|
+
ans._parent = parent._fraction_field
|
|
538
|
+
ans._backend = self._backend / (<RingExtensionElement>other)._backend
|
|
539
|
+
return ans
|
|
540
|
+
|
|
541
|
+
def additive_order(self):
|
|
542
|
+
r"""
|
|
543
|
+
Return the additive order of this element.
|
|
544
|
+
|
|
545
|
+
EXAMPLES::
|
|
546
|
+
|
|
547
|
+
sage: K.<a> = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings
|
|
548
|
+
sage: a.additive_order() # needs sage.rings.finite_rings
|
|
549
|
+
5
|
|
550
|
+
"""
|
|
551
|
+
return self._backend.additive_order()
|
|
552
|
+
|
|
553
|
+
def multiplicative_order(self):
|
|
554
|
+
r"""
|
|
555
|
+
Return the multiplicite order of this element.
|
|
556
|
+
|
|
557
|
+
EXAMPLES::
|
|
558
|
+
|
|
559
|
+
sage: K.<a> = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings
|
|
560
|
+
sage: a.multiplicative_order() # needs sage.rings.finite_rings
|
|
561
|
+
624
|
|
562
|
+
"""
|
|
563
|
+
return self._backend.multiplicative_order()
|
|
564
|
+
|
|
565
|
+
def is_unit(self):
|
|
566
|
+
r"""
|
|
567
|
+
Return whether if this element is a unit in this ring.
|
|
568
|
+
|
|
569
|
+
EXAMPLES::
|
|
570
|
+
|
|
571
|
+
sage: A.<x> = PolynomialRing(QQ)
|
|
572
|
+
sage: E = A.over(QQ)
|
|
573
|
+
sage: E(4).is_unit()
|
|
574
|
+
True
|
|
575
|
+
sage: E(x).is_unit()
|
|
576
|
+
False
|
|
577
|
+
"""
|
|
578
|
+
return self._backend.is_unit()
|
|
579
|
+
|
|
580
|
+
def is_nilpotent(self):
|
|
581
|
+
r"""
|
|
582
|
+
Return whether if this element is nilpotent in this ring.
|
|
583
|
+
|
|
584
|
+
EXAMPLES::
|
|
585
|
+
|
|
586
|
+
sage: A.<x> = PolynomialRing(QQ)
|
|
587
|
+
sage: E = A.over(QQ)
|
|
588
|
+
sage: E(0).is_nilpotent()
|
|
589
|
+
True
|
|
590
|
+
sage: E(x).is_nilpotent()
|
|
591
|
+
False
|
|
592
|
+
"""
|
|
593
|
+
return self._backend.is_nilpotent()
|
|
594
|
+
|
|
595
|
+
def is_prime(self):
|
|
596
|
+
r"""
|
|
597
|
+
Return whether this element is a prime element in this ring.
|
|
598
|
+
|
|
599
|
+
EXAMPLES::
|
|
600
|
+
|
|
601
|
+
sage: A.<x> = PolynomialRing(QQ)
|
|
602
|
+
sage: E = A.over(QQ)
|
|
603
|
+
sage: E(x^2 + 1).is_prime() # needs sage.libs.pari
|
|
604
|
+
True
|
|
605
|
+
sage: E(x^2 - 1).is_prime() # needs sage.libs.pari
|
|
606
|
+
False
|
|
607
|
+
"""
|
|
608
|
+
return self._backend.is_prime()
|
|
609
|
+
|
|
610
|
+
def is_square(self, root=False):
|
|
611
|
+
r"""
|
|
612
|
+
Return whether this element is a square in this ring.
|
|
613
|
+
|
|
614
|
+
INPUT:
|
|
615
|
+
|
|
616
|
+
- ``root`` -- boolean (default: ``False``); if ``True``,
|
|
617
|
+
return also a square root
|
|
618
|
+
|
|
619
|
+
EXAMPLES::
|
|
620
|
+
|
|
621
|
+
sage: # needs sage.rings.finite_rings
|
|
622
|
+
sage: K.<a> = GF(5^3).over()
|
|
623
|
+
sage: a.is_square()
|
|
624
|
+
False
|
|
625
|
+
sage: a.is_square(root=True)
|
|
626
|
+
(False, None)
|
|
627
|
+
sage: b = a + 1
|
|
628
|
+
sage: b.is_square()
|
|
629
|
+
True
|
|
630
|
+
sage: b.is_square(root=True)
|
|
631
|
+
(True, 2 + 3*a + a^2)
|
|
632
|
+
"""
|
|
633
|
+
is_sq = self._backend.is_square()
|
|
634
|
+
sq = None
|
|
635
|
+
if root and is_sq:
|
|
636
|
+
sq = self.sqrt(extend=False, all=False)
|
|
637
|
+
if root:
|
|
638
|
+
return is_sq, sq
|
|
639
|
+
else:
|
|
640
|
+
return is_sq
|
|
641
|
+
|
|
642
|
+
def sqrt(self, extend=True, all=False, name=None):
|
|
643
|
+
r"""
|
|
644
|
+
Return a square root or all square roots of this element.
|
|
645
|
+
|
|
646
|
+
INPUT:
|
|
647
|
+
|
|
648
|
+
- ``extend`` -- boolean (default: ``True``); if ``True``,
|
|
649
|
+
return a square root in an extension ring, if necessary.
|
|
650
|
+
Otherwise, raise a :exc:`ValueError` if the root is not in
|
|
651
|
+
the ring.
|
|
652
|
+
|
|
653
|
+
- ``all`` -- boolean (default: ``False``); if ``True``,
|
|
654
|
+
return all square roots of this element, instead of just one
|
|
655
|
+
|
|
656
|
+
- ``name`` -- required when ``extend=True`` and ``self`` is not a
|
|
657
|
+
square; this will be the name of the generator extension
|
|
658
|
+
|
|
659
|
+
.. NOTE::
|
|
660
|
+
|
|
661
|
+
The option ``extend=True`` is often not implemented.
|
|
662
|
+
|
|
663
|
+
EXAMPLES::
|
|
664
|
+
|
|
665
|
+
sage: # needs sage.rings.finite_rings
|
|
666
|
+
sage: K.<a> = GF(5^3).over()
|
|
667
|
+
sage: b = a + 1
|
|
668
|
+
sage: b.sqrt()
|
|
669
|
+
2 + 3*a + a^2
|
|
670
|
+
sage: b.sqrt(all=True)
|
|
671
|
+
[2 + 3*a + a^2, 3 + 2*a - a^2]
|
|
672
|
+
"""
|
|
673
|
+
sq = self._backend.sqrt(extend=extend, all=all)
|
|
674
|
+
if all:
|
|
675
|
+
gen = sq[0]
|
|
676
|
+
else:
|
|
677
|
+
gen = sq
|
|
678
|
+
parent = self._parent
|
|
679
|
+
backend_parent = gen.parent()
|
|
680
|
+
if backend_parent is not (<RingExtension_generic>parent)._backend:
|
|
681
|
+
from sage.rings.ring_extension import RingExtension
|
|
682
|
+
if name is None:
|
|
683
|
+
raise ValueError("you must specify a variable name")
|
|
684
|
+
names = normalize_names(1, name)
|
|
685
|
+
constructor = (RingExtensionWithGen,
|
|
686
|
+
{'gen': gen, 'name': names[0], 'is_backend_exposed': False})
|
|
687
|
+
parent = RingExtension(backend_parent, parent, (gen,), names, constructors=[constructor])
|
|
688
|
+
if all:
|
|
689
|
+
return [ parent(s) for s in sq ]
|
|
690
|
+
else:
|
|
691
|
+
return parent(sq)
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
# Fraction fields
|
|
695
|
+
#################
|
|
696
|
+
|
|
697
|
+
cdef class RingExtensionFractionFieldElement(RingExtensionElement):
|
|
698
|
+
r"""
|
|
699
|
+
A class for elements lying in fraction fields of ring extensions.
|
|
700
|
+
|
|
701
|
+
TESTS::
|
|
702
|
+
|
|
703
|
+
sage: Z = ZZ.over()
|
|
704
|
+
sage: Q = Z.fraction_field()
|
|
705
|
+
sage: x = Q.random_element()
|
|
706
|
+
sage: type(x)
|
|
707
|
+
<class 'sage.rings.ring_extension_element.RingExtensionFractionFieldElement'>
|
|
708
|
+
sage: TestSuite(x).run()
|
|
709
|
+
"""
|
|
710
|
+
def __hash__(self):
|
|
711
|
+
"""
|
|
712
|
+
Return a hash of this element.
|
|
713
|
+
|
|
714
|
+
EXAMPLES:
|
|
715
|
+
|
|
716
|
+
sage: E.<a> = GF(5^3).over() # needs sage.rings.finite_rings
|
|
717
|
+
sage: hash(a) # needs sage.rings.finite_rings
|
|
718
|
+
5
|
|
719
|
+
"""
|
|
720
|
+
return hash(self._backend)
|
|
721
|
+
|
|
722
|
+
def _repr_extension(self, **options):
|
|
723
|
+
r"""
|
|
724
|
+
Return a string representation of this element.
|
|
725
|
+
|
|
726
|
+
TESTS::
|
|
727
|
+
|
|
728
|
+
sage: Z = ZZ.over()
|
|
729
|
+
sage: Q = Z.fraction_field()
|
|
730
|
+
sage: x = Q(1/2)
|
|
731
|
+
sage: x._repr_extension()
|
|
732
|
+
'1/2'
|
|
733
|
+
sage: R = QQ['x'].over()
|
|
734
|
+
sage: K = R.fraction_field()
|
|
735
|
+
sage: x = R.gen()
|
|
736
|
+
sage: (x^2 + 1) / (x^2 - 1)
|
|
737
|
+
(x^2 + 1)/(x^2 - 1)
|
|
738
|
+
sage: x / (x + 1)
|
|
739
|
+
x/(x + 1)
|
|
740
|
+
sage: (x + 1)/(-x)
|
|
741
|
+
(-x - 1)/x
|
|
742
|
+
"""
|
|
743
|
+
num = self.numerator()
|
|
744
|
+
denom = self.denominator()
|
|
745
|
+
if denom == 1:
|
|
746
|
+
sd = ""
|
|
747
|
+
elif denom == -1:
|
|
748
|
+
num = -num
|
|
749
|
+
sd = ""
|
|
750
|
+
elif denom._is_atomic():
|
|
751
|
+
sd = "/%s" % denom
|
|
752
|
+
elif (-denom)._is_atomic():
|
|
753
|
+
sd = "/%s" % (-denom)
|
|
754
|
+
num = -num
|
|
755
|
+
else:
|
|
756
|
+
sd = "/(%s)" % denom
|
|
757
|
+
if num._is_atomic():
|
|
758
|
+
return "%s%s" % (num, sd)
|
|
759
|
+
else:
|
|
760
|
+
return "(%s)%s" % (num, sd)
|
|
761
|
+
|
|
762
|
+
def _latex_extension(self, **options):
|
|
763
|
+
r"""
|
|
764
|
+
Return a LaTeX representation of this element.
|
|
765
|
+
|
|
766
|
+
TESTS::
|
|
767
|
+
|
|
768
|
+
sage: Z = ZZ.over()
|
|
769
|
+
sage: Q = Z.fraction_field()
|
|
770
|
+
sage: x = Q(1/2)
|
|
771
|
+
sage: x._latex_extension()
|
|
772
|
+
'\\frac{1}{2}'
|
|
773
|
+
"""
|
|
774
|
+
num = self.numerator()
|
|
775
|
+
denom = self.denominator()
|
|
776
|
+
if denom == -1:
|
|
777
|
+
denom = 1
|
|
778
|
+
num = -num
|
|
779
|
+
if isinstance((<RingExtensionFractionField>self._parent)._ring, RingExtension_generic):
|
|
780
|
+
snum = num._latex_(**options)
|
|
781
|
+
sdenom = denom._latex_(**options)
|
|
782
|
+
else:
|
|
783
|
+
snum = latex(num)
|
|
784
|
+
sdenom = latex(denom)
|
|
785
|
+
if denom == 1:
|
|
786
|
+
return snum
|
|
787
|
+
else:
|
|
788
|
+
return "\\frac{%s}{%s}" % (snum, sdenom)
|
|
789
|
+
|
|
790
|
+
def numerator(self):
|
|
791
|
+
r"""
|
|
792
|
+
Return the numerator of this element.
|
|
793
|
+
|
|
794
|
+
EXAMPLES::
|
|
795
|
+
|
|
796
|
+
sage: # needs sage.rings.number_field
|
|
797
|
+
sage: x = polygen(ZZ, 'x')
|
|
798
|
+
sage: A.<a> = ZZ.extension(x^2 - 2)
|
|
799
|
+
sage: OK = A.over() # over ZZ
|
|
800
|
+
sage: K = OK.fraction_field(); K
|
|
801
|
+
Fraction Field of Maximal Order generated by a in Number Field in a
|
|
802
|
+
with defining polynomial x^2 - 2 over its base
|
|
803
|
+
sage: x = K(1/a); x
|
|
804
|
+
a/2
|
|
805
|
+
sage: num = x.numerator(); num
|
|
806
|
+
a
|
|
807
|
+
|
|
808
|
+
The numerator is an element of the ring which was used
|
|
809
|
+
to construct the fraction field::
|
|
810
|
+
|
|
811
|
+
sage: num.parent() # needs sage.rings.number_field
|
|
812
|
+
Maximal Order generated by a in Number Field in a
|
|
813
|
+
with defining polynomial x^2 - 2 over its base
|
|
814
|
+
sage: num.parent() is OK # needs sage.rings.number_field
|
|
815
|
+
True
|
|
816
|
+
|
|
817
|
+
TESTS::
|
|
818
|
+
|
|
819
|
+
sage: # needs sage.rings.number_field
|
|
820
|
+
sage: x = K.random_element()
|
|
821
|
+
sage: x == x.numerator() / x.denominator()
|
|
822
|
+
True
|
|
823
|
+
"""
|
|
824
|
+
ring = (<RingExtensionFractionField>self._parent)._ring
|
|
825
|
+
num = self._backend.numerator()
|
|
826
|
+
return ring(num)
|
|
827
|
+
|
|
828
|
+
def denominator(self):
|
|
829
|
+
r"""
|
|
830
|
+
Return the denominator of this element.
|
|
831
|
+
|
|
832
|
+
EXAMPLES::
|
|
833
|
+
|
|
834
|
+
sage: # needs sage.rings.number_field
|
|
835
|
+
sage: R.<x> = ZZ[]
|
|
836
|
+
sage: A.<a> = ZZ.extension(x^2 - 2)
|
|
837
|
+
sage: OK = A.over() # over ZZ
|
|
838
|
+
sage: K = OK.fraction_field(); K
|
|
839
|
+
Fraction Field of
|
|
840
|
+
Maximal Order generated by a in Number Field in a
|
|
841
|
+
with defining polynomial x^2 - 2 over its base
|
|
842
|
+
sage: x = K(1/a); x
|
|
843
|
+
a/2
|
|
844
|
+
sage: denom = x.denominator(); denom
|
|
845
|
+
2
|
|
846
|
+
|
|
847
|
+
The denominator is an element of the ring which was used
|
|
848
|
+
to construct the fraction field::
|
|
849
|
+
|
|
850
|
+
sage: denom.parent() # needs sage.rings.number_field
|
|
851
|
+
Maximal Order generated by a in Number Field in a with defining polynomial x^2 - 2 over its base
|
|
852
|
+
sage: denom.parent() is OK # needs sage.rings.number_field
|
|
853
|
+
True
|
|
854
|
+
|
|
855
|
+
TESTS::
|
|
856
|
+
|
|
857
|
+
sage: # needs sage.rings.number_field
|
|
858
|
+
sage: x = K.random_element()
|
|
859
|
+
sage: x == x.numerator() / x.denominator()
|
|
860
|
+
True
|
|
861
|
+
"""
|
|
862
|
+
ring = (<RingExtensionFractionField>self._parent)._ring
|
|
863
|
+
denom = self._backend.denominator()
|
|
864
|
+
return ring(denom)
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
# Finite free extensions
|
|
868
|
+
########################
|
|
869
|
+
|
|
870
|
+
cdef class RingExtensionWithBasisElement(RingExtensionElement):
|
|
871
|
+
r"""
|
|
872
|
+
A class for elements lying in finite free extensions.
|
|
873
|
+
|
|
874
|
+
TESTS::
|
|
875
|
+
|
|
876
|
+
sage: # needs sage.rings.finite_rings
|
|
877
|
+
sage: K.<a> = GF(5^3).over()
|
|
878
|
+
sage: L.<b> = GF(5^9).over(K)
|
|
879
|
+
sage: type(b)
|
|
880
|
+
<class 'sage.rings.ring_extension_element.RingExtensionWithBasisElement'>
|
|
881
|
+
sage: TestSuite(b).run()
|
|
882
|
+
"""
|
|
883
|
+
def __hash__(self):
|
|
884
|
+
"""
|
|
885
|
+
Return a hash of this element.
|
|
886
|
+
|
|
887
|
+
EXAMPLES:
|
|
888
|
+
|
|
889
|
+
sage: E.<a> = GF(5^3).over() # needs sage.rings.finite_rings
|
|
890
|
+
sage: hash(a) # needs sage.rings.finite_rings
|
|
891
|
+
5
|
|
892
|
+
"""
|
|
893
|
+
return hash(self._backend)
|
|
894
|
+
|
|
895
|
+
def _repr_extension(self, base, **options):
|
|
896
|
+
r"""
|
|
897
|
+
Return a string representation of this element written as
|
|
898
|
+
a linear combination over ``base`` in the basis provided by
|
|
899
|
+
the method :meth:`basis_over`.
|
|
900
|
+
|
|
901
|
+
INPUT:
|
|
902
|
+
|
|
903
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
904
|
+
extension) or ``None``
|
|
905
|
+
|
|
906
|
+
EXAMPLES::
|
|
907
|
+
|
|
908
|
+
sage: # needs sage.rings.finite_rings
|
|
909
|
+
sage: K.<a> = GF(5^3).over()
|
|
910
|
+
sage: L.<b> = GF(5^9).over(K)
|
|
911
|
+
sage: u = 1/(a+b)
|
|
912
|
+
sage: u._repr_extension(base=K)
|
|
913
|
+
'(2 + 2*a) + (-1 + a - a^2)*b + (2 + 3*a + 3*a^2)*b^2'
|
|
914
|
+
sage: u._repr_extension(base=GF(5))
|
|
915
|
+
'2 + 2*a - b + a*b - a^2*b + 2*b^2 + 3*a*b^2 + 3*a^2*b^2'
|
|
916
|
+
"""
|
|
917
|
+
cdef RingExtensionWithBasis parent = self._parent
|
|
918
|
+
coeffs = self._vector(base)
|
|
919
|
+
names = parent._basis_names
|
|
920
|
+
b = parent._base
|
|
921
|
+
while b is not base:
|
|
922
|
+
new_names = [ ]
|
|
923
|
+
for y in names:
|
|
924
|
+
for x in (<RingExtensionWithBasis>b)._basis_names:
|
|
925
|
+
if x == "":
|
|
926
|
+
new_names.append(y)
|
|
927
|
+
elif y == "":
|
|
928
|
+
new_names.append(x)
|
|
929
|
+
else:
|
|
930
|
+
new_names.append(x + "*" + y)
|
|
931
|
+
names = new_names
|
|
932
|
+
b = (<RingExtensionWithBasis>b)._base
|
|
933
|
+
s = ""
|
|
934
|
+
for i in range(len(names)):
|
|
935
|
+
c = coeffs[i]
|
|
936
|
+
if c.is_zero():
|
|
937
|
+
continue
|
|
938
|
+
sign = 1
|
|
939
|
+
ss = ""
|
|
940
|
+
if c == -1:
|
|
941
|
+
sign = -1
|
|
942
|
+
elif c != 1:
|
|
943
|
+
atomic = c._is_atomic()
|
|
944
|
+
if not atomic and (-c)._is_atomic():
|
|
945
|
+
c = -c
|
|
946
|
+
sign = -sign
|
|
947
|
+
atomic = True
|
|
948
|
+
sc = str(c)
|
|
949
|
+
if atomic:
|
|
950
|
+
ss += sc
|
|
951
|
+
else:
|
|
952
|
+
ss += "(" + sc + ")"
|
|
953
|
+
if names[i] != "":
|
|
954
|
+
ss += "*"
|
|
955
|
+
if ss and ss[0] == "-":
|
|
956
|
+
ss = ss[1:]
|
|
957
|
+
sign *= -1
|
|
958
|
+
if s == "":
|
|
959
|
+
if sign == -1:
|
|
960
|
+
s = "-"
|
|
961
|
+
else:
|
|
962
|
+
s += " + " if sign == 1 else " - "
|
|
963
|
+
ss += names[i]
|
|
964
|
+
if ss == "":
|
|
965
|
+
ss += "1"
|
|
966
|
+
s += ss
|
|
967
|
+
if s == "":
|
|
968
|
+
return "0"
|
|
969
|
+
if s[0] == "(" and s[-1] == ")":
|
|
970
|
+
s = s[1:-1]
|
|
971
|
+
return s
|
|
972
|
+
|
|
973
|
+
def _latex_extension(self, base, **options):
|
|
974
|
+
r"""
|
|
975
|
+
Return a LaTeX representation of this element written as
|
|
976
|
+
a linear combination over ``base`` in the basis provided by
|
|
977
|
+
the method :meth:`basis_over`.
|
|
978
|
+
|
|
979
|
+
INPUT:
|
|
980
|
+
|
|
981
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
982
|
+
extension) or ``None``
|
|
983
|
+
|
|
984
|
+
EXAMPLES::
|
|
985
|
+
|
|
986
|
+
sage: # needs sage.rings.finite_rings
|
|
987
|
+
sage: K.<a> = GF(5^3).over()
|
|
988
|
+
sage: L.<b> = GF(5^9).over(K)
|
|
989
|
+
sage: u = 1/(a+b)
|
|
990
|
+
sage: u._latex_extension(base=K)
|
|
991
|
+
\left( 2 + 2 a \right) + \left( -1 + a - a^{2} \right) b + \left( 2 + 3 a + 3 a^{2} \right) b^{2}
|
|
992
|
+
sage: u._latex_extension(base=GF(5))
|
|
993
|
+
2 + 2 a - b + ab - a^{2}b + 2 b^{2} + 3 ab^{2} + 3 a^{2}b^{2}
|
|
994
|
+
"""
|
|
995
|
+
cdef RingExtensionWithBasis parent = self._parent
|
|
996
|
+
coeffs = self._vector(base)
|
|
997
|
+
names = parent._basis_latex_names
|
|
998
|
+
b = parent._base
|
|
999
|
+
while b is not base:
|
|
1000
|
+
names = [ x + y for y in names for x in (<RingExtensionWithBasis>b)._basis_latex_names ]
|
|
1001
|
+
b = (<RingExtensionWithBasis>b)._base
|
|
1002
|
+
s = ""
|
|
1003
|
+
for i in range(len(names)):
|
|
1004
|
+
c = coeffs[i]
|
|
1005
|
+
if c.is_zero():
|
|
1006
|
+
continue
|
|
1007
|
+
sign = 1
|
|
1008
|
+
ss = ""
|
|
1009
|
+
if c == -1:
|
|
1010
|
+
sign = -1
|
|
1011
|
+
elif c != 1:
|
|
1012
|
+
atomic = c._is_atomic()
|
|
1013
|
+
if not atomic and (-c)._is_atomic():
|
|
1014
|
+
c = -c
|
|
1015
|
+
sign = -sign
|
|
1016
|
+
atomic = True
|
|
1017
|
+
sc = latex(c)
|
|
1018
|
+
if atomic:
|
|
1019
|
+
ss += sc
|
|
1020
|
+
else:
|
|
1021
|
+
ss += r"\left(" + sc + r"\right)"
|
|
1022
|
+
if ss != "" and ss[0] == "-":
|
|
1023
|
+
ss = ss[1:]
|
|
1024
|
+
sign *= -1
|
|
1025
|
+
if s == "":
|
|
1026
|
+
if sign == -1:
|
|
1027
|
+
s = "-"
|
|
1028
|
+
else:
|
|
1029
|
+
s += " + " if sign == 1 else " - "
|
|
1030
|
+
ss += names[i]
|
|
1031
|
+
if ss == "":
|
|
1032
|
+
ss += "1"
|
|
1033
|
+
s += ss
|
|
1034
|
+
if s == "":
|
|
1035
|
+
return "0"
|
|
1036
|
+
if s[:6] == r"\left(" and s[-7] == r"\right)":
|
|
1037
|
+
s = s[6:-7]
|
|
1038
|
+
return s
|
|
1039
|
+
|
|
1040
|
+
def vector(self, base=None):
|
|
1041
|
+
r"""
|
|
1042
|
+
Return the vector of coordinates of this element over ``base``
|
|
1043
|
+
(in the basis output by the method :meth:`basis_over`).
|
|
1044
|
+
|
|
1045
|
+
INPUT:
|
|
1046
|
+
|
|
1047
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1048
|
+
extension) or ``None``
|
|
1049
|
+
|
|
1050
|
+
EXAMPLES::
|
|
1051
|
+
|
|
1052
|
+
sage: # needs sage.rings.finite_rings
|
|
1053
|
+
sage: F = GF(5)
|
|
1054
|
+
sage: K.<a> = GF(5^2).over() # over F
|
|
1055
|
+
sage: L.<b> = GF(5^6).over(K)
|
|
1056
|
+
sage: x = (a+b)^4; x
|
|
1057
|
+
(-1 + a) + (3 + a)*b + (1 - a)*b^2
|
|
1058
|
+
sage: x.vector(K) # basis is (1, b, b^2)
|
|
1059
|
+
(-1 + a, 3 + a, 1 - a)
|
|
1060
|
+
sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2)
|
|
1061
|
+
(4, 1, 3, 1, 1, 4)
|
|
1062
|
+
|
|
1063
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1064
|
+
base of the extension::
|
|
1065
|
+
|
|
1066
|
+
sage: x.vector() # needs sage.rings.finite_rings
|
|
1067
|
+
(-1 + a, 3 + a, 1 - a)
|
|
1068
|
+
|
|
1069
|
+
Note that ``base`` must be an explicit base over which the
|
|
1070
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1071
|
+
|
|
1072
|
+
sage: x.vector(GF(5^3)) # needs sage.rings.finite_rings
|
|
1073
|
+
Traceback (most recent call last):
|
|
1074
|
+
...
|
|
1075
|
+
ValueError: not (explicitly) defined over Finite Field in z3 of size 5^3
|
|
1076
|
+
"""
|
|
1077
|
+
base = (<RingExtension_generic>self._parent)._check_base(base)
|
|
1078
|
+
return self._vector(base)
|
|
1079
|
+
|
|
1080
|
+
cdef _vector(self, Parent base):
|
|
1081
|
+
r"""
|
|
1082
|
+
Return the vector of coordinates of this element over ``base``
|
|
1083
|
+
(in the basis output by the method :meth:`basis_over`).
|
|
1084
|
+
|
|
1085
|
+
INPUT:
|
|
1086
|
+
|
|
1087
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1088
|
+
extension) or ``None``
|
|
1089
|
+
|
|
1090
|
+
TESTS::
|
|
1091
|
+
|
|
1092
|
+
sage: # needs sage.rings.finite_rings
|
|
1093
|
+
sage: K = GF(11^10).over(GF(11^2))
|
|
1094
|
+
sage: x = K.random_element()
|
|
1095
|
+
sage: coeffs = x.vector()
|
|
1096
|
+
sage: basis = K.basis_over()
|
|
1097
|
+
sage: x == sum(coeffs[i]*basis[i] for i in range(5))
|
|
1098
|
+
True
|
|
1099
|
+
"""
|
|
1100
|
+
_, _, j = (<RingExtensionWithBasis>self._parent)._free_module(base, map=True)
|
|
1101
|
+
return j(self)
|
|
1102
|
+
|
|
1103
|
+
def polynomial(self, base=None, var='x'):
|
|
1104
|
+
r"""
|
|
1105
|
+
Return a polynomial (in one or more variables) over ``base``
|
|
1106
|
+
whose evaluation at the generators of the parent equals this
|
|
1107
|
+
element.
|
|
1108
|
+
|
|
1109
|
+
INPUT:
|
|
1110
|
+
|
|
1111
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1112
|
+
extension) or ``None``
|
|
1113
|
+
|
|
1114
|
+
EXAMPLES::
|
|
1115
|
+
|
|
1116
|
+
sage: # needs sage.rings.finite_rings
|
|
1117
|
+
sage: F.<a> = GF(5^2).over() # over GF(5)
|
|
1118
|
+
sage: K.<b> = GF(5^4).over(F)
|
|
1119
|
+
sage: L.<c> = GF(5^12).over(K)
|
|
1120
|
+
sage: u = 1/(a + b + c); u
|
|
1121
|
+
(2 + (-1 - a)*b) + ((2 + 3*a) + (1 - a)*b)*c + ((-1 - a) - a*b)*c^2
|
|
1122
|
+
sage: P = u.polynomial(K); P
|
|
1123
|
+
((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b
|
|
1124
|
+
sage: P.base_ring() is K
|
|
1125
|
+
True
|
|
1126
|
+
sage: P(c) == u
|
|
1127
|
+
True
|
|
1128
|
+
|
|
1129
|
+
When the base is `F`, we obtain a bivariate polynomial::
|
|
1130
|
+
|
|
1131
|
+
sage: P = u.polynomial(F); P # needs sage.rings.finite_rings
|
|
1132
|
+
(-a)*x0^2*x1 + (-1 - a)*x0^2 + (1 - a)*x0*x1 + (2 + 3*a)*x0 + (-1 - a)*x1 + 2
|
|
1133
|
+
|
|
1134
|
+
We check that its value at the generators is the element we started with::
|
|
1135
|
+
|
|
1136
|
+
sage: L.gens(F) # needs sage.rings.finite_rings
|
|
1137
|
+
(c, b)
|
|
1138
|
+
sage: P(c, b) == u # needs sage.rings.finite_rings
|
|
1139
|
+
True
|
|
1140
|
+
|
|
1141
|
+
Similarly, when the base is ``GF(5)``, we get a trivariate polynomial:
|
|
1142
|
+
|
|
1143
|
+
sage: P = u.polynomial(GF(5)); P # needs sage.rings.finite_rings
|
|
1144
|
+
-x0^2*x1*x2 - x0^2*x2 - x0*x1*x2 - x0^2 + x0*x1 - 2*x0*x2 - x1*x2 + 2*x0 - x1 + 2
|
|
1145
|
+
sage: P(c, b, a) == u # needs sage.rings.finite_rings
|
|
1146
|
+
True
|
|
1147
|
+
|
|
1148
|
+
Different variable names can be specified::
|
|
1149
|
+
|
|
1150
|
+
sage: u.polynomial(GF(5), var='y') # needs sage.rings.finite_rings
|
|
1151
|
+
-y0^2*y1*y2 - y0^2*y2 - y0*y1*y2 - y0^2 + y0*y1 - 2*y0*y2 - y1*y2 + 2*y0 - y1 + 2
|
|
1152
|
+
sage: u.polynomial(GF(5), var=['x','y','z']) # needs sage.rings.finite_rings
|
|
1153
|
+
-x^2*y*z - x^2*z - x*y*z - x^2 + x*y - 2*x*z - y*z + 2*x - y + 2
|
|
1154
|
+
|
|
1155
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1156
|
+
base of the extension::
|
|
1157
|
+
|
|
1158
|
+
sage: u.polynomial() # needs sage.rings.finite_rings
|
|
1159
|
+
((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b
|
|
1160
|
+
|
|
1161
|
+
Note that ``base`` must be an explicit base over which the
|
|
1162
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1163
|
+
|
|
1164
|
+
sage: u.polynomial(GF(5^3)) # needs sage.rings.finite_rings
|
|
1165
|
+
Traceback (most recent call last):
|
|
1166
|
+
...
|
|
1167
|
+
ValueError: not (explicitly) defined over Finite Field in z3 of size 5^3
|
|
1168
|
+
"""
|
|
1169
|
+
base = self._parent._check_base(base)
|
|
1170
|
+
degrees = [ ]
|
|
1171
|
+
b = self._parent
|
|
1172
|
+
degree = 1
|
|
1173
|
+
while b is not base:
|
|
1174
|
+
if not isinstance(b, RingExtensionWithGen):
|
|
1175
|
+
raise NotImplementedError
|
|
1176
|
+
reldeg = b.relative_degree()
|
|
1177
|
+
degree *= reldeg
|
|
1178
|
+
degrees.append(reldeg)
|
|
1179
|
+
b = b.base_ring()
|
|
1180
|
+
degrees.reverse()
|
|
1181
|
+
coeffs = { }
|
|
1182
|
+
v = self._vector(base)
|
|
1183
|
+
S = PolynomialRing(base, len(degrees), names=var)
|
|
1184
|
+
for i in range(degree):
|
|
1185
|
+
ii = ZZ(i)
|
|
1186
|
+
exponents = [ ]
|
|
1187
|
+
for d in degrees:
|
|
1188
|
+
ii, exponent = ii.quo_rem(d)
|
|
1189
|
+
exponents.append(exponent)
|
|
1190
|
+
coeffs[tuple(reversed(exponents))] = v[i]
|
|
1191
|
+
return S(coeffs)
|
|
1192
|
+
|
|
1193
|
+
def matrix(self, base=None):
|
|
1194
|
+
r"""
|
|
1195
|
+
Return the matrix of the multiplication by this element (in
|
|
1196
|
+
the basis output by :meth:`basis_over`).
|
|
1197
|
+
|
|
1198
|
+
INPUT:
|
|
1199
|
+
|
|
1200
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1201
|
+
extension) or ``None``
|
|
1202
|
+
|
|
1203
|
+
EXAMPLES::
|
|
1204
|
+
|
|
1205
|
+
sage: # needs sage.rings.finite_rings
|
|
1206
|
+
sage: K.<a> = GF(5^3).over() # over GF(5)
|
|
1207
|
+
sage: L.<b> = GF(5^6).over(K)
|
|
1208
|
+
sage: u = a/(1+b)
|
|
1209
|
+
sage: u
|
|
1210
|
+
(2 + a + 3*a^2) + (3 + 3*a + a^2)*b
|
|
1211
|
+
sage: b*u
|
|
1212
|
+
(3 + 2*a^2) + (2 + 2*a - a^2)*b
|
|
1213
|
+
sage: u.matrix(K)
|
|
1214
|
+
[2 + a + 3*a^2 3 + 3*a + a^2]
|
|
1215
|
+
[ 3 + 2*a^2 2 + 2*a - a^2]
|
|
1216
|
+
sage: u.matrix(GF(5))
|
|
1217
|
+
[2 1 3 3 3 1]
|
|
1218
|
+
[1 3 1 2 0 3]
|
|
1219
|
+
[2 3 3 1 3 0]
|
|
1220
|
+
[3 0 2 2 2 4]
|
|
1221
|
+
[4 2 0 3 0 2]
|
|
1222
|
+
[0 4 2 4 2 0]
|
|
1223
|
+
|
|
1224
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1225
|
+
base of the extension::
|
|
1226
|
+
|
|
1227
|
+
sage: u.matrix() # needs sage.rings.finite_rings
|
|
1228
|
+
[2 + a + 3*a^2 3 + 3*a + a^2]
|
|
1229
|
+
[ 3 + 2*a^2 2 + 2*a - a^2]
|
|
1230
|
+
|
|
1231
|
+
Note that ``base`` must be an explicit base over which the
|
|
1232
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1233
|
+
|
|
1234
|
+
sage: u.matrix(GF(5^2)) # needs sage.rings.finite_rings
|
|
1235
|
+
Traceback (most recent call last):
|
|
1236
|
+
...
|
|
1237
|
+
ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2
|
|
1238
|
+
"""
|
|
1239
|
+
cdef RingExtension_generic parent = self._parent
|
|
1240
|
+
base = parent._check_base(base)
|
|
1241
|
+
if not (parent._is_finite_over(base) and parent._is_free_over(base)):
|
|
1242
|
+
raise ValueError("the extension is not finite free")
|
|
1243
|
+
return self._matrix(base)
|
|
1244
|
+
|
|
1245
|
+
cdef _matrix(self, Parent base):
|
|
1246
|
+
r"""
|
|
1247
|
+
Return the matrix of the multiplication by this element (in
|
|
1248
|
+
the basis output by :meth:`basis_over`).
|
|
1249
|
+
|
|
1250
|
+
This method does not check its input.
|
|
1251
|
+
Do not call it directly; use :meth:`matrix` instead.
|
|
1252
|
+
|
|
1253
|
+
INPUT:
|
|
1254
|
+
|
|
1255
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1256
|
+
extension)
|
|
1257
|
+
|
|
1258
|
+
TESTS::
|
|
1259
|
+
|
|
1260
|
+
sage: # needs sage.rings.finite_rings
|
|
1261
|
+
sage: F = GF(11^2)
|
|
1262
|
+
sage: K = GF(11^6).over(F)
|
|
1263
|
+
sage: L = GF(11^18).over(K)
|
|
1264
|
+
sage: for base in L.bases():
|
|
1265
|
+
....: x = L.random_element()
|
|
1266
|
+
....: y = L.random_element()
|
|
1267
|
+
....: assert((x+y).matrix(base) == x.matrix(base) + y.matrix(base))
|
|
1268
|
+
....: assert((x*y).matrix(base) == x.matrix(base) * y.matrix(base))
|
|
1269
|
+
"""
|
|
1270
|
+
from sage.matrix.matrix_space import MatrixSpace
|
|
1271
|
+
cdef RingExtensionWithBasis parent = self._parent
|
|
1272
|
+
_, _, j = parent._free_module(base, map=True)
|
|
1273
|
+
x = self._backend
|
|
1274
|
+
M = [ j(x * (<RingExtensionElement>b)._backend) for b in parent._basis_over(base) ]
|
|
1275
|
+
return MatrixSpace(base, len(M))(M)
|
|
1276
|
+
|
|
1277
|
+
def trace(self, base=None):
|
|
1278
|
+
r"""
|
|
1279
|
+
Return the trace of this element over ``base``.
|
|
1280
|
+
|
|
1281
|
+
INPUT:
|
|
1282
|
+
|
|
1283
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1284
|
+
extension) or ``None``
|
|
1285
|
+
|
|
1286
|
+
EXAMPLES::
|
|
1287
|
+
|
|
1288
|
+
sage: # needs sage.rings.finite_rings
|
|
1289
|
+
sage: F = GF(5)
|
|
1290
|
+
sage: K.<a> = GF(5^3).over(F)
|
|
1291
|
+
sage: L.<b> = GF(5^6).over(K)
|
|
1292
|
+
sage: u = a/(1+b)
|
|
1293
|
+
sage: tr = u.trace(K); tr
|
|
1294
|
+
-1 + 3*a + 2*a^2
|
|
1295
|
+
|
|
1296
|
+
We check that the trace lives in the base ring::
|
|
1297
|
+
|
|
1298
|
+
sage: tr.parent() # needs sage.rings.finite_rings
|
|
1299
|
+
Field in a with defining polynomial x^3 + 3*x + 3 over its base
|
|
1300
|
+
sage: tr.parent() is K # needs sage.rings.finite_rings
|
|
1301
|
+
True
|
|
1302
|
+
|
|
1303
|
+
Similarly, one can compute the trace over F::
|
|
1304
|
+
|
|
1305
|
+
sage: u.trace(F) # needs sage.rings.finite_rings
|
|
1306
|
+
0
|
|
1307
|
+
|
|
1308
|
+
We check the transitivity of the trace::
|
|
1309
|
+
|
|
1310
|
+
sage: u.trace(F) == tr.trace(F) # needs sage.rings.finite_rings
|
|
1311
|
+
True
|
|
1312
|
+
|
|
1313
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1314
|
+
base of the extension::
|
|
1315
|
+
|
|
1316
|
+
sage: u.trace() # needs sage.rings.finite_rings
|
|
1317
|
+
-1 + 3*a + 2*a^2
|
|
1318
|
+
|
|
1319
|
+
Note that ``base`` must be an explicit base over which the
|
|
1320
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1321
|
+
|
|
1322
|
+
sage: u.trace(GF(5^2)) # needs sage.rings.finite_rings
|
|
1323
|
+
Traceback (most recent call last):
|
|
1324
|
+
...
|
|
1325
|
+
ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2
|
|
1326
|
+
"""
|
|
1327
|
+
cdef RingExtension_generic parent = self._parent
|
|
1328
|
+
base = parent._check_base(base)
|
|
1329
|
+
if not (parent._is_finite_over(base) and parent._is_free_over(base)):
|
|
1330
|
+
raise ValueError("the extension is not finite free")
|
|
1331
|
+
return self._trace(base)
|
|
1332
|
+
|
|
1333
|
+
cdef _trace(self, Parent base):
|
|
1334
|
+
r"""
|
|
1335
|
+
Return the trace of this element over ``base``.
|
|
1336
|
+
|
|
1337
|
+
This method does not check its input.
|
|
1338
|
+
Do not call it directly; use :meth:`trace` instead.
|
|
1339
|
+
|
|
1340
|
+
INPUT:
|
|
1341
|
+
|
|
1342
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1343
|
+
extension)
|
|
1344
|
+
|
|
1345
|
+
TESTS::
|
|
1346
|
+
|
|
1347
|
+
sage: # needs sage.rings.finite_rings
|
|
1348
|
+
sage: F = GF(11^2)
|
|
1349
|
+
sage: K = GF(11^6).over(F)
|
|
1350
|
+
sage: L = GF(11^18).over(K)
|
|
1351
|
+
sage: x = L.random_element()
|
|
1352
|
+
sage: x.trace(F) == x.trace().trace()
|
|
1353
|
+
True
|
|
1354
|
+
sage: for base in L.bases():
|
|
1355
|
+
....: x = L.random_element()
|
|
1356
|
+
....: y = L.random_element()
|
|
1357
|
+
....: assert(x.trace(base) == x.matrix(base).trace())
|
|
1358
|
+
....: assert((x+y).trace(base) == x.trace(base) + y.trace(base))
|
|
1359
|
+
"""
|
|
1360
|
+
cdef RingExtensionWithBasis parent = self._parent
|
|
1361
|
+
cdef Parent b
|
|
1362
|
+
if base is parent:
|
|
1363
|
+
return self
|
|
1364
|
+
b = parent._base
|
|
1365
|
+
t = self._matrix(b).trace()
|
|
1366
|
+
if base is b:
|
|
1367
|
+
return t
|
|
1368
|
+
return (<RingExtensionWithBasisElement>t)._trace(base)
|
|
1369
|
+
|
|
1370
|
+
def norm(self, base=None):
|
|
1371
|
+
r"""
|
|
1372
|
+
Return the norm of this element over ``base``.
|
|
1373
|
+
|
|
1374
|
+
INPUT:
|
|
1375
|
+
|
|
1376
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1377
|
+
extension) or ``None``
|
|
1378
|
+
|
|
1379
|
+
EXAMPLES::
|
|
1380
|
+
|
|
1381
|
+
sage: # needs sage.rings.finite_rings
|
|
1382
|
+
sage: F = GF(5)
|
|
1383
|
+
sage: K.<a> = GF(5^3).over(F)
|
|
1384
|
+
sage: L.<b> = GF(5^6).over(K)
|
|
1385
|
+
sage: u = a/(1+b)
|
|
1386
|
+
sage: nr = u.norm(K); nr
|
|
1387
|
+
3 + 2*a^2
|
|
1388
|
+
|
|
1389
|
+
We check that the norm lives in the base ring::
|
|
1390
|
+
|
|
1391
|
+
sage: nr.parent() # needs sage.rings.finite_rings
|
|
1392
|
+
Field in a with defining polynomial x^3 + 3*x + 3 over its base
|
|
1393
|
+
sage: nr.parent() is K # needs sage.rings.finite_rings
|
|
1394
|
+
True
|
|
1395
|
+
|
|
1396
|
+
Similarly, one can compute the norm over F::
|
|
1397
|
+
|
|
1398
|
+
sage: u.norm(F) # needs sage.rings.finite_rings
|
|
1399
|
+
4
|
|
1400
|
+
|
|
1401
|
+
We check the transitivity of the norm::
|
|
1402
|
+
|
|
1403
|
+
sage: u.norm(F) == nr.norm(F) # needs sage.rings.finite_rings
|
|
1404
|
+
True
|
|
1405
|
+
|
|
1406
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1407
|
+
base of the extension::
|
|
1408
|
+
|
|
1409
|
+
sage: u.norm() # needs sage.rings.finite_rings
|
|
1410
|
+
3 + 2*a^2
|
|
1411
|
+
|
|
1412
|
+
Note that ``base`` must be an explicit base over which the
|
|
1413
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1414
|
+
|
|
1415
|
+
sage: u.norm(GF(5^2)) # needs sage.rings.finite_rings
|
|
1416
|
+
Traceback (most recent call last):
|
|
1417
|
+
...
|
|
1418
|
+
ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2
|
|
1419
|
+
"""
|
|
1420
|
+
cdef RingExtension_generic parent = self._parent
|
|
1421
|
+
base = parent._check_base(base)
|
|
1422
|
+
if not (parent._is_finite_over(base) and parent._is_free_over(base)):
|
|
1423
|
+
raise ValueError("the extension is not finite free")
|
|
1424
|
+
return self._norm(base)
|
|
1425
|
+
|
|
1426
|
+
cdef _norm(self, Parent base):
|
|
1427
|
+
r"""
|
|
1428
|
+
Return the norm of this element over ``base``.
|
|
1429
|
+
|
|
1430
|
+
This method does not check its input.
|
|
1431
|
+
Do not call it directly; use :meth:`norm` instead.
|
|
1432
|
+
|
|
1433
|
+
INPUT:
|
|
1434
|
+
|
|
1435
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1436
|
+
extension)
|
|
1437
|
+
|
|
1438
|
+
TESTS::
|
|
1439
|
+
|
|
1440
|
+
sage: # needs sage.rings.finite_rings
|
|
1441
|
+
sage: F = GF(11^2)
|
|
1442
|
+
sage: K = GF(11^6).over(F)
|
|
1443
|
+
sage: L = GF(11^18).over(K)
|
|
1444
|
+
sage: x = L.random_element()
|
|
1445
|
+
sage: x.norm(F) == x.norm().norm()
|
|
1446
|
+
True
|
|
1447
|
+
sage: for base in L.bases():
|
|
1448
|
+
....: x = L.random_element()
|
|
1449
|
+
....: y = L.random_element()
|
|
1450
|
+
....: assert(x.norm(base) == x.matrix(base).determinant())
|
|
1451
|
+
....: assert((x*y).norm(base) == x.norm(base) * y.norm(base))
|
|
1452
|
+
"""
|
|
1453
|
+
cdef RingExtensionWithBasis parent = self._parent
|
|
1454
|
+
cdef Parent b
|
|
1455
|
+
if base is parent:
|
|
1456
|
+
return self
|
|
1457
|
+
b = parent._base
|
|
1458
|
+
n = self._matrix(b).determinant()
|
|
1459
|
+
if base is b:
|
|
1460
|
+
return n
|
|
1461
|
+
return (<RingExtensionWithBasisElement>n)._norm(base)
|
|
1462
|
+
|
|
1463
|
+
def charpoly(self, base=None, var='x'):
|
|
1464
|
+
r"""
|
|
1465
|
+
Return the characteristic polynomial of this element over ``base``.
|
|
1466
|
+
|
|
1467
|
+
INPUT:
|
|
1468
|
+
|
|
1469
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1470
|
+
extension) or ``None``
|
|
1471
|
+
|
|
1472
|
+
EXAMPLES::
|
|
1473
|
+
|
|
1474
|
+
sage: # needs sage.rings.finite_rings
|
|
1475
|
+
sage: F = GF(5)
|
|
1476
|
+
sage: K.<a> = GF(5^3).over(F)
|
|
1477
|
+
sage: L.<b> = GF(5^6).over(K)
|
|
1478
|
+
sage: u = a/(1+b)
|
|
1479
|
+
sage: chi = u.charpoly(K); chi
|
|
1480
|
+
x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2
|
|
1481
|
+
|
|
1482
|
+
We check that the charpoly has coefficients in the base ring::
|
|
1483
|
+
|
|
1484
|
+
sage: chi.base_ring() # needs sage.rings.finite_rings
|
|
1485
|
+
Field in a with defining polynomial x^3 + 3*x + 3 over its base
|
|
1486
|
+
sage: chi.base_ring() is K # needs sage.rings.finite_rings
|
|
1487
|
+
True
|
|
1488
|
+
|
|
1489
|
+
and that it annihilates u::
|
|
1490
|
+
|
|
1491
|
+
sage: chi(u) # needs sage.rings.finite_rings
|
|
1492
|
+
0
|
|
1493
|
+
|
|
1494
|
+
Similarly, one can compute the characteristic polynomial over F::
|
|
1495
|
+
|
|
1496
|
+
sage: u.charpoly(F) # needs sage.rings.finite_rings
|
|
1497
|
+
x^6 + x^4 + 2*x^3 + 3*x + 4
|
|
1498
|
+
|
|
1499
|
+
A different variable name can be specified::
|
|
1500
|
+
|
|
1501
|
+
sage: u.charpoly(F, var='t') # needs sage.rings.finite_rings
|
|
1502
|
+
t^6 + t^4 + 2*t^3 + 3*t + 4
|
|
1503
|
+
|
|
1504
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1505
|
+
base of the extension::
|
|
1506
|
+
|
|
1507
|
+
sage: u.charpoly() # needs sage.rings.finite_rings
|
|
1508
|
+
x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2
|
|
1509
|
+
|
|
1510
|
+
Note that ``base`` must be an explicit base over which the
|
|
1511
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1512
|
+
|
|
1513
|
+
sage: u.charpoly(GF(5^2)) # needs sage.rings.finite_rings
|
|
1514
|
+
Traceback (most recent call last):
|
|
1515
|
+
...
|
|
1516
|
+
ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2
|
|
1517
|
+
|
|
1518
|
+
TESTS:
|
|
1519
|
+
|
|
1520
|
+
We check that the characteristic polynomial of an element in the base
|
|
1521
|
+
ring is a power of a polynomial of degree 1::
|
|
1522
|
+
|
|
1523
|
+
sage: S.<x> = K[] # needs sage.rings.finite_rings
|
|
1524
|
+
sage: u = K.random_element() # needs sage.rings.finite_rings
|
|
1525
|
+
sage: L(u).charpoly() == (x - u)^2 # needs sage.rings.finite_rings
|
|
1526
|
+
True
|
|
1527
|
+
"""
|
|
1528
|
+
return self.matrix(base).charpoly(var)
|
|
1529
|
+
|
|
1530
|
+
cpdef minpoly(self, base=None, var='x'):
|
|
1531
|
+
r"""
|
|
1532
|
+
Return the minimal polynomial of this element over ``base``.
|
|
1533
|
+
|
|
1534
|
+
INPUT:
|
|
1535
|
+
|
|
1536
|
+
- ``base`` -- a commutative ring (which might be itself an
|
|
1537
|
+
extension) or ``None``
|
|
1538
|
+
|
|
1539
|
+
EXAMPLES::
|
|
1540
|
+
|
|
1541
|
+
sage: # needs sage.rings.finite_rings
|
|
1542
|
+
sage: F = GF(5)
|
|
1543
|
+
sage: K.<a> = GF(5^3).over(F)
|
|
1544
|
+
sage: L.<b> = GF(5^6).over(K)
|
|
1545
|
+
sage: u = 1 / (a+b)
|
|
1546
|
+
sage: chi = u.minpoly(K); chi
|
|
1547
|
+
x^2 + (2*a + a^2)*x - 1 + a
|
|
1548
|
+
|
|
1549
|
+
We check that the minimal polynomial has coefficients in the base ring::
|
|
1550
|
+
|
|
1551
|
+
sage: chi.base_ring() # needs sage.rings.finite_rings
|
|
1552
|
+
Field in a with defining polynomial x^3 + 3*x + 3 over its base
|
|
1553
|
+
sage: chi.base_ring() is K # needs sage.rings.finite_rings
|
|
1554
|
+
True
|
|
1555
|
+
|
|
1556
|
+
and that it annihilates u::
|
|
1557
|
+
|
|
1558
|
+
sage: chi(u) # needs sage.rings.finite_rings
|
|
1559
|
+
0
|
|
1560
|
+
|
|
1561
|
+
Similarly, one can compute the minimal polynomial over F::
|
|
1562
|
+
|
|
1563
|
+
sage: u.minpoly(F) # needs sage.rings.finite_rings
|
|
1564
|
+
x^6 + 4*x^5 + x^4 + 2*x^2 + 3
|
|
1565
|
+
|
|
1566
|
+
A different variable name can be specified::
|
|
1567
|
+
|
|
1568
|
+
sage: u.minpoly(F, var='t') # needs sage.rings.finite_rings
|
|
1569
|
+
t^6 + 4*t^5 + t^4 + 2*t^2 + 3
|
|
1570
|
+
|
|
1571
|
+
If ``base`` is omitted, it is set to its default which is the
|
|
1572
|
+
base of the extension::
|
|
1573
|
+
|
|
1574
|
+
sage: u.minpoly() # needs sage.libs.singular sage.rings.finite_rings
|
|
1575
|
+
x^2 + (2*a + a^2)*x - 1 + a
|
|
1576
|
+
|
|
1577
|
+
Note that ``base`` must be an explicit base over which the
|
|
1578
|
+
extension has been defined (as listed by the method :meth:`bases`)::
|
|
1579
|
+
|
|
1580
|
+
sage: u.minpoly(GF(5^2)) # needs sage.rings.finite_rings
|
|
1581
|
+
Traceback (most recent call last):
|
|
1582
|
+
...
|
|
1583
|
+
ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2
|
|
1584
|
+
|
|
1585
|
+
TESTS:
|
|
1586
|
+
|
|
1587
|
+
We check that the minimal polynomial of an element in the base
|
|
1588
|
+
ring has degree 1::
|
|
1589
|
+
|
|
1590
|
+
sage: S.<x> = K[] # needs sage.rings.finite_rings
|
|
1591
|
+
sage: u = K.random_element() # needs sage.rings.finite_rings
|
|
1592
|
+
sage: L(u).minpoly() == x - u # needs sage.rings.finite_rings sage.libs.singular
|
|
1593
|
+
True
|
|
1594
|
+
|
|
1595
|
+
In a similar fashion, the minimal polynomial over `F` of an element
|
|
1596
|
+
of `K` should have degree 1 or 3::
|
|
1597
|
+
|
|
1598
|
+
sage: L(u).minpoly(F).degree() in [ 1, 3 ] # needs sage.rings.finite_rings sage.libs.singular
|
|
1599
|
+
True
|
|
1600
|
+
"""
|
|
1601
|
+
cdef RingExtensionWithBasis parent = self._parent
|
|
1602
|
+
|
|
1603
|
+
if base is None:
|
|
1604
|
+
mod = parent.modulus()
|
|
1605
|
+
S = mod.parent().quotient(mod)
|
|
1606
|
+
try:
|
|
1607
|
+
return S(list(self.vector())).minpoly()
|
|
1608
|
+
except NotImplementedError:
|
|
1609
|
+
pass # fall back to generic code below
|
|
1610
|
+
|
|
1611
|
+
from sage.modules.free_module import FreeModule
|
|
1612
|
+
cdef MapRelativeRingToFreeModule j
|
|
1613
|
+
|
|
1614
|
+
base = parent._check_base(base)
|
|
1615
|
+
if not (parent._is_finite_over(base) and parent._is_free_over(base)):
|
|
1616
|
+
raise ValueError("the extension is not finite free")
|
|
1617
|
+
if base not in Fields():
|
|
1618
|
+
raise NotImplementedError("minpoly is only implemented when the base is a field")
|
|
1619
|
+
K = backend_parent(base)
|
|
1620
|
+
degree = parent._degree_over(base)
|
|
1621
|
+
_, _, j = parent._free_module(base, map=True)
|
|
1622
|
+
V = FreeModule(K, degree)
|
|
1623
|
+
vector = [K(1)] + (degree-1)*[K(0)]
|
|
1624
|
+
vectors = [vector]
|
|
1625
|
+
W = V.span(vectors)
|
|
1626
|
+
elt = self
|
|
1627
|
+
while True:
|
|
1628
|
+
vector = V(j.backend_coefficients(elt))
|
|
1629
|
+
if vector in W: break
|
|
1630
|
+
vectors.append(vector)
|
|
1631
|
+
W += V.span([vector])
|
|
1632
|
+
elt *= self
|
|
1633
|
+
W = V.span_of_basis(vectors)
|
|
1634
|
+
coeffs = [ -c for c in W.coordinate_vector(vector) ] + [K(1)]
|
|
1635
|
+
return PolynomialRing(base, name=var)(coeffs)
|