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,2122 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-modules
|
|
2
|
+
# sage.doctest: needs sage.combinat
|
|
3
|
+
"""
|
|
4
|
+
Lie Algebra Elements
|
|
5
|
+
|
|
6
|
+
AUTHORS:
|
|
7
|
+
|
|
8
|
+
- Travis Scrimshaw (2013-05-04): Initial implementation
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# ****************************************************************************
|
|
12
|
+
# Copyright (C) 2013-2017 Travis Scrimshaw <tcscrims at gmail.com>
|
|
13
|
+
#
|
|
14
|
+
# This program is free software: you can redistribute it and/or modify
|
|
15
|
+
# it under the terms of the GNU General Public License as published by
|
|
16
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
17
|
+
# (at your option) any later version.
|
|
18
|
+
# https://www.gnu.org/licenses/
|
|
19
|
+
# ****************************************************************************
|
|
20
|
+
|
|
21
|
+
from cpython.object cimport Py_EQ, Py_NE, Py_GT, Py_GE
|
|
22
|
+
|
|
23
|
+
from sage.misc.repr import repr_lincomb
|
|
24
|
+
from sage.structure.element cimport have_same_parent, parent
|
|
25
|
+
from sage.structure.coerce cimport coercion_model
|
|
26
|
+
from sage.structure.element_wrapper cimport ElementWrapper
|
|
27
|
+
from sage.structure.richcmp cimport richcmp, richcmp_not_equal
|
|
28
|
+
from sage.data_structures.blas_dict cimport axpy, add, negate, scal
|
|
29
|
+
|
|
30
|
+
# TODO: Do we want a dense version?
|
|
31
|
+
cdef class LieAlgebraElement(IndexedFreeModuleElement):
|
|
32
|
+
"""
|
|
33
|
+
A Lie algebra element.
|
|
34
|
+
"""
|
|
35
|
+
# Need to bypass the coercion model
|
|
36
|
+
def __mul__(left, right):
|
|
37
|
+
"""
|
|
38
|
+
If we are multiplying two nonzero elements, automatically
|
|
39
|
+
lift up to the universal enveloping algebra.
|
|
40
|
+
|
|
41
|
+
EXAMPLES::
|
|
42
|
+
|
|
43
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
|
|
44
|
+
sage: y*x
|
|
45
|
+
x*y - z
|
|
46
|
+
|
|
47
|
+
Check that actions work::
|
|
48
|
+
|
|
49
|
+
sage: L = lie_algebras.VirasoroAlgebra(QQ)
|
|
50
|
+
sage: d = L.basis()
|
|
51
|
+
sage: M = L.chargeless_representation(1/2, 3/4)
|
|
52
|
+
sage: d[-5] * M.basis()[10]
|
|
53
|
+
-47/4*v[5]
|
|
54
|
+
|
|
55
|
+
TESTS::
|
|
56
|
+
|
|
57
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
|
|
58
|
+
sage: int(3) * x
|
|
59
|
+
3*x
|
|
60
|
+
sage: x * int(3)
|
|
61
|
+
3*x
|
|
62
|
+
sage: y * x.lift()
|
|
63
|
+
x*y - z
|
|
64
|
+
sage: y.lift() * x
|
|
65
|
+
x*y - z
|
|
66
|
+
"""
|
|
67
|
+
try:
|
|
68
|
+
# Try the normal coercion first
|
|
69
|
+
return IndexedFreeModuleElement.__mul__(left, right)
|
|
70
|
+
except TypeError:
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
# Handle the case of right multiplication by scalar
|
|
75
|
+
if isinstance(left, IndexedFreeModuleElement):
|
|
76
|
+
R = (<IndexedFreeModuleElement>left)._parent._base
|
|
77
|
+
x = R.coerce(right)
|
|
78
|
+
return IndexedFreeModuleElement.__mul__(left, x)
|
|
79
|
+
except (TypeError, KeyError):
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
# Handle the case of left multiplication by scalar
|
|
84
|
+
if isinstance(right, IndexedFreeModuleElement):
|
|
85
|
+
R = (<IndexedFreeModuleElement>right)._parent._base
|
|
86
|
+
x = R.coerce(left)
|
|
87
|
+
return IndexedFreeModuleElement.__mul__(x, right)
|
|
88
|
+
except (TypeError, KeyError):
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
# Lift up to the UEA and try multiplication there
|
|
92
|
+
# We will eventually want to lift stuff up anyways,
|
|
93
|
+
# so just do it here.
|
|
94
|
+
if isinstance(left, LieAlgebraElement):
|
|
95
|
+
left = (<LieAlgebraElement> left).lift()
|
|
96
|
+
if isinstance(right, LieAlgebraElement):
|
|
97
|
+
right = (<LieAlgebraElement> right).lift()
|
|
98
|
+
return left * right
|
|
99
|
+
|
|
100
|
+
def _im_gens_(self, codomain, im_gens, base_map=None):
|
|
101
|
+
"""
|
|
102
|
+
Return the image of ``self`` in ``codomain`` under the
|
|
103
|
+
map that sends the generators of the parent of ``self``
|
|
104
|
+
to the elements of the tuple ``im_gens``.
|
|
105
|
+
|
|
106
|
+
EXAMPLES::
|
|
107
|
+
|
|
108
|
+
sage: L = LieAlgebra(QQ, 'x,y,z')
|
|
109
|
+
sage: Lyn = L.Lyndon()
|
|
110
|
+
sage: H = L.Hall()
|
|
111
|
+
doctest:warning...:
|
|
112
|
+
FutureWarning: The Hall basis has not been fully proven correct, but currently no bugs are known
|
|
113
|
+
See https://github.com/sagemath/sage/issues/16823 for details.
|
|
114
|
+
sage: elt = Lyn.an_element()
|
|
115
|
+
sage: elt._im_gens_(H, H.gens())
|
|
116
|
+
x + y + z
|
|
117
|
+
sage: x, y, z = Lyn.gens()
|
|
118
|
+
sage: elt = x.bracket(y) + y.bracket(z) + z.bracket(x); elt
|
|
119
|
+
[x, y] - [x, z] + [y, z]
|
|
120
|
+
sage: elt._im_gens_(H, H.gens())
|
|
121
|
+
[x, y] - [x, z] + [y, z]
|
|
122
|
+
sage: xx, yy, zz = H.gens()
|
|
123
|
+
sage: elt._im_gens_(H, [xx, yy, xx])
|
|
124
|
+
0
|
|
125
|
+
sage: elt._im_gens_(H, [xx, yy, yy+zz])
|
|
126
|
+
-[x, z] + [y, z]
|
|
127
|
+
sage: L2 = LieAlgebra(QQ, 'a,b')
|
|
128
|
+
sage: Lyn2 = L2.Lyndon()
|
|
129
|
+
sage: a, b = Lyn2.gens()
|
|
130
|
+
sage: elt._im_gens_(Lyn2, [a, b, a.bracket(b)])
|
|
131
|
+
-[a, [a, b]] + [a, b] - [[a, b], b]
|
|
132
|
+
"""
|
|
133
|
+
s = codomain.zero()
|
|
134
|
+
if not self: # If we are 0
|
|
135
|
+
return s
|
|
136
|
+
names = self._parent.variable_names()
|
|
137
|
+
if base_map is None:
|
|
138
|
+
def base_map(x):
|
|
139
|
+
return x
|
|
140
|
+
|
|
141
|
+
return codomain.sum(base_map(c) * t._im_gens_(codomain, im_gens, names)
|
|
142
|
+
for t, c in self._monomial_coefficients.items())
|
|
143
|
+
|
|
144
|
+
cpdef lift(self):
|
|
145
|
+
"""
|
|
146
|
+
Lift ``self`` to the universal enveloping algebra.
|
|
147
|
+
|
|
148
|
+
EXAMPLES::
|
|
149
|
+
|
|
150
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'):{'z':1}})
|
|
151
|
+
sage: x.lift().parent() == L.universal_enveloping_algebra()
|
|
152
|
+
True
|
|
153
|
+
|
|
154
|
+
TESTS::
|
|
155
|
+
|
|
156
|
+
sage: L = lie_algebras.pwitt(GF(5), 5); L
|
|
157
|
+
The 5-Witt Lie algebra over Finite Field of size 5
|
|
158
|
+
sage: x = L.basis()[2]
|
|
159
|
+
sage: y = L.basis()[3]
|
|
160
|
+
sage: x.lift()
|
|
161
|
+
b2
|
|
162
|
+
sage: y.lift()
|
|
163
|
+
b3
|
|
164
|
+
sage: x * y
|
|
165
|
+
b2*b3
|
|
166
|
+
sage: y * x
|
|
167
|
+
b2*b3 + b0
|
|
168
|
+
|
|
169
|
+
sage: L = lie_algebras.regular_vector_fields(QQ)
|
|
170
|
+
sage: L.an_element()
|
|
171
|
+
d[-1] + d[0] - 3*d[1]
|
|
172
|
+
sage: L.an_element().lift()
|
|
173
|
+
PBW[-1] + PBW[0] - 3*PBW[1]
|
|
174
|
+
"""
|
|
175
|
+
UEA = self._parent.universal_enveloping_algebra()
|
|
176
|
+
s = UEA.zero()
|
|
177
|
+
if not self:
|
|
178
|
+
return s
|
|
179
|
+
# Special hook for when the index set of the parent of ``self``
|
|
180
|
+
# does not match the generators index set of the UEA.
|
|
181
|
+
if hasattr(self._parent, '_UEA_names_map'):
|
|
182
|
+
names_map = self._parent._UEA_names_map
|
|
183
|
+
gen_dict = UEA.gens_dict()
|
|
184
|
+
for t, c in self._monomial_coefficients.items():
|
|
185
|
+
s += c * gen_dict[names_map[t]]
|
|
186
|
+
else:
|
|
187
|
+
try:
|
|
188
|
+
gen_dict = UEA.algebra_generators()
|
|
189
|
+
except (TypeError, AttributeError):
|
|
190
|
+
gen_dict = UEA.gens_dict()
|
|
191
|
+
for t, c in self._monomial_coefficients.items():
|
|
192
|
+
s += c * gen_dict[t]
|
|
193
|
+
return s
|
|
194
|
+
|
|
195
|
+
cdef class LieAlgebraElementWrapper(ElementWrapper):
|
|
196
|
+
"""
|
|
197
|
+
Wrap an element as a Lie algebra element.
|
|
198
|
+
|
|
199
|
+
TESTS:
|
|
200
|
+
|
|
201
|
+
We check comparisons::
|
|
202
|
+
|
|
203
|
+
sage: # needs sage.graphs
|
|
204
|
+
sage: L = lie_algebras.sl(QQ, 2, representation='matrix')
|
|
205
|
+
sage: L.bracket(L.gen(0), L.gen(1)) == -L.bracket(L.gen(1), L.gen(0))
|
|
206
|
+
True
|
|
207
|
+
|
|
208
|
+
The next doctests show similar behavior, although on elements of
|
|
209
|
+
other classes::
|
|
210
|
+
|
|
211
|
+
sage: # needs sage.graphs
|
|
212
|
+
sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3)
|
|
213
|
+
sage: L.bracket(L.gen(0), L.gen(1)) == -L.bracket(L.gen(1), L.gen(0))
|
|
214
|
+
True
|
|
215
|
+
sage: L = lie_algebras.three_dimensional_by_rank(QQ, 1)
|
|
216
|
+
sage: L.bracket(L.gen(0), L.gen(1)) == -L.bracket(L.gen(1), L.gen(0))
|
|
217
|
+
True
|
|
218
|
+
|
|
219
|
+
Check inequality::
|
|
220
|
+
|
|
221
|
+
sage: L = lie_algebras.sl(QQ, 2, representation='matrix')
|
|
222
|
+
sage: L.bracket(L.gen(0), L.gen(1)) != -L.bracket(L.gen(1), L.gen(0))
|
|
223
|
+
False
|
|
224
|
+
sage: L.zero() == 0
|
|
225
|
+
True
|
|
226
|
+
sage: L.zero() != 0
|
|
227
|
+
False
|
|
228
|
+
|
|
229
|
+
The next doctests show similar behavior, although on elements of
|
|
230
|
+
other classes::
|
|
231
|
+
|
|
232
|
+
sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3)
|
|
233
|
+
sage: L.bracket(L.gen(0), L.gen(1)) != -L.bracket(L.gen(1), L.gen(0))
|
|
234
|
+
False
|
|
235
|
+
sage: L.an_element()
|
|
236
|
+
X + Y + Z
|
|
237
|
+
sage: L.an_element() == 0
|
|
238
|
+
False
|
|
239
|
+
sage: L.an_element() != 0
|
|
240
|
+
True
|
|
241
|
+
|
|
242
|
+
sage: L = lie_algebras.three_dimensional_by_rank(QQ, 1)
|
|
243
|
+
sage: L.bracket(L.gen(0), L.gen(1)) != -L.bracket(L.gen(1), L.gen(0))
|
|
244
|
+
False
|
|
245
|
+
sage: L.zero() == 0
|
|
246
|
+
True
|
|
247
|
+
sage: L.zero() != 0
|
|
248
|
+
False
|
|
249
|
+
sage: L.zero() >= 0
|
|
250
|
+
True
|
|
251
|
+
sage: L.zero() < 0
|
|
252
|
+
False
|
|
253
|
+
|
|
254
|
+
We check the display of elements::
|
|
255
|
+
|
|
256
|
+
sage: R = FreeAlgebra(QQ, 3, 'x')
|
|
257
|
+
sage: L.<l0,l1,l2> = LieAlgebra(associative=R.gens())
|
|
258
|
+
sage: elt = l0 + l1
|
|
259
|
+
sage: elt
|
|
260
|
+
x0 + x1
|
|
261
|
+
sage: latex(elt)
|
|
262
|
+
x_{0} + x_{1}
|
|
263
|
+
|
|
264
|
+
sage: s = SymmetricFunctions(QQ).s()
|
|
265
|
+
sage: L = LieAlgebra(associative=s)
|
|
266
|
+
sage: P = Partition([4,2,2,1])
|
|
267
|
+
sage: x = L.basis()[P]
|
|
268
|
+
sage: ascii_art(x)
|
|
269
|
+
s
|
|
270
|
+
****
|
|
271
|
+
**
|
|
272
|
+
**
|
|
273
|
+
*
|
|
274
|
+
sage: unicode_art(x)
|
|
275
|
+
s
|
|
276
|
+
┌┬┬┬┐
|
|
277
|
+
├┼┼┴┘
|
|
278
|
+
├┼┤
|
|
279
|
+
├┼┘
|
|
280
|
+
└┘
|
|
281
|
+
"""
|
|
282
|
+
def __bool__(self):
|
|
283
|
+
"""
|
|
284
|
+
Return if ``self`` is nonzero.
|
|
285
|
+
|
|
286
|
+
EXAMPLES::
|
|
287
|
+
|
|
288
|
+
sage: R = FreeAlgebra(QQ, 3, 'x,y,z')
|
|
289
|
+
sage: L.<x,y,z> = LieAlgebra(associative=R.gens())
|
|
290
|
+
sage: bool(L.zero())
|
|
291
|
+
False
|
|
292
|
+
sage: bool(x + y)
|
|
293
|
+
True
|
|
294
|
+
"""
|
|
295
|
+
return bool(self.value)
|
|
296
|
+
|
|
297
|
+
cpdef _add_(self, right):
|
|
298
|
+
"""
|
|
299
|
+
Add ``self`` and ``rhs``.
|
|
300
|
+
|
|
301
|
+
EXAMPLES::
|
|
302
|
+
|
|
303
|
+
sage: R = FreeAlgebra(QQ, 3, 'x,y,z')
|
|
304
|
+
sage: L.<x,y,z> = LieAlgebra(associative=R.gens())
|
|
305
|
+
sage: x + y
|
|
306
|
+
x + y
|
|
307
|
+
"""
|
|
308
|
+
return type(self)(self._parent, self.value + right.value)
|
|
309
|
+
|
|
310
|
+
cpdef _sub_(self, right):
|
|
311
|
+
"""
|
|
312
|
+
Subtract ``self`` and ``rhs``.
|
|
313
|
+
|
|
314
|
+
EXAMPLES::
|
|
315
|
+
|
|
316
|
+
sage: R = FreeAlgebra(QQ, 3, 'x,y,z')
|
|
317
|
+
sage: L.<x,y,z> = LieAlgebra(associative=R.gens())
|
|
318
|
+
sage: x - y
|
|
319
|
+
x - y
|
|
320
|
+
"""
|
|
321
|
+
return type(self)(self._parent, self.value - right.value)
|
|
322
|
+
|
|
323
|
+
# Need to bypass the coercion model
|
|
324
|
+
def __mul__(left, right):
|
|
325
|
+
"""
|
|
326
|
+
If we are multiplying two nonzero elements, automatically
|
|
327
|
+
lift up to the universal enveloping algebra.
|
|
328
|
+
|
|
329
|
+
.. TODO::
|
|
330
|
+
|
|
331
|
+
Write more tests for this method.
|
|
332
|
+
|
|
333
|
+
EXAMPLES::
|
|
334
|
+
|
|
335
|
+
sage: # needs sage.groups
|
|
336
|
+
sage: S = SymmetricGroup(3).algebra(QQ)
|
|
337
|
+
sage: L = LieAlgebra(associative=S)
|
|
338
|
+
sage: x = L.gen(2); x
|
|
339
|
+
(1,2,3)
|
|
340
|
+
sage: y = L.gen(3); y
|
|
341
|
+
(2,3)
|
|
342
|
+
sage: u = x*3; u
|
|
343
|
+
3*(1,2,3)
|
|
344
|
+
sage: parent(u) == L
|
|
345
|
+
True
|
|
346
|
+
sage: u = x*(3/2); u
|
|
347
|
+
3/2*(1,2,3)
|
|
348
|
+
sage: parent(u) == L
|
|
349
|
+
True
|
|
350
|
+
sage: elt = x*y - y*x; elt
|
|
351
|
+
b4 - b5
|
|
352
|
+
sage: xp, yp = x.lift_associative(), y.lift_associative()
|
|
353
|
+
sage: eltp = xp*yp - yp*xp; eltp
|
|
354
|
+
-(1,2) + (1,3)
|
|
355
|
+
sage: G = list(S.basis())
|
|
356
|
+
sage: G[4] - G[5]
|
|
357
|
+
-(1,2) + (1,3)
|
|
358
|
+
|
|
359
|
+
TESTS::
|
|
360
|
+
|
|
361
|
+
sage: # needs sage.groups
|
|
362
|
+
sage: G = SymmetricGroup(3)
|
|
363
|
+
sage: S = GroupAlgebra(G, QQ)
|
|
364
|
+
sage: L.<x,y> = LieAlgebra(associative=S.gens())
|
|
365
|
+
sage: int(3) * x
|
|
366
|
+
3*(1,2,3)
|
|
367
|
+
sage: y * int(3)
|
|
368
|
+
3*(1,2)
|
|
369
|
+
"""
|
|
370
|
+
try:
|
|
371
|
+
# Try the normal coercion first
|
|
372
|
+
return ElementWrapper.__mul__(left, right)
|
|
373
|
+
except TypeError:
|
|
374
|
+
pass
|
|
375
|
+
|
|
376
|
+
try:
|
|
377
|
+
# Handle the case of right multiplication by scalar
|
|
378
|
+
if isinstance(left, LieAlgebraElementWrapper):
|
|
379
|
+
R = (<LieAlgebraElementWrapper>left)._parent._base
|
|
380
|
+
x = R.coerce(right)
|
|
381
|
+
return ElementWrapper.__mul__(left, x)
|
|
382
|
+
except (TypeError, KeyError):
|
|
383
|
+
pass
|
|
384
|
+
|
|
385
|
+
try:
|
|
386
|
+
# Handle the case of left multiplication by scalar
|
|
387
|
+
if isinstance(right, LieAlgebraElementWrapper):
|
|
388
|
+
R = (<LieAlgebraElementWrapper>right)._parent._base
|
|
389
|
+
x = R.coerce(left)
|
|
390
|
+
return ElementWrapper.__mul__(x, right)
|
|
391
|
+
except (TypeError, KeyError):
|
|
392
|
+
pass
|
|
393
|
+
|
|
394
|
+
# Lift up to the UEA and try multiplication there
|
|
395
|
+
# We will eventually want to lift stuff up anyways,
|
|
396
|
+
# so just do it here.
|
|
397
|
+
if isinstance(left, LieAlgebraElementWrapper):
|
|
398
|
+
left = (<LieAlgebraElementWrapper> left).lift()
|
|
399
|
+
if isinstance(right, LieAlgebraElementWrapper):
|
|
400
|
+
right = (<LieAlgebraElementWrapper> right).lift()
|
|
401
|
+
return left * right
|
|
402
|
+
|
|
403
|
+
def __truediv__(self, x):
|
|
404
|
+
"""
|
|
405
|
+
Division by coefficients.
|
|
406
|
+
|
|
407
|
+
EXAMPLES::
|
|
408
|
+
|
|
409
|
+
sage: # needs sage.graphs
|
|
410
|
+
sage: L = lie_algebras.Heisenberg(QQ, 3)
|
|
411
|
+
sage: x = L.an_element(); x
|
|
412
|
+
p1
|
|
413
|
+
sage: x / 2
|
|
414
|
+
1/2*p1
|
|
415
|
+
"""
|
|
416
|
+
return self * (~x)
|
|
417
|
+
|
|
418
|
+
cpdef _acted_upon_(self, scalar, bint self_on_left):
|
|
419
|
+
"""
|
|
420
|
+
Return the action of a scalar on ``self``.
|
|
421
|
+
|
|
422
|
+
EXAMPLES::
|
|
423
|
+
|
|
424
|
+
sage: R = FreeAlgebra(QQ, 3, 'x,y,z')
|
|
425
|
+
sage: L.<x,y,z> = LieAlgebra(associative=R.gens())
|
|
426
|
+
sage: 3*x
|
|
427
|
+
3*x
|
|
428
|
+
sage: parent(3*x) == parent(x)
|
|
429
|
+
True
|
|
430
|
+
sage: x / 2
|
|
431
|
+
1/2*x
|
|
432
|
+
sage: y * (1/2)
|
|
433
|
+
1/2*y
|
|
434
|
+
sage: y * 1/2
|
|
435
|
+
1/2*y
|
|
436
|
+
sage: 1/2 * y
|
|
437
|
+
1/2*y
|
|
438
|
+
sage: QQ(1/2) * y
|
|
439
|
+
1/2*y
|
|
440
|
+
"""
|
|
441
|
+
# This was copied and IDK if it still applies (TCS):
|
|
442
|
+
# With the current design, the coercion model does not have
|
|
443
|
+
# enough information to detect apriori that this method only
|
|
444
|
+
# accepts scalars; so it tries on some elements(), and we need
|
|
445
|
+
# to make sure to report an error.
|
|
446
|
+
scalar_parent = parent(scalar)
|
|
447
|
+
if scalar_parent != self._parent.base_ring():
|
|
448
|
+
# Temporary needed by coercion (see Polynomial/FractionField tests).
|
|
449
|
+
if self._parent.base_ring().has_coerce_map_from(scalar_parent):
|
|
450
|
+
scalar = self._parent.base_ring()(scalar)
|
|
451
|
+
else:
|
|
452
|
+
return None
|
|
453
|
+
if self_on_left:
|
|
454
|
+
return type(self)(self._parent, self.value * scalar)
|
|
455
|
+
return type(self)(self._parent, scalar * self.value)
|
|
456
|
+
|
|
457
|
+
def __neg__(self):
|
|
458
|
+
"""
|
|
459
|
+
Return the negation of ``self``.
|
|
460
|
+
|
|
461
|
+
EXAMPLES::
|
|
462
|
+
|
|
463
|
+
sage: R = FreeAlgebra(QQ, 3, 'x,y,z')
|
|
464
|
+
sage: L.<x,y,z> = LieAlgebra(associative=R.gens())
|
|
465
|
+
sage: -x
|
|
466
|
+
-x
|
|
467
|
+
"""
|
|
468
|
+
return type(self)(self._parent, -self.value)
|
|
469
|
+
|
|
470
|
+
def __getitem__(self, i):
|
|
471
|
+
"""
|
|
472
|
+
Redirect the ``__getitem__()`` to the wrapped element.
|
|
473
|
+
|
|
474
|
+
EXAMPLES::
|
|
475
|
+
|
|
476
|
+
sage: # needs sage.graphs
|
|
477
|
+
sage: L = lie_algebras.sl(QQ, 2, representation='matrix')
|
|
478
|
+
sage: m = L.gen(0)
|
|
479
|
+
sage: m[0,0]
|
|
480
|
+
0
|
|
481
|
+
sage: m[0][1]
|
|
482
|
+
1
|
|
483
|
+
"""
|
|
484
|
+
return self.value.__getitem__(i)
|
|
485
|
+
|
|
486
|
+
def __iter__(self):
|
|
487
|
+
"""
|
|
488
|
+
Iterate over ``self``.
|
|
489
|
+
|
|
490
|
+
EXAMPLES::
|
|
491
|
+
|
|
492
|
+
sage: # needs sage.groups
|
|
493
|
+
sage: G = SymmetricGroup(3)
|
|
494
|
+
sage: S = G.algebra(QQ)
|
|
495
|
+
sage: L = LieAlgebra(associative=S)
|
|
496
|
+
sage: x = L.an_element() + L.basis()[G.one()]
|
|
497
|
+
sage: x
|
|
498
|
+
2*() + (2,3) + (1,2) + (1,2,3) + (1,3,2) + (1,3)
|
|
499
|
+
sage: sorted(x)
|
|
500
|
+
[((), 2), ((2,3), 1), ((1,2), 1), ((1,2,3), 1),
|
|
501
|
+
((1,3,2), 1), ((1,3), 1)]
|
|
502
|
+
"""
|
|
503
|
+
cdef dict d = self.value.monomial_coefficients(copy=False)
|
|
504
|
+
yield from d.items()
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
# TODO: Also used for vectors, find a better name
|
|
508
|
+
cdef class LieAlgebraMatrixWrapper(LieAlgebraElementWrapper):
|
|
509
|
+
"""
|
|
510
|
+
Lie algebra element wrapper around a matrix.
|
|
511
|
+
"""
|
|
512
|
+
def __init__(self, parent, value):
|
|
513
|
+
"""
|
|
514
|
+
Initialize ``self``.
|
|
515
|
+
|
|
516
|
+
EXAMPLES::
|
|
517
|
+
|
|
518
|
+
sage: # needs sage.graphs
|
|
519
|
+
sage: L = lie_algebras.Heisenberg(QQ, 1, representation='matrix')
|
|
520
|
+
sage: z = L.z()
|
|
521
|
+
sage: z.value.is_immutable()
|
|
522
|
+
True
|
|
523
|
+
"""
|
|
524
|
+
value.set_immutable() # Make the matrix immutable for hashing
|
|
525
|
+
LieAlgebraElementWrapper.__init__(self, parent, value)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
cdef class LieSubalgebraElementWrapper(LieAlgebraElementWrapper):
|
|
529
|
+
r"""
|
|
530
|
+
Wrap an element of the ambient Lie algebra as an element.
|
|
531
|
+
"""
|
|
532
|
+
def __init__(self, parent, value):
|
|
533
|
+
"""
|
|
534
|
+
Initialize ``self``.
|
|
535
|
+
|
|
536
|
+
TESTS::
|
|
537
|
+
|
|
538
|
+
sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}})
|
|
539
|
+
sage: S = L.subalgebra([X, Y])
|
|
540
|
+
sage: TestSuite(S(X)).run()
|
|
541
|
+
"""
|
|
542
|
+
LieAlgebraElementWrapper.__init__(self, parent, value)
|
|
543
|
+
self._monomial_coefficients = None
|
|
544
|
+
|
|
545
|
+
def __getitem__(self, i):
|
|
546
|
+
r"""
|
|
547
|
+
Return the coefficient of ``self`` indexed by ``i``.
|
|
548
|
+
|
|
549
|
+
EXAMPLES::
|
|
550
|
+
|
|
551
|
+
sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}})
|
|
552
|
+
sage: S = L.subalgebra([X, Y])
|
|
553
|
+
sage: S.indices()
|
|
554
|
+
{'X', 'Y', 'Z'}
|
|
555
|
+
sage: el = S(2*Y + 9*Z)
|
|
556
|
+
sage: el['Y']
|
|
557
|
+
2
|
|
558
|
+
sage: el['Z']
|
|
559
|
+
9
|
|
560
|
+
"""
|
|
561
|
+
if self._monomial_coefficients is None:
|
|
562
|
+
# This sets _monomial_coefficients
|
|
563
|
+
self.monomial_coefficients(copy=False)
|
|
564
|
+
try:
|
|
565
|
+
return self._monomial_coefficients[i]
|
|
566
|
+
except KeyError:
|
|
567
|
+
return self._parent.base_ring().zero()
|
|
568
|
+
|
|
569
|
+
def _bracket_(self, x):
|
|
570
|
+
"""
|
|
571
|
+
Return the Lie bracket ``[self, x]``.
|
|
572
|
+
|
|
573
|
+
Assumes ``x`` and ``self`` have the same parent.
|
|
574
|
+
|
|
575
|
+
INPUT:
|
|
576
|
+
|
|
577
|
+
- ``x`` -- an element of the same Lie subalgebra as ``self``
|
|
578
|
+
|
|
579
|
+
EXAMPLES::
|
|
580
|
+
|
|
581
|
+
sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}})
|
|
582
|
+
sage: S = L.subalgebra([X, Y])
|
|
583
|
+
sage: S(X)._bracket_(S(Y))
|
|
584
|
+
Z
|
|
585
|
+
"""
|
|
586
|
+
x_lift = (<LieSubalgebraElementWrapper> x).value
|
|
587
|
+
return type(self)(self._parent, self.value._bracket_(x_lift))
|
|
588
|
+
|
|
589
|
+
def _vector_(self, sparse=False, order=None):
|
|
590
|
+
r"""
|
|
591
|
+
Return the vector in ``g.module()`` corresponding to the
|
|
592
|
+
element ``self`` of ``g`` (where ``g`` is the parent of ``self``).
|
|
593
|
+
|
|
594
|
+
EXAMPLES::
|
|
595
|
+
|
|
596
|
+
sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
|
|
597
|
+
sage: S = L.subalgebra([X, Y])
|
|
598
|
+
sage: S.basis()
|
|
599
|
+
Finite family {'X': X, 'Y': Y, 'Z': 3*Z}
|
|
600
|
+
sage: S(2*Y + 9*Z).to_vector()
|
|
601
|
+
(0, 2, 9)
|
|
602
|
+
sage: S2 = L.subalgebra([Y, Z])
|
|
603
|
+
sage: S2.basis()
|
|
604
|
+
Finite family {'Y': Y, 'Z': Z}
|
|
605
|
+
sage: S2(2*Y + 9*Z).to_vector()
|
|
606
|
+
(0, 2, 9)
|
|
607
|
+
|
|
608
|
+
TESTS::
|
|
609
|
+
|
|
610
|
+
sage: L.<X,Y> = LieAlgebra(ZZ, abelian=True)
|
|
611
|
+
sage: S = L.subalgebra(X)
|
|
612
|
+
sage: S(X).to_vector() in S.module()
|
|
613
|
+
True
|
|
614
|
+
sage: S(X).to_vector().parent() is S.module()
|
|
615
|
+
True
|
|
616
|
+
"""
|
|
617
|
+
return self._parent.module()(self.value.to_vector(sparse=sparse))
|
|
618
|
+
|
|
619
|
+
to_vector = _vector_
|
|
620
|
+
|
|
621
|
+
cpdef dict monomial_coefficients(self, bint copy=True):
|
|
622
|
+
r"""
|
|
623
|
+
Return a dictionary whose keys are indices of basis elements
|
|
624
|
+
in the support of ``self`` and whose values are the
|
|
625
|
+
corresponding coefficients.
|
|
626
|
+
|
|
627
|
+
INPUT:
|
|
628
|
+
|
|
629
|
+
- ``copy`` -- boolean (default: ``True``); if ``self`` is internally
|
|
630
|
+
represented by a dictionary ``d``, then make a copy of ``d``;
|
|
631
|
+
if ``False``, then this can cause undesired behavior by
|
|
632
|
+
mutating ``d``
|
|
633
|
+
|
|
634
|
+
EXAMPLES::
|
|
635
|
+
|
|
636
|
+
sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
|
|
637
|
+
sage: S = L.subalgebra([X, Y])
|
|
638
|
+
sage: S(2*Y + 9*Z).monomial_coefficients()
|
|
639
|
+
{'Y': 2, 'Z': 3}
|
|
640
|
+
sage: S2 = L.subalgebra([Y, Z])
|
|
641
|
+
sage: S2(2*Y + 9*Z).monomial_coefficients()
|
|
642
|
+
{'Y': 2, 'Z': 9}
|
|
643
|
+
"""
|
|
644
|
+
cdef Py_ssize_t k
|
|
645
|
+
indices = self._parent._indices
|
|
646
|
+
if self._monomial_coefficients is None:
|
|
647
|
+
sm = self._parent.module()
|
|
648
|
+
v = sm.coordinate_vector(self.to_vector())
|
|
649
|
+
self._monomial_coefficients = {indices[k]: v[k]
|
|
650
|
+
for k in range(len(v)) if v[k]}
|
|
651
|
+
if copy:
|
|
652
|
+
return dict(self._monomial_coefficients)
|
|
653
|
+
return self._monomial_coefficients
|
|
654
|
+
|
|
655
|
+
cpdef _add_(self, right):
|
|
656
|
+
"""
|
|
657
|
+
Add ``self`` and ``rhs``.
|
|
658
|
+
|
|
659
|
+
EXAMPLES::
|
|
660
|
+
|
|
661
|
+
sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
|
|
662
|
+
sage: S = L.subalgebra([X, Y])
|
|
663
|
+
sage: a = S(2*Y + 12*Z)
|
|
664
|
+
sage: b = S(X + 2*Y)
|
|
665
|
+
sage: (a + b).monomial_coefficients()
|
|
666
|
+
{'X': 1, 'Y': 4, 'Z': 4}
|
|
667
|
+
sage: a.monomial_coefficients() # We set a._monomial_coefficients
|
|
668
|
+
{'Y': 2, 'Z': 4}
|
|
669
|
+
sage: b.monomial_coefficients() # We set b._monomial_coefficients
|
|
670
|
+
{'X': 1, 'Y': 2}
|
|
671
|
+
sage: (a + b).monomial_coefficients() # This is now computed from a and b
|
|
672
|
+
{'X': 1, 'Y': 4, 'Z': 4}
|
|
673
|
+
"""
|
|
674
|
+
cdef LieSubalgebraElementWrapper ret, other = <LieSubalgebraElementWrapper> right
|
|
675
|
+
ret = type(self)(self._parent, self.value + other.value)
|
|
676
|
+
if self._monomial_coefficients is not None and other._monomial_coefficients is not None:
|
|
677
|
+
mc = add(self._monomial_coefficients, other._monomial_coefficients)
|
|
678
|
+
ret._monomial_coefficients = mc
|
|
679
|
+
return ret
|
|
680
|
+
|
|
681
|
+
cpdef _sub_(self, right):
|
|
682
|
+
"""
|
|
683
|
+
Subtract ``self`` and ``rhs``.
|
|
684
|
+
|
|
685
|
+
EXAMPLES::
|
|
686
|
+
|
|
687
|
+
sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
|
|
688
|
+
sage: S = L.subalgebra([X, Y])
|
|
689
|
+
sage: a = S(2*Y + 12*Z)
|
|
690
|
+
sage: b = S(X + 2*Y)
|
|
691
|
+
sage: (a - b).monomial_coefficients()
|
|
692
|
+
{'X': -1, 'Z': 4}
|
|
693
|
+
sage: a.monomial_coefficients() # We set a._monomial_coefficients
|
|
694
|
+
{'Y': 2, 'Z': 4}
|
|
695
|
+
sage: b.monomial_coefficients() # We set b._monomial_coefficients
|
|
696
|
+
{'X': 1, 'Y': 2}
|
|
697
|
+
sage: (a - b).monomial_coefficients() # This is now computed from a and b
|
|
698
|
+
{'X': -1, 'Z': 4}
|
|
699
|
+
"""
|
|
700
|
+
cdef LieSubalgebraElementWrapper ret, other = <LieSubalgebraElementWrapper> right
|
|
701
|
+
ret = type(self)(self._parent, self.value - other.value)
|
|
702
|
+
if self._monomial_coefficients is not None and other._monomial_coefficients is not None:
|
|
703
|
+
mc = axpy(-1, other._monomial_coefficients, self._monomial_coefficients)
|
|
704
|
+
ret._monomial_coefficients = mc
|
|
705
|
+
return ret
|
|
706
|
+
|
|
707
|
+
cpdef _acted_upon_(self, scalar, bint self_on_left):
|
|
708
|
+
"""
|
|
709
|
+
Return the action of a scalar on ``self``.
|
|
710
|
+
|
|
711
|
+
EXAMPLES::
|
|
712
|
+
|
|
713
|
+
sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
|
|
714
|
+
sage: S = L.subalgebra([X, Y])
|
|
715
|
+
sage: a = S(2*Y + 12*Z)
|
|
716
|
+
sage: (2*a).monomial_coefficients()
|
|
717
|
+
{'Y': 4, 'Z': 8}
|
|
718
|
+
sage: a.monomial_coefficients() # We set a._monomial_coefficients
|
|
719
|
+
{'Y': 2, 'Z': 4}
|
|
720
|
+
sage: (2*a).monomial_coefficients() # This is now computed from a
|
|
721
|
+
{'Y': 4, 'Z': 8}
|
|
722
|
+
"""
|
|
723
|
+
# This was copied and IDK if it still applies (TCS):
|
|
724
|
+
# With the current design, the coercion model does not have
|
|
725
|
+
# enough information to detect apriori that this method only
|
|
726
|
+
# accepts scalars; so it tries on some elements(), and we need
|
|
727
|
+
# to make sure to report an error.
|
|
728
|
+
scalar_parent = parent(scalar)
|
|
729
|
+
if scalar_parent != self._parent.base_ring():
|
|
730
|
+
# Temporary needed by coercion (see Polynomial/FractionField tests).
|
|
731
|
+
if self._parent.base_ring().has_coerce_map_from(scalar_parent):
|
|
732
|
+
scalar = self._parent.base_ring()(scalar)
|
|
733
|
+
else:
|
|
734
|
+
return None
|
|
735
|
+
cdef LieSubalgebraElementWrapper ret
|
|
736
|
+
if self_on_left:
|
|
737
|
+
ret = type(self)(self._parent, self.value * scalar)
|
|
738
|
+
else:
|
|
739
|
+
ret = type(self)(self._parent, scalar * self.value)
|
|
740
|
+
if self._monomial_coefficients is not None:
|
|
741
|
+
ret._monomial_coefficients = scal(scalar, self._monomial_coefficients, self_on_left)
|
|
742
|
+
return ret
|
|
743
|
+
|
|
744
|
+
cdef class StructureCoefficientsElement(LieAlgebraMatrixWrapper):
|
|
745
|
+
"""
|
|
746
|
+
An element of a Lie algebra given by structure coefficients.
|
|
747
|
+
"""
|
|
748
|
+
def _repr_(self):
|
|
749
|
+
"""
|
|
750
|
+
EXAMPLES::
|
|
751
|
+
|
|
752
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
753
|
+
sage: x - 3/2 * y
|
|
754
|
+
x - 3/2*y
|
|
755
|
+
"""
|
|
756
|
+
return repr_lincomb(self._sorted_items_for_printing(),
|
|
757
|
+
scalar_mult=self._parent._print_options['scalar_mult'],
|
|
758
|
+
repr_monomial=self._parent._repr_generator,
|
|
759
|
+
strip_one=True)
|
|
760
|
+
|
|
761
|
+
def _latex_(self):
|
|
762
|
+
r"""
|
|
763
|
+
EXAMPLES::
|
|
764
|
+
|
|
765
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
766
|
+
sage: elt = x - 3/2 * y
|
|
767
|
+
sage: latex(elt)
|
|
768
|
+
x - \frac{3}{2} y
|
|
769
|
+
"""
|
|
770
|
+
return repr_lincomb(self._sorted_items_for_printing(),
|
|
771
|
+
scalar_mult=self._parent._print_options['scalar_mult'],
|
|
772
|
+
latex_scalar_mult=self._parent._print_options['latex_scalar_mult'],
|
|
773
|
+
repr_monomial=self._parent._latex_term,
|
|
774
|
+
is_latex=True, strip_one=True)
|
|
775
|
+
|
|
776
|
+
def _ascii_art_(self):
|
|
777
|
+
r"""
|
|
778
|
+
Return an ascii art representation of ``self``.
|
|
779
|
+
|
|
780
|
+
EXAMPLES::
|
|
781
|
+
|
|
782
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
783
|
+
sage: ascii_art(x - 3/2 * y)
|
|
784
|
+
x - 3/2*y
|
|
785
|
+
"""
|
|
786
|
+
from sage.typeset.ascii_art import ascii_art
|
|
787
|
+
return ascii_art(repr_lincomb(self._sorted_items_for_printing(),
|
|
788
|
+
scalar_mult=ascii_art(self._parent._print_options['scalar_mult']),
|
|
789
|
+
repr_monomial=ascii_art,
|
|
790
|
+
strip_one=True))
|
|
791
|
+
|
|
792
|
+
def _unicode_art_(self):
|
|
793
|
+
r"""
|
|
794
|
+
Return a unicode art representation of ``self``.
|
|
795
|
+
|
|
796
|
+
EXAMPLES::
|
|
797
|
+
|
|
798
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
799
|
+
sage: unicode_art(x - 3/2 * y)
|
|
800
|
+
x - 3/2·y
|
|
801
|
+
"""
|
|
802
|
+
from sage.typeset.unicode_art import unicode_art
|
|
803
|
+
return unicode_art(repr_lincomb(self._sorted_items_for_printing(),
|
|
804
|
+
scalar_mult='·',
|
|
805
|
+
strip_one=True))
|
|
806
|
+
|
|
807
|
+
cpdef bracket(self, right):
|
|
808
|
+
"""
|
|
809
|
+
Return the Lie bracket ``[self, right]``.
|
|
810
|
+
|
|
811
|
+
EXAMPLES::
|
|
812
|
+
|
|
813
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}, ('y','z'): {'x':1}, ('z','x'): {'y':1}})
|
|
814
|
+
sage: x.bracket(y)
|
|
815
|
+
z
|
|
816
|
+
sage: y.bracket(x)
|
|
817
|
+
-z
|
|
818
|
+
sage: (x + y - z).bracket(x - y + z)
|
|
819
|
+
-2*y - 2*z
|
|
820
|
+
"""
|
|
821
|
+
if not have_same_parent(self, right):
|
|
822
|
+
self, right = coercion_model.canonical_coercion(self, right)
|
|
823
|
+
return self._bracket_(right)
|
|
824
|
+
|
|
825
|
+
# We need this method because the LieAlgebra.bracket method (from the
|
|
826
|
+
# category) calls this, where we are guaranteed to have the same parent.
|
|
827
|
+
cpdef _bracket_(self, right):
|
|
828
|
+
"""
|
|
829
|
+
Return the Lie bracket ``[self, right]``.
|
|
830
|
+
|
|
831
|
+
EXAMPLES::
|
|
832
|
+
|
|
833
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}, ('y','z'): {'x':1}, ('z','x'): {'y':1}})
|
|
834
|
+
sage: x._bracket_(y)
|
|
835
|
+
z
|
|
836
|
+
sage: y._bracket_(x)
|
|
837
|
+
-z
|
|
838
|
+
"""
|
|
839
|
+
P = self._parent
|
|
840
|
+
cdef dict s_coeff = P._s_coeff
|
|
841
|
+
d = P.dimension()
|
|
842
|
+
cdef list ret = [P.base_ring().zero()]*d
|
|
843
|
+
cdef int i1, i2, i3
|
|
844
|
+
cdef StructureCoefficientsElement rt = <StructureCoefficientsElement> right
|
|
845
|
+
for i1 in range(d):
|
|
846
|
+
c1 = self.value[i1]
|
|
847
|
+
if not c1:
|
|
848
|
+
continue
|
|
849
|
+
for i2 in range(d):
|
|
850
|
+
c2 = rt.value[i2]
|
|
851
|
+
if not c2:
|
|
852
|
+
continue
|
|
853
|
+
prod_c1_c2 = c1 * c2
|
|
854
|
+
if (i1, i2) in s_coeff:
|
|
855
|
+
v = s_coeff[i1, i2]
|
|
856
|
+
for i3 in range(d):
|
|
857
|
+
ret[i3] += prod_c1_c2 * v[i3]
|
|
858
|
+
elif (i2, i1) in s_coeff:
|
|
859
|
+
v = s_coeff[i2, i1]
|
|
860
|
+
for i3 in range(d):
|
|
861
|
+
ret[i3] -= prod_c1_c2 * v[i3]
|
|
862
|
+
return type(self)(P, P._M(ret))
|
|
863
|
+
|
|
864
|
+
def __iter__(self):
|
|
865
|
+
"""
|
|
866
|
+
Iterate over ``self``.
|
|
867
|
+
|
|
868
|
+
EXAMPLES::
|
|
869
|
+
|
|
870
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
871
|
+
sage: elt = x - 3/2 * y
|
|
872
|
+
sage: list(elt)
|
|
873
|
+
[('x', 1), ('y', -3/2)]
|
|
874
|
+
"""
|
|
875
|
+
zero = self._parent.base_ring().zero()
|
|
876
|
+
I = self._parent._indices
|
|
877
|
+
cdef int i
|
|
878
|
+
for i, v in enumerate(self.value):
|
|
879
|
+
if v != zero:
|
|
880
|
+
yield (I[i], v)
|
|
881
|
+
|
|
882
|
+
cpdef _vector_(self, bint sparse=False, order=None):
|
|
883
|
+
"""
|
|
884
|
+
Return ``self`` as a vector.
|
|
885
|
+
|
|
886
|
+
EXAMPLES::
|
|
887
|
+
|
|
888
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
|
|
889
|
+
sage: a = x + 3*y - z/5
|
|
890
|
+
sage: vector(a)
|
|
891
|
+
(1, 3, -1/5)
|
|
892
|
+
"""
|
|
893
|
+
if sparse:
|
|
894
|
+
return self.value.sparse_vector()
|
|
895
|
+
return self.value
|
|
896
|
+
|
|
897
|
+
cpdef to_vector(self, bint sparse=False, order=None):
|
|
898
|
+
"""
|
|
899
|
+
Return ``self`` as a vector.
|
|
900
|
+
|
|
901
|
+
EXAMPLES::
|
|
902
|
+
|
|
903
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
|
|
904
|
+
sage: a = x + 3*y - z/2
|
|
905
|
+
sage: a.to_vector()
|
|
906
|
+
(1, 3, -1/2)
|
|
907
|
+
"""
|
|
908
|
+
return self._vector_(sparse=sparse)
|
|
909
|
+
|
|
910
|
+
def lift(self):
|
|
911
|
+
"""
|
|
912
|
+
Return the lift of ``self`` to the universal enveloping algebra.
|
|
913
|
+
|
|
914
|
+
EXAMPLES::
|
|
915
|
+
|
|
916
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
917
|
+
sage: elt = x - 3/2 * y
|
|
918
|
+
sage: l = elt.lift(); l
|
|
919
|
+
x - 3/2*y
|
|
920
|
+
sage: l.parent()
|
|
921
|
+
Noncommutative Multivariate Polynomial Ring in x, y
|
|
922
|
+
over Rational Field, nc-relations: {y*x: x*y - x}
|
|
923
|
+
"""
|
|
924
|
+
UEA = self._parent.universal_enveloping_algebra()
|
|
925
|
+
gens = UEA.gens()
|
|
926
|
+
return UEA.sum(c * gens[i] for i, c in self.value.items())
|
|
927
|
+
|
|
928
|
+
cpdef dict monomial_coefficients(self, bint copy=True):
|
|
929
|
+
"""
|
|
930
|
+
Return the monomial coefficients of ``self`` as a dictionary.
|
|
931
|
+
|
|
932
|
+
EXAMPLES::
|
|
933
|
+
|
|
934
|
+
sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
|
|
935
|
+
sage: a = 2*x - 3/2*y + z
|
|
936
|
+
sage: a.monomial_coefficients()
|
|
937
|
+
{'x': 2, 'y': -3/2, 'z': 1}
|
|
938
|
+
sage: a = 2*x - 3/2*z
|
|
939
|
+
sage: a.monomial_coefficients()
|
|
940
|
+
{'x': 2, 'z': -3/2}
|
|
941
|
+
"""
|
|
942
|
+
I = self._parent._indices
|
|
943
|
+
return {I[i]: v for i, v in self.value.items()}
|
|
944
|
+
|
|
945
|
+
def __getitem__(self, i):
|
|
946
|
+
"""
|
|
947
|
+
Return the coefficient of the basis element indexed by ``i``.
|
|
948
|
+
|
|
949
|
+
EXAMPLES::
|
|
950
|
+
|
|
951
|
+
sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
|
|
952
|
+
sage: elt = x - 3/2 * y
|
|
953
|
+
sage: elt['y']
|
|
954
|
+
-3/2
|
|
955
|
+
"""
|
|
956
|
+
return self.value[self._parent._indices.index(i)]
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
cdef class UntwistedAffineLieAlgebraElement(Element):
|
|
960
|
+
"""
|
|
961
|
+
An element of an untwisted affine Lie algebra.
|
|
962
|
+
"""
|
|
963
|
+
def __init__(self, parent, dict t_dict, c_coeff, d_coeff):
|
|
964
|
+
"""
|
|
965
|
+
Initialize ``self``.
|
|
966
|
+
|
|
967
|
+
TESTS::
|
|
968
|
+
|
|
969
|
+
sage: # needs sage.graphs
|
|
970
|
+
sage: L = lie_algebras.Affine(QQ, ['A',2,1])
|
|
971
|
+
sage: x = L.an_element()
|
|
972
|
+
sage: TestSuite(x).run()
|
|
973
|
+
"""
|
|
974
|
+
Element.__init__(self, parent)
|
|
975
|
+
self._t_dict = t_dict
|
|
976
|
+
self._c_coeff = c_coeff
|
|
977
|
+
self._d_coeff = d_coeff
|
|
978
|
+
self._hash = -1
|
|
979
|
+
|
|
980
|
+
def __reduce__(self):
|
|
981
|
+
"""
|
|
982
|
+
Used in pickling.
|
|
983
|
+
|
|
984
|
+
TESTS::
|
|
985
|
+
|
|
986
|
+
sage: # needs sage.graphs
|
|
987
|
+
sage: L = lie_algebras.Affine(QQ, ['B',3,1])
|
|
988
|
+
sage: x = L.an_element()
|
|
989
|
+
sage: loads(dumps(x)) == x
|
|
990
|
+
True
|
|
991
|
+
"""
|
|
992
|
+
return (_build_untwisted_affine_element,
|
|
993
|
+
(self._parent, self._t_dict, self._c_coeff, self._d_coeff))
|
|
994
|
+
|
|
995
|
+
def _repr_generic(self, style, coeff, t_disp, mult, tensor_symb):
|
|
996
|
+
"""
|
|
997
|
+
Return a representation of ``self`` based on ``style``.
|
|
998
|
+
|
|
999
|
+
INPUT:
|
|
1000
|
+
|
|
1001
|
+
- ``style`` -- a function for how to convert the objects
|
|
1002
|
+
- ``coeff`` -- a function for how to display the coefficients
|
|
1003
|
+
- ``t_disp`` -- a function for how to display the powers of `t`
|
|
1004
|
+
- ``mult`` -- the multiplication symbol; must be compatible
|
|
1005
|
+
with ``style``
|
|
1006
|
+
- ``tensor_symb`` -- the tensor symbol; must be compatible
|
|
1007
|
+
with ``style``
|
|
1008
|
+
|
|
1009
|
+
EXAMPLES::
|
|
1010
|
+
|
|
1011
|
+
sage: # needs sage.graphs
|
|
1012
|
+
sage: L = lie_algebras.Affine(QQ, ['B', 3, 1])
|
|
1013
|
+
sage: elt = L.an_element()
|
|
1014
|
+
sage: elt._repr_generic(str, str, lambda t: "T^{}".format(t), '.', '(x)')
|
|
1015
|
+
'(E[alpha[3]] + E[alpha[2]] + E[alpha[1]] + h1 + h2 + h3 + E[-alpha[3]]
|
|
1016
|
+
+ E[-alpha[2]] + E[-alpha[1]])(x)T^0 + (E[-alpha[1] - 2*alpha[2]
|
|
1017
|
+
- 2*alpha[3]])(x)T^1 + (E[alpha[1] + 2*alpha[2] + 2*alpha[3]])(x)T^-1 + c + d'
|
|
1018
|
+
"""
|
|
1019
|
+
ret = style('')
|
|
1020
|
+
mult = style(mult)
|
|
1021
|
+
tensor_symb = style(tensor_symb)
|
|
1022
|
+
for t, g in self._t_dict.items():
|
|
1023
|
+
if ret:
|
|
1024
|
+
ret += style(' + ')
|
|
1025
|
+
if coeff == str:
|
|
1026
|
+
# We need to special case this because of the necessary added
|
|
1027
|
+
# comma by Python
|
|
1028
|
+
ret += "({})".format(g) + tensor_symb + style(t_disp(t))
|
|
1029
|
+
else:
|
|
1030
|
+
ret += coeff((g,)) + tensor_symb + style(t_disp(t))
|
|
1031
|
+
if self._c_coeff != 0:
|
|
1032
|
+
if ret:
|
|
1033
|
+
ret += style(' + ')
|
|
1034
|
+
if self._c_coeff != 1:
|
|
1035
|
+
ret += coeff(self._c_coeff) + mult + style('c')
|
|
1036
|
+
else:
|
|
1037
|
+
ret += style('c')
|
|
1038
|
+
|
|
1039
|
+
if self._d_coeff != 0:
|
|
1040
|
+
if ret:
|
|
1041
|
+
ret += style(' + ')
|
|
1042
|
+
if self._d_coeff != 1:
|
|
1043
|
+
ret += coeff(self._d_coeff) + mult + style('d')
|
|
1044
|
+
else:
|
|
1045
|
+
ret += style('d')
|
|
1046
|
+
|
|
1047
|
+
if not ret:
|
|
1048
|
+
return style('0')
|
|
1049
|
+
return ret
|
|
1050
|
+
|
|
1051
|
+
def _repr_(self):
|
|
1052
|
+
"""
|
|
1053
|
+
Return a string representation of ``self``.
|
|
1054
|
+
|
|
1055
|
+
EXAMPLES::
|
|
1056
|
+
|
|
1057
|
+
sage: # needs sage.graphs
|
|
1058
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1059
|
+
sage: list(L.lie_algebra_generators())
|
|
1060
|
+
[(E[alpha[1]])#t^0,
|
|
1061
|
+
(E[-alpha[1]])#t^0,
|
|
1062
|
+
(h1)#t^0,
|
|
1063
|
+
(E[-alpha[1]])#t^1,
|
|
1064
|
+
(E[alpha[1]])#t^-1,
|
|
1065
|
+
c,
|
|
1066
|
+
d]
|
|
1067
|
+
sage: L.an_element()
|
|
1068
|
+
(E[alpha[1]] + h1 + E[-alpha[1]])#t^0
|
|
1069
|
+
+ (E[-alpha[1]])#t^1 + (E[alpha[1]])#t^-1
|
|
1070
|
+
+ c + d
|
|
1071
|
+
sage: L.zero()
|
|
1072
|
+
0
|
|
1073
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1074
|
+
sage: e1 + 2*f1 - h1 + e0 + 3*c - 2*d
|
|
1075
|
+
(E[alpha[1]] - h1 + 2*E[-alpha[1]])#t^0 + (E[-alpha[1]])#t^1
|
|
1076
|
+
+ 3*c + -2*d
|
|
1077
|
+
"""
|
|
1078
|
+
return self._repr_generic(str, str, lambda t: "t^{}".format(t), '*', '#')
|
|
1079
|
+
|
|
1080
|
+
def _latex_(self):
|
|
1081
|
+
r"""
|
|
1082
|
+
Return a latex representation of ``self``.
|
|
1083
|
+
|
|
1084
|
+
EXAMPLES::
|
|
1085
|
+
|
|
1086
|
+
sage: # needs sage.graphs
|
|
1087
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1088
|
+
sage: [latex(g) for g in L.lie_algebra_generators()]
|
|
1089
|
+
[\left(E_{\alpha_{1}}\right) \otimes t^{0},
|
|
1090
|
+
\left(E_{-\alpha_{1}}\right) \otimes t^{0},
|
|
1091
|
+
\left(E_{\alpha^\vee_{1}}\right) \otimes t^{0},
|
|
1092
|
+
\left(E_{-\alpha_{1}}\right) \otimes t^{1},
|
|
1093
|
+
\left(E_{\alpha_{1}}\right) \otimes t^{-1},
|
|
1094
|
+
c,
|
|
1095
|
+
d]
|
|
1096
|
+
sage: latex(L.an_element())
|
|
1097
|
+
\left(E_{\alpha_{1}} + E_{\alpha^\vee_{1}} + E_{-\alpha_{1}}\right) \otimes t^{0}
|
|
1098
|
+
+ \left(E_{-\alpha_{1}}\right) \otimes t^{1}
|
|
1099
|
+
+ \left(E_{\alpha_{1}}\right) \otimes t^{-1}
|
|
1100
|
+
+ c + d
|
|
1101
|
+
sage: latex(L.zero())
|
|
1102
|
+
0
|
|
1103
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1104
|
+
sage: latex(e1 + 2*f1 - h1 + e0 + 3*c - 2*d)
|
|
1105
|
+
\left(E_{\alpha_{1}} - E_{\alpha^\vee_{1}} + 2 E_{-\alpha_{1}}\right) \otimes t^{0}
|
|
1106
|
+
+ \left(E_{-\alpha_{1}}\right) \otimes t^{1} + 3 c + -2 d
|
|
1107
|
+
"""
|
|
1108
|
+
from sage.misc.latex import latex
|
|
1109
|
+
return self._repr_generic(str, latex, lambda t: "t^{{{}}}".format(t), ' ', ' \\otimes ')
|
|
1110
|
+
|
|
1111
|
+
def _unicode_art_(self):
|
|
1112
|
+
r"""
|
|
1113
|
+
Return a unicode art representation of ``self``.
|
|
1114
|
+
|
|
1115
|
+
EXAMPLES::
|
|
1116
|
+
|
|
1117
|
+
sage: # needs sage.graphs
|
|
1118
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1119
|
+
sage: unicode_art([g for g in L.lie_algebra_generators()])
|
|
1120
|
+
[ ( alpha[1] )⊗t⁰, ( -alpha[1] )⊗t⁰, ( alphacheck[1] )⊗t⁰, ( -alpha[1] )⊗t¹,
|
|
1121
|
+
<BLANKLINE>
|
|
1122
|
+
( alpha[1] )⊗t⁻¹, c, d ]
|
|
1123
|
+
sage: unicode_art(L.an_element())
|
|
1124
|
+
( alpha[1] + alphacheck[1] + -alpha[1] )⊗t⁰ + ( -alpha[1] )⊗t¹ + ( alpha[1] )⊗
|
|
1125
|
+
<BLANKLINE>
|
|
1126
|
+
t⁻¹ + c + d
|
|
1127
|
+
sage: unicode_art(L.zero())
|
|
1128
|
+
0
|
|
1129
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1130
|
+
sage: unicode_art(e1 + 2*f1 - h1 + e0 + 3*c - 2*d)
|
|
1131
|
+
( alpha[1] - alphacheck[1] + 2·-alpha[1] )⊗t⁰ + ( -alpha[1] )⊗t¹ + 3⋅c + -2⋅d
|
|
1132
|
+
"""
|
|
1133
|
+
from sage.typeset.unicode_art import unicode_art, unicode_superscript
|
|
1134
|
+
return self._repr_generic(unicode_art, unicode_art,
|
|
1135
|
+
lambda t: "t" + unicode_superscript(t),
|
|
1136
|
+
unicode_art('⋅'), unicode_art('⊗'))
|
|
1137
|
+
|
|
1138
|
+
cpdef dict t_dict(self):
|
|
1139
|
+
r"""
|
|
1140
|
+
Return the ``dict``, whose keys are powers of `t` and values are
|
|
1141
|
+
elements of the classical Lie algebra, of ``self``.
|
|
1142
|
+
|
|
1143
|
+
EXAMPLES::
|
|
1144
|
+
|
|
1145
|
+
sage: # needs sage.graphs
|
|
1146
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1147
|
+
sage: x = L.an_element()
|
|
1148
|
+
sage: x.t_dict()
|
|
1149
|
+
{-1: E[alpha[1]],
|
|
1150
|
+
0: E[alpha[1]] + h1 + E[-alpha[1]],
|
|
1151
|
+
1: E[-alpha[1]]}
|
|
1152
|
+
"""
|
|
1153
|
+
return self._t_dict.copy()
|
|
1154
|
+
|
|
1155
|
+
cpdef c_coefficient(self):
|
|
1156
|
+
r"""
|
|
1157
|
+
Return the coefficient of `c` of ``self``.
|
|
1158
|
+
|
|
1159
|
+
EXAMPLES::
|
|
1160
|
+
|
|
1161
|
+
sage: # needs sage.graphs
|
|
1162
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1163
|
+
sage: x = L.an_element() - 3 * L.c()
|
|
1164
|
+
sage: x.c_coefficient()
|
|
1165
|
+
-2
|
|
1166
|
+
"""
|
|
1167
|
+
return self._c_coeff
|
|
1168
|
+
|
|
1169
|
+
cpdef d_coefficient(self):
|
|
1170
|
+
r"""
|
|
1171
|
+
Return the coefficient of `d` of ``self``.
|
|
1172
|
+
|
|
1173
|
+
EXAMPLES::
|
|
1174
|
+
|
|
1175
|
+
sage: # needs sage.graphs
|
|
1176
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1177
|
+
sage: x = L.an_element() + L.d()
|
|
1178
|
+
sage: x.d_coefficient()
|
|
1179
|
+
2
|
|
1180
|
+
"""
|
|
1181
|
+
return self._d_coeff
|
|
1182
|
+
|
|
1183
|
+
cpdef _richcmp_(self, other, int op):
|
|
1184
|
+
"""
|
|
1185
|
+
Return the rich comparison of ``self`` with ``other``.
|
|
1186
|
+
|
|
1187
|
+
EXAMPLES::
|
|
1188
|
+
|
|
1189
|
+
sage: # needs sage.graphs
|
|
1190
|
+
sage: L = lie_algebras.Affine(QQ, ['C',2,1])
|
|
1191
|
+
sage: x = L.an_element()
|
|
1192
|
+
sage: c = L.basis()['c']
|
|
1193
|
+
sage: d = L.basis()['d']
|
|
1194
|
+
sage: c == d
|
|
1195
|
+
False
|
|
1196
|
+
sage: x != c
|
|
1197
|
+
True
|
|
1198
|
+
sage: 2*c - d == c + c - d
|
|
1199
|
+
True
|
|
1200
|
+
sage: x - c != x - c
|
|
1201
|
+
False
|
|
1202
|
+
sage: x - c != x - d
|
|
1203
|
+
True
|
|
1204
|
+
"""
|
|
1205
|
+
if op != Py_EQ and op != Py_NE:
|
|
1206
|
+
return NotImplemented
|
|
1207
|
+
cdef UntwistedAffineLieAlgebraElement rt = <UntwistedAffineLieAlgebraElement> other
|
|
1208
|
+
return richcmp((self._t_dict, self._c_coeff, self._d_coeff),
|
|
1209
|
+
(rt._t_dict, rt._c_coeff, rt._d_coeff),
|
|
1210
|
+
op)
|
|
1211
|
+
|
|
1212
|
+
def __hash__(self):
|
|
1213
|
+
"""
|
|
1214
|
+
Return the hash of ``self``.
|
|
1215
|
+
|
|
1216
|
+
EXAMPLES::
|
|
1217
|
+
|
|
1218
|
+
sage: # needs sage.graphs
|
|
1219
|
+
sage: asl = lie_algebras.Affine(QQ, ['A',4,1])
|
|
1220
|
+
sage: x = asl.an_element()
|
|
1221
|
+
sage: hash(x) == hash(x)
|
|
1222
|
+
True
|
|
1223
|
+
sage: hash(asl.zero())
|
|
1224
|
+
0
|
|
1225
|
+
"""
|
|
1226
|
+
if not self:
|
|
1227
|
+
self._hash = 0
|
|
1228
|
+
if self._hash == -1:
|
|
1229
|
+
self._hash = hash((tuple([self._t_dict[i] for i in sorted(self._t_dict)]),
|
|
1230
|
+
self._c_coeff, self._d_coeff))
|
|
1231
|
+
return self._hash
|
|
1232
|
+
|
|
1233
|
+
def __bool__(self):
|
|
1234
|
+
"""
|
|
1235
|
+
Return ``self`` as a boolean.
|
|
1236
|
+
|
|
1237
|
+
EXAMPLES::
|
|
1238
|
+
|
|
1239
|
+
sage: # needs sage.graphs
|
|
1240
|
+
sage: L = lie_algebras.Affine(QQ, ['C',2,1])
|
|
1241
|
+
sage: x = L.an_element()
|
|
1242
|
+
sage: bool(x)
|
|
1243
|
+
True
|
|
1244
|
+
sage: bool(L.zero())
|
|
1245
|
+
False
|
|
1246
|
+
"""
|
|
1247
|
+
return bool(self._t_dict) or bool(self._c_coeff) or bool(self._d_coeff)
|
|
1248
|
+
|
|
1249
|
+
cpdef _add_(self, other):
|
|
1250
|
+
"""
|
|
1251
|
+
Add ``self`` and ``other``.
|
|
1252
|
+
|
|
1253
|
+
EXAMPLES::
|
|
1254
|
+
|
|
1255
|
+
sage: # needs sage.graphs
|
|
1256
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1257
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1258
|
+
sage: e0.bracket(e1) + d + c + 3*d
|
|
1259
|
+
(-h1)#t^1 + c + 4*d
|
|
1260
|
+
"""
|
|
1261
|
+
cdef UntwistedAffineLieAlgebraElement rt = <UntwistedAffineLieAlgebraElement> other
|
|
1262
|
+
return type(self)(self._parent, add(self._t_dict, rt._t_dict),
|
|
1263
|
+
self._c_coeff + rt._c_coeff,
|
|
1264
|
+
self._d_coeff + rt._d_coeff)
|
|
1265
|
+
|
|
1266
|
+
cpdef _sub_(self, other):
|
|
1267
|
+
"""
|
|
1268
|
+
Subtract ``self`` and ``other``.
|
|
1269
|
+
|
|
1270
|
+
EXAMPLES::
|
|
1271
|
+
|
|
1272
|
+
sage: # needs sage.graphs
|
|
1273
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1274
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1275
|
+
sage: d - e1 + c - 3*d
|
|
1276
|
+
(-E[alpha[1]])#t^0 + c + -2*d
|
|
1277
|
+
sage: 4*c - e0.bracket(f0)
|
|
1278
|
+
(h1)#t^0
|
|
1279
|
+
sage: 4*c - e0.bracket(f0) - h1
|
|
1280
|
+
0
|
|
1281
|
+
sage: 4*c - e0.bracket(f0) - h1 == L.zero()
|
|
1282
|
+
True
|
|
1283
|
+
sage: e1 - f1
|
|
1284
|
+
(E[alpha[1]] - E[-alpha[1]])#t^0
|
|
1285
|
+
"""
|
|
1286
|
+
cdef UntwistedAffineLieAlgebraElement rt = <UntwistedAffineLieAlgebraElement> other
|
|
1287
|
+
return type(self)(self._parent, axpy(-1, rt._t_dict, self._t_dict),
|
|
1288
|
+
self._c_coeff - rt._c_coeff,
|
|
1289
|
+
self._d_coeff - rt._d_coeff)
|
|
1290
|
+
|
|
1291
|
+
cpdef _neg_(self):
|
|
1292
|
+
"""
|
|
1293
|
+
Negate ``self``.
|
|
1294
|
+
|
|
1295
|
+
EXAMPLES::
|
|
1296
|
+
|
|
1297
|
+
sage: # needs sage.graphs
|
|
1298
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1299
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1300
|
+
sage: x = e0.bracket(e1) + d + e1 + c + 3*d
|
|
1301
|
+
sage: -x + e1
|
|
1302
|
+
(h1)#t^1 + -1*c + -4*d
|
|
1303
|
+
"""
|
|
1304
|
+
return type(self)(self._parent, negate(self._t_dict),
|
|
1305
|
+
-self._c_coeff, -self._d_coeff)
|
|
1306
|
+
|
|
1307
|
+
cpdef _acted_upon_(self, scalar, bint self_on_left):
|
|
1308
|
+
"""
|
|
1309
|
+
Return ``self`` acted upon by ``scalar``.
|
|
1310
|
+
|
|
1311
|
+
EXAMPLES::
|
|
1312
|
+
|
|
1313
|
+
sage: # needs sage.graphs
|
|
1314
|
+
sage: L = lie_algebras.Affine(QQ, ['A',1,1])
|
|
1315
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1316
|
+
sage: x = e1 + f0.bracket(f1) + 3*c - 2/5 * d
|
|
1317
|
+
sage: x
|
|
1318
|
+
(E[alpha[1]])#t^0 + (h1)#t^-1 + 3*c + -2/5*d
|
|
1319
|
+
sage: -2 * x
|
|
1320
|
+
(-2*E[alpha[1]])#t^0 + (-2*h1)#t^-1 + -6*c + 4/5*d
|
|
1321
|
+
"""
|
|
1322
|
+
# This was copied and IDK if it still applies (TCS):
|
|
1323
|
+
# With the current design, the coercion model does not have
|
|
1324
|
+
# enough information to detect apriori that this method only
|
|
1325
|
+
# accepts scalars; so it tries on some elements(), and we need
|
|
1326
|
+
# to make sure to report an error.
|
|
1327
|
+
scalar_parent = parent(scalar)
|
|
1328
|
+
if scalar_parent != self._parent.base_ring():
|
|
1329
|
+
# Temporary needed by coercion (see Polynomial/FractionField tests).
|
|
1330
|
+
if self._parent.base_ring().has_coerce_map_from(scalar_parent):
|
|
1331
|
+
scalar = self._parent.base_ring()(scalar)
|
|
1332
|
+
else:
|
|
1333
|
+
return None
|
|
1334
|
+
return type(self)(self._parent, scal(scalar, self._t_dict, self_on_left),
|
|
1335
|
+
scalar * self._c_coeff,
|
|
1336
|
+
scalar * self._d_coeff)
|
|
1337
|
+
|
|
1338
|
+
cpdef monomial_coefficients(self, bint copy=True):
|
|
1339
|
+
"""
|
|
1340
|
+
Return the monomial coefficients of ``self``.
|
|
1341
|
+
|
|
1342
|
+
EXAMPLES::
|
|
1343
|
+
|
|
1344
|
+
sage: # needs sage.graphs
|
|
1345
|
+
sage: L = lie_algebras.Affine(QQ, ['C',2,1])
|
|
1346
|
+
sage: x = L.an_element()
|
|
1347
|
+
sage: sorted(x.monomial_coefficients(), key=str)
|
|
1348
|
+
[(-2*alpha[1] - alpha[2], 1),
|
|
1349
|
+
(-alpha[1], 0),
|
|
1350
|
+
(-alpha[2], 0),
|
|
1351
|
+
(2*alpha[1] + alpha[2], -1),
|
|
1352
|
+
(alpha[1], 0),
|
|
1353
|
+
(alpha[2], 0),
|
|
1354
|
+
(alphacheck[1], 0),
|
|
1355
|
+
(alphacheck[2], 0),
|
|
1356
|
+
'c',
|
|
1357
|
+
'd']
|
|
1358
|
+
"""
|
|
1359
|
+
cdef dict d = {}
|
|
1360
|
+
for t, g in self._t_dict.items():
|
|
1361
|
+
for k, c in g.monomial_coefficients(copy=False).items():
|
|
1362
|
+
d[k, t] = c
|
|
1363
|
+
if self._c_coeff:
|
|
1364
|
+
d['c'] = self._c_coeff
|
|
1365
|
+
if self._d_coeff:
|
|
1366
|
+
d['d'] = self._d_coeff
|
|
1367
|
+
return d
|
|
1368
|
+
|
|
1369
|
+
cpdef bracket(self, right):
|
|
1370
|
+
"""
|
|
1371
|
+
Return the Lie bracket ``[self, right]``.
|
|
1372
|
+
|
|
1373
|
+
EXAMPLES::
|
|
1374
|
+
|
|
1375
|
+
sage: # needs sage.graphs
|
|
1376
|
+
sage: L = LieAlgebra(QQ, cartan_type=['A',1,1])
|
|
1377
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1378
|
+
sage: e0.bracket(f0)
|
|
1379
|
+
(-h1)#t^0 + 4*c
|
|
1380
|
+
sage: e1.bracket(0)
|
|
1381
|
+
0
|
|
1382
|
+
sage: e1.bracket(1)
|
|
1383
|
+
Traceback (most recent call last):
|
|
1384
|
+
...
|
|
1385
|
+
TypeError: no common canonical parent for objects with parents:
|
|
1386
|
+
'Affine Kac-Moody algebra of ['A', 1] in the Chevalley basis'
|
|
1387
|
+
and 'Integer Ring'
|
|
1388
|
+
"""
|
|
1389
|
+
if not have_same_parent(self, right):
|
|
1390
|
+
self, right = coercion_model.canonical_coercion(self, right)
|
|
1391
|
+
return self._bracket_(right)
|
|
1392
|
+
|
|
1393
|
+
cpdef _bracket_(self, y):
|
|
1394
|
+
"""
|
|
1395
|
+
Return the Lie bracket ``[self, y]``.
|
|
1396
|
+
|
|
1397
|
+
EXAMPLES::
|
|
1398
|
+
|
|
1399
|
+
sage: # needs sage.graphs
|
|
1400
|
+
sage: L = LieAlgebra(QQ, cartan_type=['A',1,1])
|
|
1401
|
+
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
|
|
1402
|
+
sage: al = RootSystem(['A',1]).root_lattice().simple_roots()
|
|
1403
|
+
sage: x = L.basis()[al[1], 5]
|
|
1404
|
+
sage: y = L.basis()[-al[1], -3]
|
|
1405
|
+
sage: z = L.basis()[-al[1], -5]
|
|
1406
|
+
sage: x._bracket_(y)
|
|
1407
|
+
(h1)#t^2
|
|
1408
|
+
sage: x._bracket_(z)
|
|
1409
|
+
(h1)#t^0 + 20*c
|
|
1410
|
+
sage: x._bracket_(e1)
|
|
1411
|
+
0
|
|
1412
|
+
sage: x._bracket_(f1)
|
|
1413
|
+
(h1)#t^5
|
|
1414
|
+
sage: x._bracket_(h1)
|
|
1415
|
+
(-2*E[alpha[1]])#t^5
|
|
1416
|
+
sage: x._bracket_(d)
|
|
1417
|
+
(-5*E[alpha[1]])#t^5
|
|
1418
|
+
sage: all(c._bracket_(g) == 0 for g in L.lie_algebra_generators())
|
|
1419
|
+
True
|
|
1420
|
+
"""
|
|
1421
|
+
if not self or not y:
|
|
1422
|
+
return self._parent.zero()
|
|
1423
|
+
|
|
1424
|
+
cdef dict d = {}
|
|
1425
|
+
cdef UntwistedAffineLieAlgebraElement rt = <UntwistedAffineLieAlgebraElement>(y)
|
|
1426
|
+
c = self._parent.base_ring().zero()
|
|
1427
|
+
for tl, gl in self._t_dict.items():
|
|
1428
|
+
# d contribution from the left
|
|
1429
|
+
if rt._d_coeff:
|
|
1430
|
+
if tl in d:
|
|
1431
|
+
d[tl] -= rt._d_coeff * gl * tl
|
|
1432
|
+
else:
|
|
1433
|
+
d[tl] = -rt._d_coeff * gl * tl
|
|
1434
|
+
if not d[tl]:
|
|
1435
|
+
del d[tl]
|
|
1436
|
+
# main bracket of the central extension
|
|
1437
|
+
for tr, gr in rt._t_dict.items():
|
|
1438
|
+
b = gl.bracket(gr)
|
|
1439
|
+
if b:
|
|
1440
|
+
if tl+tr in d:
|
|
1441
|
+
d[tl+tr] += b
|
|
1442
|
+
else:
|
|
1443
|
+
d[tl+tr] = b
|
|
1444
|
+
if not d[tl+tr]:
|
|
1445
|
+
del d[tl+tr]
|
|
1446
|
+
if tl + tr == 0:
|
|
1447
|
+
c += gl.killing_form(gr) * tl
|
|
1448
|
+
|
|
1449
|
+
# d contribution from the right
|
|
1450
|
+
if self._d_coeff:
|
|
1451
|
+
for tr, gr in rt._t_dict.items():
|
|
1452
|
+
if tr in d:
|
|
1453
|
+
d[tr] += self._d_coeff * gr * tr
|
|
1454
|
+
else:
|
|
1455
|
+
d[tr] = self._d_coeff * gr * tr
|
|
1456
|
+
if not d[tr]:
|
|
1457
|
+
del d[tr]
|
|
1458
|
+
|
|
1459
|
+
return type(self)(self._parent, d, c,
|
|
1460
|
+
self._parent.base_ring().zero())
|
|
1461
|
+
|
|
1462
|
+
cpdef canonical_derivation(self):
|
|
1463
|
+
r"""
|
|
1464
|
+
Return the canonical derivation `d` applied to ``self``.
|
|
1465
|
+
|
|
1466
|
+
The canonical derivation `d` is defined as
|
|
1467
|
+
|
|
1468
|
+
.. MATH::
|
|
1469
|
+
|
|
1470
|
+
d(a \otimes t^m + \alpha c) = a \otimes m t^m.
|
|
1471
|
+
|
|
1472
|
+
Another formulation is by `d = t \frac{d}{dt}`.
|
|
1473
|
+
|
|
1474
|
+
EXAMPLES::
|
|
1475
|
+
|
|
1476
|
+
sage: # needs sage.graphs
|
|
1477
|
+
sage: L = lie_algebras.Affine(QQ, ['E',6,1])
|
|
1478
|
+
sage: al = RootSystem(['E',6]).root_lattice().simple_roots()
|
|
1479
|
+
sage: x = L.basis()[al[2]+al[3]+2*al[4]+al[5],5] + 4*L.c() + L.d()
|
|
1480
|
+
sage: x.canonical_derivation()
|
|
1481
|
+
(5*E[alpha[2] + alpha[3] + 2*alpha[4] + alpha[5]])#t^5
|
|
1482
|
+
"""
|
|
1483
|
+
cdef dict d = {tl: tl * gl
|
|
1484
|
+
for tl, gl in self._t_dict.items() if tl != 0}
|
|
1485
|
+
zero = self._parent.base_ring().zero()
|
|
1486
|
+
return type(self)(self._parent, d, zero, zero)
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
def _build_untwisted_affine_element(P, t_dict, c, d):
|
|
1490
|
+
"""
|
|
1491
|
+
Used to unpickle an element.
|
|
1492
|
+
|
|
1493
|
+
EXAMPLES::
|
|
1494
|
+
|
|
1495
|
+
sage: # needs sage.graphs
|
|
1496
|
+
sage: L = lie_algebras.Affine(QQ, ['A',2,1])
|
|
1497
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import _build_untwisted_affine_element
|
|
1498
|
+
sage: _build_untwisted_affine_element(L, {}, 0, 0) == L.zero()
|
|
1499
|
+
True
|
|
1500
|
+
sage: x = L.an_element()
|
|
1501
|
+
sage: loads(dumps(x)) == x # indirect doctest
|
|
1502
|
+
True
|
|
1503
|
+
"""
|
|
1504
|
+
return P.element_class(P, t_dict, c, d)
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
class FreeLieAlgebraElement(LieAlgebraElement):
|
|
1508
|
+
"""
|
|
1509
|
+
An element of a free Lie algebra.
|
|
1510
|
+
"""
|
|
1511
|
+
# TODO: Move to the category/lift morphism?
|
|
1512
|
+
# TODO: Don't override the LieAlgebraElement.lift or should we move
|
|
1513
|
+
# LieAlgebraElement.lift because it is for a specific implementation?
|
|
1514
|
+
def lift(self):
|
|
1515
|
+
"""
|
|
1516
|
+
Lift ``self`` to the universal enveloping algebra.
|
|
1517
|
+
|
|
1518
|
+
EXAMPLES::
|
|
1519
|
+
|
|
1520
|
+
sage: L = LieAlgebra(QQ, 'x,y,z')
|
|
1521
|
+
sage: Lyn = L.Lyndon()
|
|
1522
|
+
sage: x,y,z = Lyn.gens()
|
|
1523
|
+
sage: a = Lyn([z, [[x, y], x]]); a
|
|
1524
|
+
[x, [x, [y, z]]] + [x, [[x, z], y]] - [[x, y], [x, z]]
|
|
1525
|
+
sage: a.lift()
|
|
1526
|
+
x^2*y*z - 2*x*y*x*z + y*x^2*z - z*x^2*y + 2*z*x*y*x - z*y*x^2
|
|
1527
|
+
"""
|
|
1528
|
+
UEA = self.parent().universal_enveloping_algebra()
|
|
1529
|
+
s = UEA.zero()
|
|
1530
|
+
if not self:
|
|
1531
|
+
return s
|
|
1532
|
+
gen_dict = UEA.gens_dict()
|
|
1533
|
+
for t, c in self._monomial_coefficients.items():
|
|
1534
|
+
s += c * t.lift(gen_dict)
|
|
1535
|
+
return s
|
|
1536
|
+
|
|
1537
|
+
def list(self):
|
|
1538
|
+
"""
|
|
1539
|
+
Return ``self`` as a list of pairs ``(m, c)`` where ``m`` is a
|
|
1540
|
+
basis key (i.e., a key of one of the basis elements)
|
|
1541
|
+
and ``c`` is its coefficient.
|
|
1542
|
+
|
|
1543
|
+
This list is sorted from highest to lowest degree.
|
|
1544
|
+
|
|
1545
|
+
EXAMPLES::
|
|
1546
|
+
|
|
1547
|
+
sage: L.<x, y> = LieAlgebra(QQ)
|
|
1548
|
+
sage: elt = x + L.bracket(y, x)
|
|
1549
|
+
sage: elt.list()
|
|
1550
|
+
[([x, y], -1), (x, 1)]
|
|
1551
|
+
"""
|
|
1552
|
+
def k(x):
|
|
1553
|
+
y = x[0]
|
|
1554
|
+
return (-y._grade, y) if isinstance(y, GradedLieBracket) else (-1, y)
|
|
1555
|
+
return sorted((<dict>self._monomial_coefficients).items(), key=k)
|
|
1556
|
+
|
|
1557
|
+
def _bracket_(self, y):
|
|
1558
|
+
"""
|
|
1559
|
+
Return the Lie bracket ``[self, y]``.
|
|
1560
|
+
|
|
1561
|
+
EXAMPLES::
|
|
1562
|
+
|
|
1563
|
+
sage: L.<x, y> = LieAlgebra(QQ)
|
|
1564
|
+
sage: L.bracket(x, y)
|
|
1565
|
+
[x, y]
|
|
1566
|
+
sage: L.bracket(x, x)
|
|
1567
|
+
0
|
|
1568
|
+
sage: L.bracket(x, L.bracket(x, y))
|
|
1569
|
+
[x, [x, y]]
|
|
1570
|
+
sage: L.bracket(y, L.bracket(y, x))
|
|
1571
|
+
[[x, y], y]
|
|
1572
|
+
"""
|
|
1573
|
+
if not self or not y:
|
|
1574
|
+
return self.parent().zero()
|
|
1575
|
+
|
|
1576
|
+
cdef dict d = {}
|
|
1577
|
+
zero = self.base_ring().zero()
|
|
1578
|
+
for ml, cl in self._monomial_coefficients.items(): # The left monomials
|
|
1579
|
+
for mr, cr in y._monomial_coefficients.items(): # The right monomials
|
|
1580
|
+
if ml == mr:
|
|
1581
|
+
continue
|
|
1582
|
+
if ml < mr: # Make sure ml < mr
|
|
1583
|
+
a, b = ml, mr
|
|
1584
|
+
else:
|
|
1585
|
+
a, b = mr, ml
|
|
1586
|
+
cr = -cr
|
|
1587
|
+
for b_elt, coeff in self.parent()._rewrite_bracket(a, b).items():
|
|
1588
|
+
d[b_elt] = d.get(b_elt, zero) + cl * cr * coeff
|
|
1589
|
+
if d[b_elt] == zero:
|
|
1590
|
+
del d[b_elt]
|
|
1591
|
+
|
|
1592
|
+
if not d:
|
|
1593
|
+
return self.parent().zero()
|
|
1594
|
+
return type(self)(self.parent(), d)
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
#####################################################################
|
|
1598
|
+
# Helper classes for free Lie algebras
|
|
1599
|
+
|
|
1600
|
+
cdef class LieObject(SageObject):
|
|
1601
|
+
"""
|
|
1602
|
+
Abstract base class for :class:`LieGenerator` and :class:`LieBracket`.
|
|
1603
|
+
"""
|
|
1604
|
+
cpdef tuple to_word(self):
|
|
1605
|
+
"""
|
|
1606
|
+
Return the word ("flattening") of ``self``.
|
|
1607
|
+
|
|
1608
|
+
If ``self`` is a tree of Lie brackets, this word is
|
|
1609
|
+
usually obtained by "forgetting the brackets".
|
|
1610
|
+
|
|
1611
|
+
TESTS::
|
|
1612
|
+
|
|
1613
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieObject
|
|
1614
|
+
sage: x = LieObject()
|
|
1615
|
+
sage: x.to_word()
|
|
1616
|
+
Traceback (most recent call last):
|
|
1617
|
+
...
|
|
1618
|
+
NotImplementedError
|
|
1619
|
+
"""
|
|
1620
|
+
raise NotImplementedError
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
cdef class LieGenerator(LieObject):
|
|
1624
|
+
"""
|
|
1625
|
+
A wrapper around an object so it can ducktype with and do
|
|
1626
|
+
comparison operations with :class:`LieBracket`.
|
|
1627
|
+
"""
|
|
1628
|
+
def __init__(self, name, index):
|
|
1629
|
+
"""
|
|
1630
|
+
Initialize ``self``.
|
|
1631
|
+
|
|
1632
|
+
EXAMPLES::
|
|
1633
|
+
|
|
1634
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
|
|
1635
|
+
sage: x = LieGenerator('x', 0)
|
|
1636
|
+
sage: TestSuite(x).run()
|
|
1637
|
+
"""
|
|
1638
|
+
self._word = (name,)
|
|
1639
|
+
self._name = name
|
|
1640
|
+
self._index_word = (index,)
|
|
1641
|
+
|
|
1642
|
+
def __reduce__(self):
|
|
1643
|
+
"""
|
|
1644
|
+
EXAMPLES::
|
|
1645
|
+
|
|
1646
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
|
|
1647
|
+
sage: x = LieGenerator('x', 0)
|
|
1648
|
+
sage: loads(dumps(x)) == x
|
|
1649
|
+
True
|
|
1650
|
+
"""
|
|
1651
|
+
return (LieGenerator, (self._name, self._index_word[0]))
|
|
1652
|
+
|
|
1653
|
+
def _repr_(self):
|
|
1654
|
+
"""
|
|
1655
|
+
Return a string representation of ``self``.
|
|
1656
|
+
|
|
1657
|
+
EXAMPLES::
|
|
1658
|
+
|
|
1659
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
|
|
1660
|
+
sage: LieGenerator('x', 0)
|
|
1661
|
+
x
|
|
1662
|
+
"""
|
|
1663
|
+
return self._name
|
|
1664
|
+
|
|
1665
|
+
_latex_ = _repr_
|
|
1666
|
+
|
|
1667
|
+
def __hash__(self):
|
|
1668
|
+
"""
|
|
1669
|
+
Return the hash value of ``self``.
|
|
1670
|
+
|
|
1671
|
+
EXAMPLES::
|
|
1672
|
+
|
|
1673
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
|
|
1674
|
+
sage: x = LieGenerator('x', 0)
|
|
1675
|
+
sage: hash(x) == hash('x')
|
|
1676
|
+
True
|
|
1677
|
+
"""
|
|
1678
|
+
return hash(self._name)
|
|
1679
|
+
|
|
1680
|
+
def __richcmp__(self, rhs, int op):
|
|
1681
|
+
"""
|
|
1682
|
+
Compare equals.
|
|
1683
|
+
|
|
1684
|
+
EXAMPLES::
|
|
1685
|
+
|
|
1686
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1687
|
+
sage: x = LieGenerator('x', 0)
|
|
1688
|
+
sage: y = LieGenerator('y', 1)
|
|
1689
|
+
sage: x == y
|
|
1690
|
+
False
|
|
1691
|
+
sage: x < y
|
|
1692
|
+
True
|
|
1693
|
+
sage: y < x
|
|
1694
|
+
False
|
|
1695
|
+
sage: z = LieGenerator('x', 0)
|
|
1696
|
+
sage: x == z
|
|
1697
|
+
True
|
|
1698
|
+
sage: z = LieBracket(x, y)
|
|
1699
|
+
sage: x < z
|
|
1700
|
+
True
|
|
1701
|
+
"""
|
|
1702
|
+
if isinstance(rhs, LieBracket):
|
|
1703
|
+
if op == Py_NE:
|
|
1704
|
+
return True
|
|
1705
|
+
if op == Py_EQ:
|
|
1706
|
+
return False
|
|
1707
|
+
return NotImplemented
|
|
1708
|
+
# This causes the comparison to be done ``rhs``
|
|
1709
|
+
# (different subclasses of ``LieBracket`` may
|
|
1710
|
+
# compare differently with objects in ``LieGenerator``).
|
|
1711
|
+
# (Python automatically tries to check ``rhs > self``
|
|
1712
|
+
# when the comparison ``self < rhs`` returns a
|
|
1713
|
+
# NotImplemented error.)
|
|
1714
|
+
if isinstance(rhs, LieGenerator):
|
|
1715
|
+
return richcmp(self._index_word[0], <LieGenerator>(rhs)._index_word[0], op)
|
|
1716
|
+
return op == Py_NE
|
|
1717
|
+
|
|
1718
|
+
def _im_gens_(self, codomain, im_gens, names):
|
|
1719
|
+
"""
|
|
1720
|
+
Return the image of ``self`` in ``codomain`` under the
|
|
1721
|
+
map that sends the generators of the parent of ``self``
|
|
1722
|
+
to the elements of the tuple ``im_gens``.
|
|
1723
|
+
``names`` should be the list of all names of the domain
|
|
1724
|
+
where ``self`` comes from.
|
|
1725
|
+
|
|
1726
|
+
EXAMPLES::
|
|
1727
|
+
|
|
1728
|
+
sage: L = LieAlgebra(QQ, 'x,y,z')
|
|
1729
|
+
sage: Lyn = L.Lyndon()
|
|
1730
|
+
sage: H = L.Hall()
|
|
1731
|
+
sage: im = H(Lyn.lie_algebra_generators()['x']); im # indirect doctest
|
|
1732
|
+
x
|
|
1733
|
+
sage: im.parent() is H
|
|
1734
|
+
True
|
|
1735
|
+
"""
|
|
1736
|
+
return im_gens[names.index(self._name)]
|
|
1737
|
+
|
|
1738
|
+
cpdef tuple to_word(self):
|
|
1739
|
+
"""
|
|
1740
|
+
Return the word ("flattening") of ``self``.
|
|
1741
|
+
|
|
1742
|
+
If ``self`` is a tree of Lie brackets, this word is
|
|
1743
|
+
usually obtained by "forgetting the brackets".
|
|
1744
|
+
|
|
1745
|
+
EXAMPLES::
|
|
1746
|
+
|
|
1747
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
|
|
1748
|
+
sage: x = LieGenerator('x', 0)
|
|
1749
|
+
sage: x.to_word()
|
|
1750
|
+
('x',)
|
|
1751
|
+
"""
|
|
1752
|
+
return self._word
|
|
1753
|
+
|
|
1754
|
+
cpdef lift(self, dict UEA_gens_dict):
|
|
1755
|
+
"""
|
|
1756
|
+
Lift ``self`` to the universal enveloping algebra.
|
|
1757
|
+
|
|
1758
|
+
``UEA_gens_dict`` should be the dictionary for the
|
|
1759
|
+
generators of the universal enveloping algebra.
|
|
1760
|
+
|
|
1761
|
+
EXAMPLES::
|
|
1762
|
+
|
|
1763
|
+
sage: L = LieAlgebra(QQ, 'x,y,z')
|
|
1764
|
+
sage: Lyn = L.Lyndon()
|
|
1765
|
+
sage: x,y,z = Lyn.gens()
|
|
1766
|
+
sage: x.lift()
|
|
1767
|
+
x
|
|
1768
|
+
sage: x.lift().parent()
|
|
1769
|
+
Free Algebra on 3 generators (x, y, z) over Rational Field
|
|
1770
|
+
"""
|
|
1771
|
+
return UEA_gens_dict[self._name]
|
|
1772
|
+
|
|
1773
|
+
cdef class LieBracket(LieObject):
|
|
1774
|
+
"""
|
|
1775
|
+
An abstract Lie bracket (formally, just a binary tree).
|
|
1776
|
+
"""
|
|
1777
|
+
def __init__(self, LieObject l, LieObject r):
|
|
1778
|
+
"""
|
|
1779
|
+
Initialize ``self``.
|
|
1780
|
+
|
|
1781
|
+
EXAMPLES::
|
|
1782
|
+
|
|
1783
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1784
|
+
sage: x = LieGenerator('x', 0)
|
|
1785
|
+
sage: y = LieGenerator('y', 1)
|
|
1786
|
+
sage: z = LieBracket(x, y)
|
|
1787
|
+
sage: TestSuite(z).run()
|
|
1788
|
+
"""
|
|
1789
|
+
self._left = l
|
|
1790
|
+
self._right = r
|
|
1791
|
+
self._word = ()
|
|
1792
|
+
self._index_word = self._left._index_word + self._right._index_word
|
|
1793
|
+
self._hash = -1
|
|
1794
|
+
|
|
1795
|
+
def __reduce__(self):
|
|
1796
|
+
"""
|
|
1797
|
+
EXAMPLES::
|
|
1798
|
+
|
|
1799
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1800
|
+
sage: x = LieGenerator('x', 0)
|
|
1801
|
+
sage: y = LieGenerator('y', 1)
|
|
1802
|
+
sage: z = LieBracket(x, y)
|
|
1803
|
+
sage: loads(dumps(z)) == z
|
|
1804
|
+
True
|
|
1805
|
+
"""
|
|
1806
|
+
return (LieBracket, (self._left, self._right))
|
|
1807
|
+
|
|
1808
|
+
def _repr_(self):
|
|
1809
|
+
"""
|
|
1810
|
+
Return a string representation of ``self``.
|
|
1811
|
+
|
|
1812
|
+
EXAMPLES::
|
|
1813
|
+
|
|
1814
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1815
|
+
sage: x = LieGenerator('x', 0)
|
|
1816
|
+
sage: y = LieGenerator('y', 1)
|
|
1817
|
+
sage: LieBracket(x, y)
|
|
1818
|
+
[x, y]
|
|
1819
|
+
"""
|
|
1820
|
+
return "[{!s}, {!s}]".format(self._left, self._right)
|
|
1821
|
+
|
|
1822
|
+
def _latex_(self):
|
|
1823
|
+
r"""
|
|
1824
|
+
Return a `\LaTeX` representation of ``self``.
|
|
1825
|
+
|
|
1826
|
+
EXAMPLES::
|
|
1827
|
+
|
|
1828
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1829
|
+
sage: x = LieGenerator('x', 0)
|
|
1830
|
+
sage: y = LieGenerator('y', 1)
|
|
1831
|
+
sage: z = LieBracket(x, y)
|
|
1832
|
+
sage: latex(z)
|
|
1833
|
+
\left[ x , y \right]
|
|
1834
|
+
"""
|
|
1835
|
+
from sage.misc.latex import latex
|
|
1836
|
+
return "\\left[" + latex(self._left) + "," + latex(self._right) + "\\right]"
|
|
1837
|
+
|
|
1838
|
+
def __getitem__(self, i):
|
|
1839
|
+
r"""
|
|
1840
|
+
Return the `i`-th item of ``self``.
|
|
1841
|
+
|
|
1842
|
+
EXAMPLES::
|
|
1843
|
+
|
|
1844
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1845
|
+
sage: x = LieGenerator('x', 0)
|
|
1846
|
+
sage: y = LieGenerator('y', 1)
|
|
1847
|
+
sage: z = LieBracket(x, y)
|
|
1848
|
+
sage: z[0]
|
|
1849
|
+
x
|
|
1850
|
+
sage: z[1] is y
|
|
1851
|
+
True
|
|
1852
|
+
sage: z[2]
|
|
1853
|
+
Traceback (most recent call last):
|
|
1854
|
+
...
|
|
1855
|
+
IndexError: must be either 0 or 1
|
|
1856
|
+
"""
|
|
1857
|
+
if i == 0:
|
|
1858
|
+
return self._left
|
|
1859
|
+
if i == 1:
|
|
1860
|
+
return self._right
|
|
1861
|
+
raise IndexError("must be either 0 or 1")
|
|
1862
|
+
|
|
1863
|
+
def __richcmp__(self, rhs, int op):
|
|
1864
|
+
"""
|
|
1865
|
+
Check equality.
|
|
1866
|
+
|
|
1867
|
+
EXAMPLES::
|
|
1868
|
+
|
|
1869
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1870
|
+
sage: x = LieGenerator('x', 0)
|
|
1871
|
+
sage: y = LieGenerator('y', 1)
|
|
1872
|
+
sage: z = LieGenerator('z', 2)
|
|
1873
|
+
sage: b = LieBracket(x, y)
|
|
1874
|
+
sage: c = LieBracket(y, x)
|
|
1875
|
+
sage: b == c
|
|
1876
|
+
False
|
|
1877
|
+
sage: b == x
|
|
1878
|
+
False
|
|
1879
|
+
sage: b < x
|
|
1880
|
+
False
|
|
1881
|
+
sage: b < z
|
|
1882
|
+
False
|
|
1883
|
+
sage: a = LieBracket(x, y)
|
|
1884
|
+
sage: a == b
|
|
1885
|
+
True
|
|
1886
|
+
sage: a == [x, y]
|
|
1887
|
+
True
|
|
1888
|
+
sage: c = LieBracket(x, z)
|
|
1889
|
+
sage: b < c
|
|
1890
|
+
True
|
|
1891
|
+
"""
|
|
1892
|
+
cdef LieBracket right
|
|
1893
|
+
if isinstance(rhs, LieBracket):
|
|
1894
|
+
right = <LieBracket>(rhs)
|
|
1895
|
+
return richcmp([self._left, self._right], [right._left, right._right], op)
|
|
1896
|
+
if isinstance(rhs, LieGenerator):
|
|
1897
|
+
# Check this is right as in LieGenerator.__richcmp__
|
|
1898
|
+
return op == Py_NE or op == Py_GT or op == Py_GE
|
|
1899
|
+
if isinstance(rhs, list):
|
|
1900
|
+
return richcmp([self._left, self._right], rhs, op)
|
|
1901
|
+
return op == Py_NE
|
|
1902
|
+
|
|
1903
|
+
def __hash__(self):
|
|
1904
|
+
"""
|
|
1905
|
+
Return the hash value of ``self``.
|
|
1906
|
+
|
|
1907
|
+
EXAMPLES::
|
|
1908
|
+
|
|
1909
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1910
|
+
sage: x = LieGenerator('x', 0)
|
|
1911
|
+
sage: y = LieGenerator('y', 1)
|
|
1912
|
+
sage: z = LieGenerator('z', 2)
|
|
1913
|
+
sage: b = LieBracket(x, y)
|
|
1914
|
+
sage: hash(b) == hash(b)
|
|
1915
|
+
True
|
|
1916
|
+
"""
|
|
1917
|
+
if self._hash == -1:
|
|
1918
|
+
self._hash = hash((self._left, self._right))
|
|
1919
|
+
return self._hash
|
|
1920
|
+
|
|
1921
|
+
def _im_gens_(self, codomain, im_gens, names):
|
|
1922
|
+
"""
|
|
1923
|
+
Return the image of ``self`` in ``codomain`` under the
|
|
1924
|
+
map that sends the generators of the parent of ``self``
|
|
1925
|
+
to the elements of the tuple ``im_gens``.
|
|
1926
|
+
``names`` should be the list of all names of the domain
|
|
1927
|
+
where ``self`` comes from.
|
|
1928
|
+
|
|
1929
|
+
EXAMPLES::
|
|
1930
|
+
|
|
1931
|
+
sage: L = LieAlgebra(QQ, 'x,y,z')
|
|
1932
|
+
sage: Lyn = L.Lyndon()
|
|
1933
|
+
sage: H = L.Hall()
|
|
1934
|
+
sage: x,y,z = Lyn.gens()
|
|
1935
|
+
sage: im = H(Lyn([z, [[x, y], x]])); im # indirect doctest
|
|
1936
|
+
-[z, [x, [x, y]]]
|
|
1937
|
+
sage: im.parent() is H
|
|
1938
|
+
True
|
|
1939
|
+
"""
|
|
1940
|
+
return codomain.bracket(self._left._im_gens_(codomain, im_gens, names),
|
|
1941
|
+
self._right._im_gens_(codomain, im_gens, names))
|
|
1942
|
+
|
|
1943
|
+
cpdef lift(self, dict UEA_gens_dict):
|
|
1944
|
+
"""
|
|
1945
|
+
Lift ``self`` to the universal enveloping algebra.
|
|
1946
|
+
|
|
1947
|
+
``UEA_gens_dict`` should be the dictionary for the
|
|
1948
|
+
generators of the universal enveloping algebra.
|
|
1949
|
+
|
|
1950
|
+
EXAMPLES::
|
|
1951
|
+
|
|
1952
|
+
sage: L = LieAlgebra(QQ, 'x,y,z')
|
|
1953
|
+
sage: Lyn = L.Lyndon()
|
|
1954
|
+
sage: x,y,z = Lyn.gens()
|
|
1955
|
+
sage: a = Lyn([z, [[x, y], x]]); a
|
|
1956
|
+
[x, [x, [y, z]]] + [x, [[x, z], y]] - [[x, y], [x, z]]
|
|
1957
|
+
sage: a.lift() # indirect doctest
|
|
1958
|
+
x^2*y*z - 2*x*y*x*z + y*x^2*z - z*x^2*y + 2*z*x*y*x - z*y*x^2
|
|
1959
|
+
"""
|
|
1960
|
+
if isinstance(self._left, LieBracket):
|
|
1961
|
+
l = self._left.lift(UEA_gens_dict)
|
|
1962
|
+
else:
|
|
1963
|
+
l = UEA_gens_dict[self._left._name]
|
|
1964
|
+
|
|
1965
|
+
if isinstance(self._right, LieBracket):
|
|
1966
|
+
r = self._right.lift(UEA_gens_dict)
|
|
1967
|
+
else:
|
|
1968
|
+
r = UEA_gens_dict[self._right._name]
|
|
1969
|
+
|
|
1970
|
+
return l*r - r*l
|
|
1971
|
+
|
|
1972
|
+
cpdef tuple to_word(self):
|
|
1973
|
+
"""
|
|
1974
|
+
Return the word ("flattening") of ``self``.
|
|
1975
|
+
|
|
1976
|
+
If ``self`` is a tree of Lie brackets, this word is
|
|
1977
|
+
usually obtained by "forgetting the brackets".
|
|
1978
|
+
|
|
1979
|
+
EXAMPLES::
|
|
1980
|
+
|
|
1981
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
|
|
1982
|
+
sage: x = LieGenerator('x', 0)
|
|
1983
|
+
sage: y = LieGenerator('y', 1)
|
|
1984
|
+
sage: b = LieBracket(x, y)
|
|
1985
|
+
sage: c = LieBracket(b, x)
|
|
1986
|
+
sage: c.to_word()
|
|
1987
|
+
('x', 'y', 'x')
|
|
1988
|
+
"""
|
|
1989
|
+
if not self._word:
|
|
1990
|
+
self._word = self._left.to_word() + self._right.to_word()
|
|
1991
|
+
return self._word
|
|
1992
|
+
|
|
1993
|
+
cdef class GradedLieBracket(LieBracket):
|
|
1994
|
+
"""
|
|
1995
|
+
A Lie bracket (:class:`LieBracket`) for a graded Lie algebra.
|
|
1996
|
+
|
|
1997
|
+
Unlike the vanilla Lie bracket class, this also stores a
|
|
1998
|
+
degree, and uses it as a first criterion when comparing
|
|
1999
|
+
graded Lie brackets.
|
|
2000
|
+
(Graded Lie brackets still compare greater than Lie
|
|
2001
|
+
generators.)
|
|
2002
|
+
"""
|
|
2003
|
+
def __init__(self, LieObject l, LieObject r, grade):
|
|
2004
|
+
"""
|
|
2005
|
+
Initialize ``self``.
|
|
2006
|
+
|
|
2007
|
+
EXAMPLES::
|
|
2008
|
+
|
|
2009
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, GradedLieBracket
|
|
2010
|
+
sage: x = LieGenerator('x', 0)
|
|
2011
|
+
sage: y = LieGenerator('y', 1)
|
|
2012
|
+
sage: b = GradedLieBracket(x, y, 2)
|
|
2013
|
+
sage: TestSuite(b).run()
|
|
2014
|
+
"""
|
|
2015
|
+
self._grade = grade
|
|
2016
|
+
LieBracket.__init__(self, l, r)
|
|
2017
|
+
|
|
2018
|
+
def __reduce__(self):
|
|
2019
|
+
"""
|
|
2020
|
+
EXAMPLES::
|
|
2021
|
+
|
|
2022
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, GradedLieBracket
|
|
2023
|
+
sage: x = LieGenerator('x', 0)
|
|
2024
|
+
sage: y = LieGenerator('y', 1)
|
|
2025
|
+
sage: b = GradedLieBracket(x, y, 2)
|
|
2026
|
+
sage: loads(dumps(b)) == b
|
|
2027
|
+
True
|
|
2028
|
+
"""
|
|
2029
|
+
return (type(self), (self._left, self._right, self._grade))
|
|
2030
|
+
|
|
2031
|
+
def __richcmp__(self, rhs, int op):
|
|
2032
|
+
"""
|
|
2033
|
+
Check less than.
|
|
2034
|
+
|
|
2035
|
+
EXAMPLES::
|
|
2036
|
+
|
|
2037
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, GradedLieBracket
|
|
2038
|
+
sage: x = LieGenerator('x', 0)
|
|
2039
|
+
sage: y = LieGenerator('y', 1)
|
|
2040
|
+
sage: z = LieGenerator('z', 2)
|
|
2041
|
+
sage: b = GradedLieBracket(x, y, 2)
|
|
2042
|
+
sage: b < x
|
|
2043
|
+
False
|
|
2044
|
+
sage: b < z
|
|
2045
|
+
False
|
|
2046
|
+
sage: c = GradedLieBracket(x, z, 2)
|
|
2047
|
+
sage: b < c
|
|
2048
|
+
True
|
|
2049
|
+
sage: c = GradedLieBracket(x, z, 1)
|
|
2050
|
+
sage: b < c
|
|
2051
|
+
False
|
|
2052
|
+
"""
|
|
2053
|
+
cdef GradedLieBracket right
|
|
2054
|
+
if isinstance(rhs, GradedLieBracket):
|
|
2055
|
+
right = <GradedLieBracket>(rhs)
|
|
2056
|
+
if self._grade != right._grade:
|
|
2057
|
+
return richcmp_not_equal(self._grade, right._grade, op)
|
|
2058
|
+
return richcmp([self._left, self._right], [right._left, right._right], op)
|
|
2059
|
+
if isinstance(rhs, LieGenerator):
|
|
2060
|
+
return op == Py_NE or op == Py_GT or op == Py_GE
|
|
2061
|
+
return op == Py_NE
|
|
2062
|
+
|
|
2063
|
+
def __hash__(self):
|
|
2064
|
+
"""
|
|
2065
|
+
Return the hash value of ``self``.
|
|
2066
|
+
|
|
2067
|
+
EXAMPLES::
|
|
2068
|
+
|
|
2069
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, GradedLieBracket
|
|
2070
|
+
sage: x = LieGenerator('x', 0)
|
|
2071
|
+
sage: y = LieGenerator('y', 1)
|
|
2072
|
+
sage: z = LieGenerator('z', 2)
|
|
2073
|
+
sage: b = GradedLieBracket(x, y, 2)
|
|
2074
|
+
sage: hash(b) == hash(b)
|
|
2075
|
+
True
|
|
2076
|
+
"""
|
|
2077
|
+
if self._hash == -1:
|
|
2078
|
+
self._hash = hash((self._grade, self._left, self._right))
|
|
2079
|
+
return self._hash
|
|
2080
|
+
|
|
2081
|
+
cdef class LyndonBracket(GradedLieBracket):
|
|
2082
|
+
"""
|
|
2083
|
+
A Lie bracket (:class:`LieBracket`) tailored for the Lyndon
|
|
2084
|
+
basis.
|
|
2085
|
+
|
|
2086
|
+
The order on these brackets is defined by `l < r`
|
|
2087
|
+
if `w(l) < w(r)`, where `w(l)` is the word corresponding
|
|
2088
|
+
to `l`.
|
|
2089
|
+
(This is also true if one or both of `l` and `r` is a
|
|
2090
|
+
:class:`LieGenerator`.)
|
|
2091
|
+
"""
|
|
2092
|
+
def __richcmp__(self, rhs, op):
|
|
2093
|
+
"""
|
|
2094
|
+
Compare ``self`` and ``rhs``.
|
|
2095
|
+
|
|
2096
|
+
EXAMPLES::
|
|
2097
|
+
|
|
2098
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LyndonBracket
|
|
2099
|
+
sage: x,y,z = [LieGenerator(letter, ind) for letter,ind in zip(['x', 'y', 'z'],range(3))]
|
|
2100
|
+
sage: LyndonBracket(x, LyndonBracket(y, z, 2), 3) < LyndonBracket(LyndonBracket(y, z, 2), x, 3)
|
|
2101
|
+
True
|
|
2102
|
+
"""
|
|
2103
|
+
if not isinstance(rhs, LieObject):
|
|
2104
|
+
return op == Py_NE
|
|
2105
|
+
return richcmp(self._index_word, <LieObject>(rhs)._index_word, op)
|
|
2106
|
+
|
|
2107
|
+
def __hash__(self):
|
|
2108
|
+
"""
|
|
2109
|
+
Return the hash of ``self``.
|
|
2110
|
+
|
|
2111
|
+
EXAMPLES::
|
|
2112
|
+
|
|
2113
|
+
sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LyndonBracket
|
|
2114
|
+
sage: x = LieGenerator('x', 0)
|
|
2115
|
+
sage: y = LieGenerator('y', 1)
|
|
2116
|
+
sage: b = LyndonBracket(x, y, 2)
|
|
2117
|
+
sage: hash(b) == hash((0, 1))
|
|
2118
|
+
True
|
|
2119
|
+
"""
|
|
2120
|
+
if self._hash == -1:
|
|
2121
|
+
self._hash = hash(self._index_word)
|
|
2122
|
+
return self._hash
|