passagemath-categories 10.6.32__cp314-cp314t-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.
- passagemath_categories-10.6.32.dist-info/METADATA +156 -0
- passagemath_categories-10.6.32.dist-info/RECORD +719 -0
- passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
- passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
- passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
- passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
- sage/all__sagemath_categories.py +28 -0
- sage/arith/all.py +38 -0
- sage/arith/constants.pxd +27 -0
- sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/functions.pxd +4 -0
- sage/arith/functions.pyx +221 -0
- sage/arith/misc.py +6552 -0
- sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/multi_modular.pxd +39 -0
- sage/arith/multi_modular.pyx +994 -0
- sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/rational_reconstruction.pxd +4 -0
- sage/arith/rational_reconstruction.pyx +115 -0
- sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/srange.pyx +571 -0
- sage/calculus/all__sagemath_categories.py +2 -0
- sage/calculus/functional.py +481 -0
- sage/calculus/functions.py +151 -0
- sage/categories/additive_groups.py +73 -0
- sage/categories/additive_magmas.py +1044 -0
- sage/categories/additive_monoids.py +114 -0
- sage/categories/additive_semigroups.py +184 -0
- sage/categories/affine_weyl_groups.py +238 -0
- sage/categories/algebra_ideals.py +95 -0
- sage/categories/algebra_modules.py +96 -0
- sage/categories/algebras.py +349 -0
- sage/categories/algebras_with_basis.py +377 -0
- sage/categories/all.py +160 -0
- sage/categories/aperiodic_semigroups.py +29 -0
- sage/categories/associative_algebras.py +47 -0
- sage/categories/bialgebras.py +101 -0
- sage/categories/bialgebras_with_basis.py +414 -0
- sage/categories/bimodules.py +206 -0
- sage/categories/chain_complexes.py +268 -0
- sage/categories/classical_crystals.py +480 -0
- sage/categories/coalgebras.py +405 -0
- sage/categories/coalgebras_with_basis.py +232 -0
- sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/coercion_methods.pyx +52 -0
- sage/categories/commutative_additive_groups.py +104 -0
- sage/categories/commutative_additive_monoids.py +45 -0
- sage/categories/commutative_additive_semigroups.py +48 -0
- sage/categories/commutative_algebra_ideals.py +87 -0
- sage/categories/commutative_algebras.py +94 -0
- sage/categories/commutative_ring_ideals.py +58 -0
- sage/categories/commutative_rings.py +736 -0
- sage/categories/complete_discrete_valuation.py +293 -0
- sage/categories/complex_reflection_groups.py +145 -0
- sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
- sage/categories/coxeter_group_algebras.py +186 -0
- sage/categories/coxeter_groups.py +3402 -0
- sage/categories/crystals.py +2628 -0
- sage/categories/cw_complexes.py +216 -0
- sage/categories/dedekind_domains.py +137 -0
- sage/categories/discrete_valuation.py +325 -0
- sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
- sage/categories/division_rings.py +114 -0
- sage/categories/domains.py +95 -0
- sage/categories/drinfeld_modules.py +789 -0
- sage/categories/dual.py +42 -0
- sage/categories/enumerated_sets.py +1146 -0
- sage/categories/euclidean_domains.py +271 -0
- sage/categories/examples/algebras_with_basis.py +102 -0
- sage/categories/examples/all.py +1 -0
- sage/categories/examples/commutative_additive_monoids.py +130 -0
- sage/categories/examples/commutative_additive_semigroups.py +199 -0
- sage/categories/examples/coxeter_groups.py +8 -0
- sage/categories/examples/crystals.py +236 -0
- sage/categories/examples/cw_complexes.py +163 -0
- sage/categories/examples/facade_sets.py +187 -0
- sage/categories/examples/filtered_algebras_with_basis.py +204 -0
- sage/categories/examples/filtered_modules_with_basis.py +154 -0
- sage/categories/examples/finite_coxeter_groups.py +252 -0
- sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
- sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
- sage/categories/examples/finite_enumerated_sets.py +208 -0
- sage/categories/examples/finite_monoids.py +150 -0
- sage/categories/examples/finite_semigroups.py +190 -0
- sage/categories/examples/finite_weyl_groups.py +191 -0
- sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
- sage/categories/examples/graded_modules_with_basis.py +168 -0
- sage/categories/examples/graphs.py +122 -0
- sage/categories/examples/hopf_algebras_with_basis.py +145 -0
- sage/categories/examples/infinite_enumerated_sets.py +190 -0
- sage/categories/examples/lie_algebras.py +352 -0
- sage/categories/examples/lie_algebras_with_basis.py +196 -0
- sage/categories/examples/magmas.py +162 -0
- sage/categories/examples/manifolds.py +94 -0
- sage/categories/examples/monoids.py +144 -0
- sage/categories/examples/posets.py +178 -0
- sage/categories/examples/semigroups.py +580 -0
- sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/examples/semigroups_cython.pyx +221 -0
- sage/categories/examples/semirings.py +249 -0
- sage/categories/examples/sets_cat.py +706 -0
- sage/categories/examples/sets_with_grading.py +101 -0
- sage/categories/examples/with_realizations.py +542 -0
- sage/categories/fields.py +991 -0
- sage/categories/filtered_algebras.py +63 -0
- sage/categories/filtered_algebras_with_basis.py +548 -0
- sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
- sage/categories/filtered_modules.py +210 -0
- sage/categories/filtered_modules_with_basis.py +1209 -0
- sage/categories/finite_complex_reflection_groups.py +1506 -0
- sage/categories/finite_coxeter_groups.py +1138 -0
- sage/categories/finite_crystals.py +103 -0
- sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
- sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
- sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
- sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
- sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
- sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
- sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
- sage/categories/finite_enumerated_sets.py +769 -0
- sage/categories/finite_fields.py +252 -0
- sage/categories/finite_groups.py +256 -0
- sage/categories/finite_lattice_posets.py +242 -0
- sage/categories/finite_monoids.py +316 -0
- sage/categories/finite_permutation_groups.py +339 -0
- sage/categories/finite_posets.py +1994 -0
- sage/categories/finite_semigroups.py +136 -0
- sage/categories/finite_sets.py +93 -0
- sage/categories/finite_weyl_groups.py +39 -0
- sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
- sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
- sage/categories/finitely_generated_magmas.py +57 -0
- sage/categories/finitely_generated_semigroups.py +214 -0
- sage/categories/function_fields.py +76 -0
- sage/categories/g_sets.py +77 -0
- sage/categories/gcd_domains.py +65 -0
- sage/categories/generalized_coxeter_groups.py +94 -0
- sage/categories/graded_algebras.py +85 -0
- sage/categories/graded_algebras_with_basis.py +258 -0
- sage/categories/graded_bialgebras.py +32 -0
- sage/categories/graded_bialgebras_with_basis.py +32 -0
- sage/categories/graded_coalgebras.py +65 -0
- sage/categories/graded_coalgebras_with_basis.py +51 -0
- sage/categories/graded_hopf_algebras.py +41 -0
- sage/categories/graded_hopf_algebras_with_basis.py +169 -0
- sage/categories/graded_lie_algebras.py +91 -0
- sage/categories/graded_lie_algebras_with_basis.py +44 -0
- sage/categories/graded_lie_conformal_algebras.py +74 -0
- sage/categories/graded_modules.py +133 -0
- sage/categories/graded_modules_with_basis.py +329 -0
- sage/categories/graphs.py +138 -0
- sage/categories/group_algebras.py +430 -0
- sage/categories/groupoid.py +94 -0
- sage/categories/groups.py +667 -0
- sage/categories/h_trivial_semigroups.py +64 -0
- sage/categories/hecke_modules.py +185 -0
- sage/categories/highest_weight_crystals.py +980 -0
- sage/categories/hopf_algebras.py +219 -0
- sage/categories/hopf_algebras_with_basis.py +309 -0
- sage/categories/infinite_enumerated_sets.py +115 -0
- sage/categories/integral_domains.py +203 -0
- sage/categories/j_trivial_semigroups.py +29 -0
- sage/categories/kac_moody_algebras.py +82 -0
- sage/categories/kahler_algebras.py +203 -0
- sage/categories/l_trivial_semigroups.py +63 -0
- sage/categories/lambda_bracket_algebras.py +280 -0
- sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
- sage/categories/lattice_posets.py +89 -0
- sage/categories/left_modules.py +49 -0
- sage/categories/lie_algebras.py +1070 -0
- sage/categories/lie_algebras_with_basis.py +261 -0
- sage/categories/lie_conformal_algebras.py +350 -0
- sage/categories/lie_conformal_algebras_with_basis.py +147 -0
- sage/categories/lie_groups.py +73 -0
- sage/categories/loop_crystals.py +1290 -0
- sage/categories/magmas.py +1189 -0
- sage/categories/magmas_and_additive_magmas.py +149 -0
- sage/categories/magmatic_algebras.py +365 -0
- sage/categories/manifolds.py +352 -0
- sage/categories/matrix_algebras.py +40 -0
- sage/categories/metric_spaces.py +387 -0
- sage/categories/modular_abelian_varieties.py +78 -0
- sage/categories/modules.py +989 -0
- sage/categories/modules_with_basis.py +2794 -0
- sage/categories/monoid_algebras.py +38 -0
- sage/categories/monoids.py +739 -0
- sage/categories/noetherian_rings.py +87 -0
- sage/categories/number_fields.py +242 -0
- sage/categories/ore_modules.py +189 -0
- sage/categories/partially_ordered_monoids.py +49 -0
- sage/categories/permutation_groups.py +63 -0
- sage/categories/pointed_sets.py +42 -0
- sage/categories/polyhedra.py +74 -0
- sage/categories/poor_man_map.py +270 -0
- sage/categories/posets.py +722 -0
- sage/categories/principal_ideal_domains.py +270 -0
- sage/categories/quantum_group_representations.py +543 -0
- sage/categories/quotient_fields.py +728 -0
- sage/categories/r_trivial_semigroups.py +45 -0
- sage/categories/regular_crystals.py +898 -0
- sage/categories/regular_supercrystals.py +170 -0
- sage/categories/right_modules.py +49 -0
- sage/categories/ring_ideals.py +74 -0
- sage/categories/rings.py +1904 -0
- sage/categories/rngs.py +175 -0
- sage/categories/schemes.py +393 -0
- sage/categories/semigroups.py +1060 -0
- sage/categories/semirings.py +71 -0
- sage/categories/semisimple_algebras.py +114 -0
- sage/categories/sets_with_grading.py +235 -0
- sage/categories/shephard_groups.py +43 -0
- sage/categories/signed_tensor.py +120 -0
- sage/categories/simplicial_complexes.py +134 -0
- sage/categories/simplicial_sets.py +1206 -0
- sage/categories/super_algebras.py +149 -0
- sage/categories/super_algebras_with_basis.py +144 -0
- sage/categories/super_hopf_algebras_with_basis.py +126 -0
- sage/categories/super_lie_conformal_algebras.py +193 -0
- sage/categories/super_modules.py +229 -0
- sage/categories/super_modules_with_basis.py +193 -0
- sage/categories/supercommutative_algebras.py +99 -0
- sage/categories/supercrystals.py +406 -0
- sage/categories/tensor.py +110 -0
- sage/categories/topological_spaces.py +170 -0
- sage/categories/triangular_kac_moody_algebras.py +439 -0
- sage/categories/tutorial.py +58 -0
- sage/categories/unique_factorization_domains.py +318 -0
- sage/categories/unital_algebras.py +426 -0
- sage/categories/vector_bundles.py +159 -0
- sage/categories/vector_spaces.py +357 -0
- sage/categories/weyl_groups.py +853 -0
- sage/combinat/all__sagemath_categories.py +34 -0
- sage/combinat/backtrack.py +180 -0
- sage/combinat/combinat.py +2269 -0
- sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/combinat_cython.pxd +6 -0
- sage/combinat/combinat_cython.pyx +390 -0
- sage/combinat/combination.py +796 -0
- sage/combinat/combinatorial_map.py +416 -0
- sage/combinat/composition.py +2192 -0
- sage/combinat/dlx.py +510 -0
- sage/combinat/integer_lists/__init__.py +7 -0
- sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/base.pxd +16 -0
- sage/combinat/integer_lists/base.pyx +713 -0
- sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/invlex.pxd +4 -0
- sage/combinat/integer_lists/invlex.pyx +1650 -0
- sage/combinat/integer_lists/lists.py +328 -0
- sage/combinat/integer_lists/nn.py +48 -0
- sage/combinat/integer_vector.py +1818 -0
- sage/combinat/integer_vector_weighted.py +413 -0
- sage/combinat/matrices/all__sagemath_categories.py +5 -0
- sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/matrices/dancing_links.pyx +1159 -0
- sage/combinat/matrices/dancing_links_c.h +380 -0
- sage/combinat/matrices/dlxcpp.py +136 -0
- sage/combinat/partition.py +10070 -0
- sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/partitions.pyx +743 -0
- sage/combinat/permutation.py +10168 -0
- sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/permutation_cython.pxd +11 -0
- sage/combinat/permutation_cython.pyx +407 -0
- sage/combinat/q_analogues.py +1090 -0
- sage/combinat/ranker.py +268 -0
- sage/combinat/subset.py +1561 -0
- sage/combinat/subsets_hereditary.py +202 -0
- sage/combinat/subsets_pairwise.py +184 -0
- sage/combinat/tools.py +63 -0
- sage/combinat/tuple.py +348 -0
- sage/data_structures/all.py +2 -0
- sage/data_structures/all__sagemath_categories.py +2 -0
- sage/data_structures/binary_matrix.pxd +138 -0
- sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/binary_search.pxd +3 -0
- sage/data_structures/binary_search.pyx +66 -0
- sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset.pxd +40 -0
- sage/data_structures/bitset.pyx +2385 -0
- sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset_base.pxd +926 -0
- sage/data_structures/bitset_base.pyx +117 -0
- sage/data_structures/bitset_intrinsics.h +487 -0
- sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/blas_dict.pxd +12 -0
- sage/data_structures/blas_dict.pyx +469 -0
- sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/list_of_pairs.pxd +16 -0
- sage/data_structures/list_of_pairs.pyx +122 -0
- sage/data_structures/mutable_poset.py +3312 -0
- sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/pairing_heap.h +346 -0
- sage/data_structures/pairing_heap.pxd +88 -0
- sage/data_structures/pairing_heap.pyx +1464 -0
- sage/data_structures/sparse_bitset.pxd +62 -0
- sage/data_structures/stream.py +5070 -0
- sage/databases/all__sagemath_categories.py +7 -0
- sage/databases/sql_db.py +2236 -0
- sage/ext/all__sagemath_categories.py +3 -0
- sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_callable.pxd +4 -0
- sage/ext/fast_callable.pyx +2746 -0
- sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_eval.pxd +1 -0
- sage/ext/fast_eval.pyx +102 -0
- sage/ext/interpreters/__init__.py +1 -0
- sage/ext/interpreters/all__sagemath_categories.py +2 -0
- sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_el.pxd +18 -0
- sage/ext/interpreters/wrapper_el.pyx +148 -0
- sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_py.pxd +17 -0
- sage/ext/interpreters/wrapper_py.pyx +133 -0
- sage/functions/airy.py +937 -0
- sage/functions/all.py +97 -0
- sage/functions/bessel.py +2102 -0
- sage/functions/error.py +784 -0
- sage/functions/exp_integral.py +1529 -0
- sage/functions/gamma.py +1087 -0
- sage/functions/generalized.py +672 -0
- sage/functions/hyperbolic.py +747 -0
- sage/functions/hypergeometric.py +1156 -0
- sage/functions/jacobi.py +1705 -0
- sage/functions/log.py +1402 -0
- sage/functions/min_max.py +338 -0
- sage/functions/orthogonal_polys.py +3106 -0
- sage/functions/other.py +2303 -0
- sage/functions/piecewise.py +1505 -0
- sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/functions/prime_pi.pyx +262 -0
- sage/functions/special.py +1212 -0
- sage/functions/spike_function.py +278 -0
- sage/functions/transcendental.py +690 -0
- sage/functions/trig.py +1062 -0
- sage/functions/wigner.py +726 -0
- sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/geometry/abc.pyx +82 -0
- sage/geometry/all__sagemath_categories.py +1 -0
- sage/groups/all__sagemath_categories.py +11 -0
- sage/groups/generic.py +1733 -0
- sage/groups/groups_catalog.py +113 -0
- sage/groups/perm_gps/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/all.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
- sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
- sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
- sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
- sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
- sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
- sage/interfaces/abc.py +140 -0
- sage/interfaces/all.py +58 -0
- sage/interfaces/all__sagemath_categories.py +1 -0
- sage/interfaces/expect.py +1643 -0
- sage/interfaces/interface.py +1682 -0
- sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/process.pxd +5 -0
- sage/interfaces/process.pyx +288 -0
- sage/interfaces/quit.py +167 -0
- sage/interfaces/sage0.py +604 -0
- sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/sagespawn.pyx +308 -0
- sage/interfaces/tab_completion.py +101 -0
- sage/misc/all__sagemath_categories.py +78 -0
- sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/allocator.pxd +6 -0
- sage/misc/allocator.pyx +47 -0
- sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/binary_tree.pxd +29 -0
- sage/misc/binary_tree.pyx +537 -0
- sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/callable_dict.pyx +89 -0
- sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/citation.pyx +159 -0
- sage/misc/converting_dict.py +293 -0
- sage/misc/defaults.py +129 -0
- sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/derivative.pyx +223 -0
- sage/misc/functional.py +2005 -0
- sage/misc/html.py +589 -0
- sage/misc/latex.py +2673 -0
- sage/misc/latex_macros.py +236 -0
- sage/misc/latex_standalone.py +1833 -0
- sage/misc/map_threaded.py +38 -0
- sage/misc/mathml.py +76 -0
- sage/misc/method_decorator.py +88 -0
- sage/misc/mrange.py +755 -0
- sage/misc/multireplace.py +41 -0
- sage/misc/object_multiplexer.py +92 -0
- sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/parser.pyx +1107 -0
- sage/misc/random_testing.py +264 -0
- sage/misc/rest_index_of_methods.py +377 -0
- sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/search.pxd +2 -0
- sage/misc/search.pyx +68 -0
- sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/stopgap.pyx +95 -0
- sage/misc/table.py +853 -0
- sage/monoids/all__sagemath_categories.py +1 -0
- sage/monoids/indexed_free_monoid.py +1071 -0
- sage/monoids/monoid.py +82 -0
- sage/numerical/all__sagemath_categories.py +1 -0
- sage/numerical/backends/all__sagemath_categories.py +1 -0
- sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_backend.pxd +61 -0
- sage/numerical/backends/generic_backend.pyx +1893 -0
- sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_sdp_backend.pxd +38 -0
- sage/numerical/backends/generic_sdp_backend.pyx +755 -0
- sage/parallel/all.py +6 -0
- sage/parallel/decorate.py +575 -0
- sage/parallel/map_reduce.py +1997 -0
- sage/parallel/multiprocessing_sage.py +76 -0
- sage/parallel/ncpus.py +35 -0
- sage/parallel/parallelism.py +364 -0
- sage/parallel/reference.py +47 -0
- sage/parallel/use_fork.py +333 -0
- sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/abc.pxd +31 -0
- sage/rings/abc.pyx +526 -0
- sage/rings/algebraic_closure_finite_field.py +1154 -0
- sage/rings/all__sagemath_categories.py +91 -0
- sage/rings/big_oh.py +227 -0
- sage/rings/continued_fraction.py +2754 -0
- sage/rings/continued_fraction_gosper.py +220 -0
- sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/factorint.pyx +295 -0
- sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fast_arith.pxd +21 -0
- sage/rings/fast_arith.pyx +535 -0
- sage/rings/finite_rings/all__sagemath_categories.py +9 -0
- sage/rings/finite_rings/conway_polynomials.py +542 -0
- sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_base.pxd +12 -0
- sage/rings/finite_rings/element_base.pyx +1176 -0
- sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/finite_field_base.pxd +7 -0
- sage/rings/finite_rings/finite_field_base.pyx +2171 -0
- sage/rings/finite_rings/finite_field_constructor.py +827 -0
- sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
- sage/rings/finite_rings/galois_group.py +154 -0
- sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field.pxd +23 -0
- sage/rings/finite_rings/hom_finite_field.pyx +856 -0
- sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
- sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
- sage/rings/finite_rings/homset.py +357 -0
- sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/integer_mod.pxd +56 -0
- sage/rings/finite_rings/integer_mod.pyx +4586 -0
- sage/rings/finite_rings/integer_mod_limits.h +11 -0
- sage/rings/finite_rings/integer_mod_ring.py +2044 -0
- sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field.pxd +30 -0
- sage/rings/finite_rings/residue_field.pyx +1811 -0
- sage/rings/finite_rings/stdint.pxd +19 -0
- sage/rings/fraction_field.py +1452 -0
- sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_element.pyx +1357 -0
- sage/rings/function_field/all.py +7 -0
- sage/rings/function_field/all__sagemath_categories.py +2 -0
- sage/rings/function_field/constructor.py +218 -0
- sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element.pxd +11 -0
- sage/rings/function_field/element.pyx +1008 -0
- sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element_rational.pyx +513 -0
- sage/rings/function_field/extensions.py +230 -0
- sage/rings/function_field/function_field.py +1468 -0
- sage/rings/function_field/function_field_rational.py +1005 -0
- sage/rings/function_field/ideal.py +1155 -0
- sage/rings/function_field/ideal_rational.py +629 -0
- sage/rings/function_field/jacobian_base.py +826 -0
- sage/rings/function_field/jacobian_hess.py +1053 -0
- sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
- sage/rings/function_field/maps.py +1039 -0
- sage/rings/function_field/order.py +281 -0
- sage/rings/function_field/order_basis.py +586 -0
- sage/rings/function_field/order_rational.py +576 -0
- sage/rings/function_field/place.py +426 -0
- sage/rings/function_field/place_rational.py +181 -0
- sage/rings/generic.py +320 -0
- sage/rings/homset.py +332 -0
- sage/rings/ideal.py +1885 -0
- sage/rings/ideal_monoid.py +215 -0
- sage/rings/infinity.py +1890 -0
- sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer.pxd +45 -0
- sage/rings/integer.pyx +7874 -0
- sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer_ring.pxd +8 -0
- sage/rings/integer_ring.pyx +1693 -0
- sage/rings/laurent_series_ring.py +931 -0
- sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/laurent_series_ring_element.pxd +11 -0
- sage/rings/laurent_series_ring_element.pyx +1927 -0
- sage/rings/lazy_series.py +7815 -0
- sage/rings/lazy_series_ring.py +4356 -0
- sage/rings/localization.py +1043 -0
- sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/morphism.pxd +39 -0
- sage/rings/morphism.pyx +3299 -0
- sage/rings/multi_power_series_ring.py +1145 -0
- sage/rings/multi_power_series_ring_element.py +2184 -0
- sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/noncommutative_ideals.pyx +423 -0
- sage/rings/number_field/all__sagemath_categories.py +1 -0
- sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_base.pxd +8 -0
- sage/rings/number_field/number_field_base.pyx +507 -0
- sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element_base.pxd +6 -0
- sage/rings/number_field/number_field_element_base.pyx +36 -0
- sage/rings/number_field/number_field_ideal.py +3550 -0
- sage/rings/padics/all__sagemath_categories.py +4 -0
- sage/rings/padics/local_generic.py +1670 -0
- sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/local_generic_element.pxd +5 -0
- sage/rings/padics/local_generic_element.pyx +1017 -0
- sage/rings/padics/misc.py +256 -0
- sage/rings/padics/padic_generic.py +1911 -0
- sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer.pxd +38 -0
- sage/rings/padics/pow_computer.pyx +671 -0
- sage/rings/padics/precision_error.py +24 -0
- sage/rings/polynomial/all__sagemath_categories.py +25 -0
- sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/commutative_polynomial.pxd +6 -0
- sage/rings/polynomial/commutative_polynomial.pyx +24 -0
- sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/cyclotomic.pyx +404 -0
- sage/rings/polynomial/flatten.py +711 -0
- sage/rings/polynomial/ideal.py +102 -0
- sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
- sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
- sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/laurent_polynomial.pxd +18 -0
- sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
- sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
- sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
- sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
- sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial.pxd +12 -0
- sage/rings/polynomial/multi_polynomial.pyx +3082 -0
- sage/rings/polynomial/multi_polynomial_element.py +2570 -0
- sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
- sage/rings/polynomial/multi_polynomial_ring.py +947 -0
- sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
- sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
- sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polydict.pxd +45 -0
- sage/rings/polynomial/polydict.pyx +2701 -0
- sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_compiled.pxd +59 -0
- sage/rings/polynomial/polynomial_compiled.pyx +509 -0
- sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_element.pxd +64 -0
- sage/rings/polynomial/polynomial_element.pyx +13255 -0
- sage/rings/polynomial/polynomial_element_generic.py +1637 -0
- sage/rings/polynomial/polynomial_fateman.py +97 -0
- sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
- sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
- sage/rings/polynomial/polynomial_ring.py +3784 -0
- sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
- sage/rings/polynomial/polynomial_singular_interface.py +549 -0
- sage/rings/polynomial/symmetric_ideal.py +989 -0
- sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/symmetric_reduction.pxd +8 -0
- sage/rings/polynomial/symmetric_reduction.pyx +669 -0
- sage/rings/polynomial/term_order.py +2279 -0
- sage/rings/polynomial/toy_buchberger.py +449 -0
- sage/rings/polynomial/toy_d_basis.py +387 -0
- sage/rings/polynomial/toy_variety.py +362 -0
- sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_mpoly.pxd +9 -0
- sage/rings/power_series_mpoly.pyx +161 -0
- sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_poly.pxd +10 -0
- sage/rings/power_series_poly.pyx +1317 -0
- sage/rings/power_series_ring.py +1441 -0
- sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_ring_element.pxd +12 -0
- sage/rings/power_series_ring_element.pyx +3028 -0
- sage/rings/puiseux_series_ring.py +487 -0
- sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/puiseux_series_ring_element.pxd +7 -0
- sage/rings/puiseux_series_ring_element.pyx +1055 -0
- sage/rings/qqbar_decorators.py +167 -0
- sage/rings/quotient_ring.py +1598 -0
- sage/rings/quotient_ring_element.py +979 -0
- sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/rational.pxd +20 -0
- sage/rings/rational.pyx +4284 -0
- sage/rings/rational_field.py +1730 -0
- sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_double.pxd +16 -0
- sage/rings/real_double.pyx +2218 -0
- sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_lazy.pxd +30 -0
- sage/rings/real_lazy.pyx +1773 -0
- sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/ring.pxd +30 -0
- sage/rings/ring.pyx +850 -0
- sage/rings/semirings/all.py +3 -0
- sage/rings/semirings/non_negative_integer_semiring.py +107 -0
- sage/rings/semirings/tropical_mpolynomial.py +972 -0
- sage/rings/semirings/tropical_polynomial.py +997 -0
- sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/semirings/tropical_semiring.pyx +676 -0
- sage/rings/semirings/tropical_variety.py +1701 -0
- sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/sum_of_squares.pxd +3 -0
- sage/rings/sum_of_squares.pyx +336 -0
- sage/rings/tests.py +504 -0
- sage/schemes/affine/affine_homset.py +508 -0
- sage/schemes/affine/affine_morphism.py +1574 -0
- sage/schemes/affine/affine_point.py +460 -0
- sage/schemes/affine/affine_rational_point.py +308 -0
- sage/schemes/affine/affine_space.py +1264 -0
- sage/schemes/affine/affine_subscheme.py +592 -0
- sage/schemes/affine/all.py +25 -0
- sage/schemes/all__sagemath_categories.py +5 -0
- sage/schemes/generic/algebraic_scheme.py +2092 -0
- sage/schemes/generic/all.py +5 -0
- sage/schemes/generic/ambient_space.py +400 -0
- sage/schemes/generic/divisor.py +465 -0
- sage/schemes/generic/divisor_group.py +313 -0
- sage/schemes/generic/glue.py +84 -0
- sage/schemes/generic/homset.py +820 -0
- sage/schemes/generic/hypersurface.py +234 -0
- sage/schemes/generic/morphism.py +2107 -0
- sage/schemes/generic/point.py +237 -0
- sage/schemes/generic/scheme.py +1190 -0
- sage/schemes/generic/spec.py +199 -0
- sage/schemes/product_projective/all.py +6 -0
- sage/schemes/product_projective/homset.py +236 -0
- sage/schemes/product_projective/morphism.py +517 -0
- sage/schemes/product_projective/point.py +568 -0
- sage/schemes/product_projective/rational_point.py +550 -0
- sage/schemes/product_projective/space.py +1301 -0
- sage/schemes/product_projective/subscheme.py +466 -0
- sage/schemes/projective/all.py +24 -0
- sage/schemes/projective/proj_bdd_height.py +453 -0
- sage/schemes/projective/projective_homset.py +718 -0
- sage/schemes/projective/projective_morphism.py +2792 -0
- sage/schemes/projective/projective_point.py +1484 -0
- sage/schemes/projective/projective_rational_point.py +569 -0
- sage/schemes/projective/projective_space.py +2571 -0
- sage/schemes/projective/projective_subscheme.py +1574 -0
- sage/sets/all.py +17 -0
- sage/sets/cartesian_product.py +376 -0
- sage/sets/condition_set.py +525 -0
- sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/disjoint_set.pxd +36 -0
- sage/sets/disjoint_set.pyx +998 -0
- sage/sets/disjoint_union_enumerated_sets.py +625 -0
- sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/family.pxd +12 -0
- sage/sets/family.pyx +1556 -0
- sage/sets/finite_enumerated_set.py +406 -0
- sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/finite_set_map_cy.pxd +34 -0
- sage/sets/finite_set_map_cy.pyx +708 -0
- sage/sets/finite_set_maps.py +591 -0
- sage/sets/image_set.py +448 -0
- sage/sets/integer_range.py +829 -0
- sage/sets/non_negative_integers.py +241 -0
- sage/sets/positive_integers.py +93 -0
- sage/sets/primes.py +188 -0
- sage/sets/real_set.py +2760 -0
- sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/recursively_enumerated_set.pxd +31 -0
- sage/sets/recursively_enumerated_set.pyx +2082 -0
- sage/sets/set.py +2083 -0
- sage/sets/set_from_iterator.py +1021 -0
- sage/sets/totally_ordered_finite_set.py +329 -0
- sage/symbolic/all__sagemath_categories.py +1 -0
- sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/symbolic/function.pxd +29 -0
- sage/symbolic/function.pyx +1488 -0
- sage/symbolic/symbols.py +56 -0
- sage/tests/all__sagemath_categories.py +1 -0
- sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/cython.pyx +37 -0
- sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/stl_vector.pyx +171 -0
- sage/typeset/all.py +6 -0
- sage/typeset/ascii_art.py +295 -0
- sage/typeset/character_art.py +789 -0
- sage/typeset/character_art_factory.py +572 -0
- sage/typeset/symbols.py +334 -0
- sage/typeset/unicode_art.py +183 -0
- sage/typeset/unicode_characters.py +101 -0
|
@@ -0,0 +1,1407 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Finite dimensional modules with basis
|
|
4
|
+
"""
|
|
5
|
+
# ****************************************************************************
|
|
6
|
+
# Copyright (C) 2008 Teresa Gomez-Diaz (CNRS) <Teresa.Gomez-Diaz@univ-mlv.fr>
|
|
7
|
+
# 2011 Nicolas M. Thiery <nthiery at users.sf.net>
|
|
8
|
+
#
|
|
9
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
10
|
+
# http://www.gnu.org/licenses/
|
|
11
|
+
# *****************************************************************************
|
|
12
|
+
|
|
13
|
+
import functools
|
|
14
|
+
import operator
|
|
15
|
+
from sage.categories.category_with_axiom import CategoryWithAxiom, CategoryWithAxiom_over_base_ring
|
|
16
|
+
from sage.categories.fields import Fields
|
|
17
|
+
from sage.categories.homsets import HomsetsCategory
|
|
18
|
+
from sage.categories.tensor import TensorProductsCategory
|
|
19
|
+
from sage.misc.cachefunc import cached_method
|
|
20
|
+
from sage.misc.lazy_attribute import lazy_attribute
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FiniteDimensionalModulesWithBasis(CategoryWithAxiom_over_base_ring):
|
|
24
|
+
"""
|
|
25
|
+
The category of finite dimensional modules with a distinguished basis.
|
|
26
|
+
|
|
27
|
+
EXAMPLES::
|
|
28
|
+
|
|
29
|
+
sage: C = FiniteDimensionalModulesWithBasis(ZZ); C
|
|
30
|
+
Category of finite dimensional modules with basis over Integer Ring
|
|
31
|
+
sage: sorted(C.super_categories(), key=str)
|
|
32
|
+
[Category of finite dimensional modules over Integer Ring,
|
|
33
|
+
Category of modules with basis over Integer Ring]
|
|
34
|
+
sage: C is Modules(ZZ).WithBasis().FiniteDimensional()
|
|
35
|
+
True
|
|
36
|
+
|
|
37
|
+
TESTS::
|
|
38
|
+
|
|
39
|
+
sage: TestSuite(C).run()
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
class ParentMethods:
|
|
43
|
+
|
|
44
|
+
def gens(self) -> tuple:
|
|
45
|
+
"""
|
|
46
|
+
Return the generators of ``self``.
|
|
47
|
+
|
|
48
|
+
OUTPUT: a tuple containing the basis elements of ``self``
|
|
49
|
+
|
|
50
|
+
EXAMPLES::
|
|
51
|
+
|
|
52
|
+
sage: F = CombinatorialFreeModule(ZZ, ['a', 'b', 'c']) # needs sage.modules
|
|
53
|
+
sage: F.gens() # needs sage.modules
|
|
54
|
+
(B['a'], B['b'], B['c'])
|
|
55
|
+
"""
|
|
56
|
+
return tuple(self.basis())
|
|
57
|
+
|
|
58
|
+
def annihilator(self, S, action=operator.mul, side='right', category=None):
|
|
59
|
+
r"""
|
|
60
|
+
Return the annihilator of a finite set.
|
|
61
|
+
|
|
62
|
+
INPUT:
|
|
63
|
+
|
|
64
|
+
- ``S`` -- a finite set
|
|
65
|
+
|
|
66
|
+
- ``action`` -- a function (default: :obj:`operator.mul`)
|
|
67
|
+
|
|
68
|
+
- ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)
|
|
69
|
+
|
|
70
|
+
- ``category`` -- a category
|
|
71
|
+
|
|
72
|
+
Assumptions:
|
|
73
|
+
|
|
74
|
+
- ``action`` takes elements of ``self`` as first argument
|
|
75
|
+
and elements of ``S`` as second argument;
|
|
76
|
+
|
|
77
|
+
- The codomain is any vector space, and ``action`` is
|
|
78
|
+
linear on its first argument; typically it is bilinear;
|
|
79
|
+
|
|
80
|
+
- If ``side`` is 'left', this is reversed.
|
|
81
|
+
|
|
82
|
+
OUTPUT:
|
|
83
|
+
|
|
84
|
+
The subspace of the elements `x` of ``self`` such that
|
|
85
|
+
``action(x,s) = 0`` for all `s\in S`. If ``side`` is
|
|
86
|
+
'left' replace the above equation by ``action(s,x) = 0``.
|
|
87
|
+
|
|
88
|
+
If ``self`` is a ring, ``action`` an action of ``self`` on
|
|
89
|
+
a module `M` and `S` is a subset of `M`, we recover the
|
|
90
|
+
:wikipedia:`Annihilator_%28ring_theory%29`. Similarly this
|
|
91
|
+
can be used to compute torsion or orthogonals.
|
|
92
|
+
|
|
93
|
+
.. SEEALSO:: :meth:`annihilator_basis` for lots of examples.
|
|
94
|
+
|
|
95
|
+
EXAMPLES::
|
|
96
|
+
|
|
97
|
+
sage: # needs sage.modules
|
|
98
|
+
sage: F = FiniteDimensionalAlgebrasWithBasis(QQ).example(); F
|
|
99
|
+
An example of a finite dimensional algebra with basis:
|
|
100
|
+
the path algebra of the Kronecker quiver
|
|
101
|
+
(containing the arrows a:x->y and b:x->y) over Rational Field
|
|
102
|
+
sage: x, y, a, b = F.basis()
|
|
103
|
+
sage: A = F.annihilator([a + 3*b + 2*y]); A
|
|
104
|
+
Free module generated by {0} over Rational Field
|
|
105
|
+
sage: [b.lift() for b in A.basis()]
|
|
106
|
+
[-1/2*a - 3/2*b + x]
|
|
107
|
+
|
|
108
|
+
The category can be used to specify other properties of
|
|
109
|
+
this subspace, like that this is a subalgebra::
|
|
110
|
+
|
|
111
|
+
sage: # needs sage.modules
|
|
112
|
+
sage: center = F.annihilator(F.basis(), F.bracket,
|
|
113
|
+
....: category=Algebras(QQ).Subobjects())
|
|
114
|
+
sage: (e,) = center.basis()
|
|
115
|
+
sage: e.lift()
|
|
116
|
+
x + y
|
|
117
|
+
sage: e * e == e
|
|
118
|
+
True
|
|
119
|
+
|
|
120
|
+
Taking annihilator is order reversing for inclusion::
|
|
121
|
+
|
|
122
|
+
sage: # needs sage.modules
|
|
123
|
+
sage: A = F.annihilator([]); A .rename('A')
|
|
124
|
+
sage: Ax = F.annihilator([x]); Ax .rename('Ax')
|
|
125
|
+
sage: Ay = F.annihilator([y]); Ay .rename('Ay')
|
|
126
|
+
sage: Axy = F.annihilator([x,y]); Axy.rename('Axy')
|
|
127
|
+
sage: P = Poset(([A, Ax, Ay, Axy], attrcall("is_submodule"))) # needs sage.graphs
|
|
128
|
+
sage: sorted(P.cover_relations(), key=str) # needs sage.graphs
|
|
129
|
+
[[Ax, A], [Axy, Ax], [Axy, Ay], [Ay, A]]
|
|
130
|
+
"""
|
|
131
|
+
return self.submodule(self.annihilator_basis(S, action, side),
|
|
132
|
+
already_echelonized=True,
|
|
133
|
+
category=category)
|
|
134
|
+
|
|
135
|
+
def annihilator_basis(self, S, action=operator.mul, side='right'):
|
|
136
|
+
"""
|
|
137
|
+
Return a basis of the annihilator of a finite set of elements.
|
|
138
|
+
|
|
139
|
+
INPUT:
|
|
140
|
+
|
|
141
|
+
- ``S`` -- a finite set of objects
|
|
142
|
+
|
|
143
|
+
- ``action`` -- a function (default: :obj:`operator.mul`)
|
|
144
|
+
|
|
145
|
+
- ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``):
|
|
146
|
+
on which side of ``self`` the elements of `S` acts
|
|
147
|
+
|
|
148
|
+
See :meth:`annihilator` for the assumptions and definition
|
|
149
|
+
of the annihilator.
|
|
150
|
+
|
|
151
|
+
EXAMPLES:
|
|
152
|
+
|
|
153
|
+
By default, the action is the standard `*` operation. So
|
|
154
|
+
our first example is about an algebra::
|
|
155
|
+
|
|
156
|
+
sage: # needs sage.graphs sage.modules
|
|
157
|
+
sage: F = FiniteDimensionalAlgebrasWithBasis(QQ).example(); F
|
|
158
|
+
An example of a finite dimensional algebra with basis:
|
|
159
|
+
the path algebra of the Kronecker quiver
|
|
160
|
+
(containing the arrows a:x->y and b:x->y) over Rational Field
|
|
161
|
+
sage: x,y,a,b = F.basis()
|
|
162
|
+
|
|
163
|
+
In this algebra, multiplication on the right by `x`
|
|
164
|
+
annihilates all basis elements but `x`::
|
|
165
|
+
|
|
166
|
+
sage: x*x, y*x, a*x, b*x # needs sage.graphs sage.modules
|
|
167
|
+
(x, 0, 0, 0)
|
|
168
|
+
|
|
169
|
+
So the annihilator is the subspace spanned by `y`, `a`, and `b`::
|
|
170
|
+
|
|
171
|
+
sage: F.annihilator_basis([x]) # needs sage.graphs sage.modules
|
|
172
|
+
(y, a, b)
|
|
173
|
+
|
|
174
|
+
The same holds for `a` and `b`::
|
|
175
|
+
|
|
176
|
+
sage: x*a, y*a, a*a, b*a # needs sage.graphs sage.modules
|
|
177
|
+
(a, 0, 0, 0)
|
|
178
|
+
sage: F.annihilator_basis([a]) # needs sage.graphs sage.modules
|
|
179
|
+
(y, a, b)
|
|
180
|
+
|
|
181
|
+
On the other hand, `y` annihilates only `x`::
|
|
182
|
+
|
|
183
|
+
sage: F.annihilator_basis([y]) # needs sage.graphs sage.modules
|
|
184
|
+
(x,)
|
|
185
|
+
|
|
186
|
+
Here is a non trivial annihilator::
|
|
187
|
+
|
|
188
|
+
sage: F.annihilator_basis([a + 3*b + 2*y]) # needs sage.graphs sage.modules
|
|
189
|
+
(-1/2*a - 3/2*b + x,)
|
|
190
|
+
|
|
191
|
+
Let's check it::
|
|
192
|
+
|
|
193
|
+
sage: (-1/2*a - 3/2*b + x) * (a + 3*b + 2*y) # needs sage.graphs sage.modules
|
|
194
|
+
0
|
|
195
|
+
|
|
196
|
+
Doing the same calculations on the left exchanges the
|
|
197
|
+
roles of `x` and `y`::
|
|
198
|
+
|
|
199
|
+
sage: # needs sage.graphs sage.modules
|
|
200
|
+
sage: F.annihilator_basis([y], side='left')
|
|
201
|
+
(x, a, b)
|
|
202
|
+
sage: F.annihilator_basis([a], side='left')
|
|
203
|
+
(x, a, b)
|
|
204
|
+
sage: F.annihilator_basis([b], side='left')
|
|
205
|
+
(x, a, b)
|
|
206
|
+
sage: F.annihilator_basis([x], side='left')
|
|
207
|
+
(y,)
|
|
208
|
+
sage: F.annihilator_basis([a + 3*b + 2*x], side='left')
|
|
209
|
+
(-1/2*a - 3/2*b + y,)
|
|
210
|
+
|
|
211
|
+
By specifying an inner product, this method can be used to
|
|
212
|
+
compute the orthogonal of a subspace::
|
|
213
|
+
|
|
214
|
+
sage: # needs sage.graphs sage.modules
|
|
215
|
+
sage: x,y,a,b = F.basis()
|
|
216
|
+
sage: def scalar(u, v):
|
|
217
|
+
....: return vector([sum(u[i]*v[i] for i in F.basis().keys())])
|
|
218
|
+
sage: F.annihilator_basis([x + y, a + b], scalar)
|
|
219
|
+
(x - y, a - b)
|
|
220
|
+
|
|
221
|
+
By specifying the standard Lie bracket as action, one can
|
|
222
|
+
compute the commutator of a subspace of `F`::
|
|
223
|
+
|
|
224
|
+
sage: F.annihilator_basis([a + b], action=F.bracket) # needs sage.graphs sage.modules
|
|
225
|
+
(x + y, a, b)
|
|
226
|
+
|
|
227
|
+
In particular one can compute a basis of the center of the
|
|
228
|
+
algebra. In our example, it is reduced to the identity::
|
|
229
|
+
|
|
230
|
+
sage: F.annihilator_basis(F.algebra_generators(), action=F.bracket) # needs sage.graphs sage.modules
|
|
231
|
+
(x + y,)
|
|
232
|
+
|
|
233
|
+
But see also
|
|
234
|
+
:meth:`FiniteDimensionalAlgebrasWithBasis.ParentMethods.center_basis`.
|
|
235
|
+
"""
|
|
236
|
+
# TODO: optimize this!
|
|
237
|
+
from sage.matrix.constructor import matrix
|
|
238
|
+
if side == 'right':
|
|
239
|
+
action_left = action
|
|
240
|
+
action = lambda b,s: action_left(s, b)
|
|
241
|
+
|
|
242
|
+
mat = matrix(self.base_ring(), self.dimension(), 0)
|
|
243
|
+
for s in S:
|
|
244
|
+
mat = mat.augment(matrix(self.base_ring(),
|
|
245
|
+
[action(s, b)._vector_() for b in self.basis()]))
|
|
246
|
+
return tuple(map(self.from_vector, mat.left_kernel().basis()))
|
|
247
|
+
|
|
248
|
+
@cached_method
|
|
249
|
+
def _dense_free_module(self, base_ring=None):
|
|
250
|
+
"""
|
|
251
|
+
Return a dense free module of the same dimension as ``self``.
|
|
252
|
+
|
|
253
|
+
INPUT:
|
|
254
|
+
|
|
255
|
+
- ``base_ring`` -- a ring or ``None``
|
|
256
|
+
|
|
257
|
+
If ``base_ring`` is ``None``, then the base ring of ``self``
|
|
258
|
+
is used.
|
|
259
|
+
|
|
260
|
+
This method is mostly used by ``_vector_``
|
|
261
|
+
|
|
262
|
+
EXAMPLES::
|
|
263
|
+
|
|
264
|
+
sage: C = CombinatorialFreeModule(QQ['x'], ['a','b','c']); C # needs sage.modules
|
|
265
|
+
Free module generated by {'a', 'b', 'c'} over
|
|
266
|
+
Univariate Polynomial Ring in x over Rational Field
|
|
267
|
+
sage: C._dense_free_module() # needs sage.modules
|
|
268
|
+
Ambient free module of rank 3 over the principal ideal domain
|
|
269
|
+
Univariate Polynomial Ring in x over Rational Field
|
|
270
|
+
sage: C._dense_free_module(QQ['x,y']) # needs sage.modules
|
|
271
|
+
Ambient free module of rank 3 over the integral domain
|
|
272
|
+
Multivariate Polynomial Ring in x, y over Rational Field
|
|
273
|
+
"""
|
|
274
|
+
if base_ring is None:
|
|
275
|
+
base_ring = self.base_ring()
|
|
276
|
+
from sage.modules.free_module import FreeModule
|
|
277
|
+
return FreeModule(base_ring, self.dimension())
|
|
278
|
+
|
|
279
|
+
def from_vector(self, vector, order=None, coerce=True):
|
|
280
|
+
"""
|
|
281
|
+
Build an element of ``self`` from a vector.
|
|
282
|
+
|
|
283
|
+
EXAMPLES::
|
|
284
|
+
|
|
285
|
+
sage: # needs sage.modules
|
|
286
|
+
sage: p_mult = matrix([[0,0,0], [0,0,-1], [0,0,0]])
|
|
287
|
+
sage: q_mult = matrix([[0,0,1], [0,0,0], [0,0,0]])
|
|
288
|
+
sage: A = algebras.FiniteDimensional(
|
|
289
|
+
....: QQ, [p_mult, q_mult, matrix(QQ, 3, 3)], 'p,q,z')
|
|
290
|
+
sage: A.from_vector(vector([1,0,2]))
|
|
291
|
+
p + 2*z
|
|
292
|
+
"""
|
|
293
|
+
if order is None:
|
|
294
|
+
try:
|
|
295
|
+
order = sorted(self.basis().keys())
|
|
296
|
+
except AttributeError: # Not a family, assume it is list-like
|
|
297
|
+
order = range(self.dimension())
|
|
298
|
+
if not coerce or vector.base_ring() is self.base_ring():
|
|
299
|
+
return self._from_dict({order[i]: c for i,c in vector.items()},
|
|
300
|
+
coerce=False)
|
|
301
|
+
R = self.base_ring()
|
|
302
|
+
return self._from_dict({order[i]: R(c) for i,c in vector.items() if R(c)},
|
|
303
|
+
coerce=False, remove_zeros=False)
|
|
304
|
+
|
|
305
|
+
def echelon_form(self, elements, row_reduced=False, order=None):
|
|
306
|
+
r"""
|
|
307
|
+
Return a basis in echelon form of the subspace spanned by
|
|
308
|
+
a finite set of elements.
|
|
309
|
+
|
|
310
|
+
INPUT:
|
|
311
|
+
|
|
312
|
+
- ``elements`` -- list or finite iterable of elements of ``self``
|
|
313
|
+
- ``row_reduced`` -- boolean (default: ``False``); whether to
|
|
314
|
+
compute the basis for the row reduced echelon form
|
|
315
|
+
- ``order`` -- (optional) either something that can
|
|
316
|
+
be converted into a tuple or a key function
|
|
317
|
+
|
|
318
|
+
OUTPUT:
|
|
319
|
+
|
|
320
|
+
A list of elements of ``self`` whose expressions as vectors
|
|
321
|
+
form a matrix in echelon form. If ``base_ring`` is specified,
|
|
322
|
+
then the calculation is achieved in this base ring.
|
|
323
|
+
|
|
324
|
+
EXAMPLES::
|
|
325
|
+
|
|
326
|
+
sage: # needs sage.modules
|
|
327
|
+
sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x')
|
|
328
|
+
sage: x = X.basis()
|
|
329
|
+
sage: V = X.echelon_form([x[0]-x[1], x[0]-x[2], x[1]-x[2]]); V
|
|
330
|
+
[x[0] - x[2], x[1] - x[2]]
|
|
331
|
+
sage: matrix(list(map(vector, V)))
|
|
332
|
+
[ 1 0 -1]
|
|
333
|
+
[ 0 1 -1]
|
|
334
|
+
|
|
335
|
+
::
|
|
336
|
+
|
|
337
|
+
sage: # needs sage.modules
|
|
338
|
+
sage: F = CombinatorialFreeModule(ZZ, [1,2,3,4])
|
|
339
|
+
sage: B = F.basis()
|
|
340
|
+
sage: elements = [B[1]-17*B[2]+6*B[3], B[1]-17*B[2]+B[4]]
|
|
341
|
+
sage: F.echelon_form(elements)
|
|
342
|
+
[B[1] - 17*B[2] + B[4], 6*B[3] - B[4]]
|
|
343
|
+
|
|
344
|
+
::
|
|
345
|
+
|
|
346
|
+
sage: F = CombinatorialFreeModule(QQ, ['a','b','c']) # needs sage.modules
|
|
347
|
+
sage: a,b,c = F.basis() # needs sage.modules
|
|
348
|
+
sage: F.echelon_form([8*a+b+10*c, -3*a+b-c, a-b-c]) # needs sage.modules
|
|
349
|
+
[B['a'] + B['c'], B['b'] + 2*B['c']]
|
|
350
|
+
|
|
351
|
+
::
|
|
352
|
+
|
|
353
|
+
sage: R.<x,y> = QQ[]
|
|
354
|
+
sage: C = CombinatorialFreeModule(R, range(3), prefix='x') # needs sage.modules
|
|
355
|
+
sage: x = C.basis() # needs sage.modules
|
|
356
|
+
sage: C.echelon_form([x[0] - x[1], 2*x[1] - 2*x[2], x[0] - x[2]]) # needs sage.modules sage.rings.function_field
|
|
357
|
+
[x[0] - x[2], x[1] - x[2]]
|
|
358
|
+
|
|
359
|
+
::
|
|
360
|
+
|
|
361
|
+
sage: M = MatrixSpace(QQ, 3, 3) # needs sage.modules
|
|
362
|
+
sage: A = M([[0, 0, 2], [0, 0, 0], [0, 0, 0]]) # needs sage.modules
|
|
363
|
+
sage: M.echelon_form([A, A]) # needs sage.modules
|
|
364
|
+
[
|
|
365
|
+
[0 0 1]
|
|
366
|
+
[0 0 0]
|
|
367
|
+
[0 0 0]
|
|
368
|
+
]
|
|
369
|
+
|
|
370
|
+
TESTS:
|
|
371
|
+
|
|
372
|
+
We convert the input elements to ``self``::
|
|
373
|
+
|
|
374
|
+
sage: E.<x,y,z> = ExteriorAlgebra(QQ) # needs sage.modules
|
|
375
|
+
sage: E.echelon_form([1, x + 2]) # needs sage.modules
|
|
376
|
+
[1, x]
|
|
377
|
+
"""
|
|
378
|
+
# Make sure elements consists of elements of ``self``
|
|
379
|
+
elements = [self(y) for y in elements]
|
|
380
|
+
if order is not None:
|
|
381
|
+
order = self._compute_support_order(elements, order)
|
|
382
|
+
from sage.matrix.constructor import matrix
|
|
383
|
+
mat = matrix(self.base_ring(), [g._vector_(order=order) for g in elements])
|
|
384
|
+
# Echelonizing a matrix over a field returned the rref
|
|
385
|
+
if row_reduced and self.base_ring() not in Fields():
|
|
386
|
+
try:
|
|
387
|
+
mat = mat.rref().change_ring(self.base_ring())
|
|
388
|
+
except (ValueError, TypeError):
|
|
389
|
+
raise ValueError("unable to compute the row reduced echelon form")
|
|
390
|
+
else:
|
|
391
|
+
mat.echelonize()
|
|
392
|
+
ret = [self.from_vector(vec, order=order) for vec in mat if vec]
|
|
393
|
+
return ret
|
|
394
|
+
|
|
395
|
+
def invariant_module(self, S, action=operator.mul, action_on_basis=None,
|
|
396
|
+
side='left', **kwargs):
|
|
397
|
+
r"""
|
|
398
|
+
Return the submodule of ``self`` invariant under the action
|
|
399
|
+
of ``S``.
|
|
400
|
+
|
|
401
|
+
For a semigroup `S` acting on a module `M`, the invariant
|
|
402
|
+
submodule is given by
|
|
403
|
+
|
|
404
|
+
.. MATH::
|
|
405
|
+
|
|
406
|
+
M^S = \{m \in M : s \cdot m = m,\, \forall s \in S\}.
|
|
407
|
+
|
|
408
|
+
INPUT:
|
|
409
|
+
|
|
410
|
+
- ``S`` -- a finitely-generated semigroup
|
|
411
|
+
- ``action`` -- a function (default: :obj:`operator.mul`)
|
|
412
|
+
- ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``);
|
|
413
|
+
which side of ``self`` the elements of ``S`` acts
|
|
414
|
+
- ``action_on_basis`` -- (optional) define the action of ``S``
|
|
415
|
+
on the basis of ``self``
|
|
416
|
+
|
|
417
|
+
OUTPUT: :class:`~sage.modules.with_basis.invariant.FiniteDimensionalInvariantModule`
|
|
418
|
+
|
|
419
|
+
EXAMPLES:
|
|
420
|
+
|
|
421
|
+
We build the invariant module of the permutation representation
|
|
422
|
+
of the symmetric group::
|
|
423
|
+
|
|
424
|
+
sage: # needs sage.combinat sage.groups sage.modules
|
|
425
|
+
sage: G = SymmetricGroup(3); G.rename('S3')
|
|
426
|
+
sage: M = FreeModule(ZZ, [1,2,3], prefix='M'); M.rename('M')
|
|
427
|
+
sage: action = lambda g, x: M.term(g(x))
|
|
428
|
+
sage: I = M.invariant_module(G, action_on_basis=action); I
|
|
429
|
+
(S3)-invariant submodule of M
|
|
430
|
+
sage: I.basis()
|
|
431
|
+
Finite family {0: B[0]}
|
|
432
|
+
sage: [I.lift(b) for b in I.basis()]
|
|
433
|
+
[M[1] + M[2] + M[3]]
|
|
434
|
+
sage: G.rename(); M.rename() # reset the names
|
|
435
|
+
|
|
436
|
+
We can construct the invariant module of any module that has
|
|
437
|
+
an action of ``S``. In this example, we consider the dihedral
|
|
438
|
+
group `G = D_4` and the subgroup `H < G` of all rotations. We
|
|
439
|
+
construct the `H`-invariant module of the group algebra `\QQ[G]`::
|
|
440
|
+
|
|
441
|
+
sage: # needs sage.groups
|
|
442
|
+
sage: G = groups.permutation.Dihedral(4)
|
|
443
|
+
sage: H = G.subgroup(G.gen(0))
|
|
444
|
+
sage: H
|
|
445
|
+
Subgroup generated by [(1,2,3,4)]
|
|
446
|
+
of (Dihedral group of order 8 as a permutation group)
|
|
447
|
+
sage: H.cardinality()
|
|
448
|
+
4
|
|
449
|
+
|
|
450
|
+
sage: # needs sage.groups sage.modules
|
|
451
|
+
sage: A = G.algebra(QQ)
|
|
452
|
+
sage: I = A.invariant_module(H)
|
|
453
|
+
sage: [I.lift(b) for b in I.basis()]
|
|
454
|
+
[() + (1,2,3,4) + (1,3)(2,4) + (1,4,3,2),
|
|
455
|
+
(2,4) + (1,2)(3,4) + (1,3) + (1,4)(2,3)]
|
|
456
|
+
sage: all(h * I.lift(b) == I.lift(b)
|
|
457
|
+
....: for b in I.basis() for h in H)
|
|
458
|
+
True
|
|
459
|
+
"""
|
|
460
|
+
if action_on_basis is not None:
|
|
461
|
+
from sage.modules.with_basis.representation import Representation
|
|
462
|
+
M = Representation(S, self, action_on_basis, side=side)
|
|
463
|
+
else:
|
|
464
|
+
M = self
|
|
465
|
+
|
|
466
|
+
from sage.modules.with_basis.invariant import FiniteDimensionalInvariantModule
|
|
467
|
+
return FiniteDimensionalInvariantModule(M, S, action=action, side=side, **kwargs)
|
|
468
|
+
|
|
469
|
+
def twisted_invariant_module(self, G, chi,
|
|
470
|
+
action=operator.mul,
|
|
471
|
+
action_on_basis=None,
|
|
472
|
+
side='left',
|
|
473
|
+
**kwargs):
|
|
474
|
+
r"""
|
|
475
|
+
Create the isotypic component of the action of ``G`` on
|
|
476
|
+
``self`` with irreducible character given by ``chi``.
|
|
477
|
+
|
|
478
|
+
.. SEEALSO::
|
|
479
|
+
|
|
480
|
+
-:class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule`
|
|
481
|
+
|
|
482
|
+
INPUT:
|
|
483
|
+
|
|
484
|
+
- ``G`` -- a finitely-generated group
|
|
485
|
+
- ``chi`` -- list/tuple of character values or an instance of
|
|
486
|
+
:class:`~sage.groups.class_function.ClassFunction_gap`
|
|
487
|
+
- ``action`` -- a function (default: :obj:`operator.mul`)
|
|
488
|
+
- ``action_on_basis`` -- (optional) define the action of ``g``
|
|
489
|
+
on the basis of ``self``
|
|
490
|
+
- ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``);
|
|
491
|
+
which side of ``self`` the elements of ``S`` acts
|
|
492
|
+
|
|
493
|
+
OUTPUT: :class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule`
|
|
494
|
+
|
|
495
|
+
EXAMPLES::
|
|
496
|
+
|
|
497
|
+
sage: # needs sage.combinat sage.groups sage.modules
|
|
498
|
+
sage: M = CombinatorialFreeModule(QQ, [1,2,3])
|
|
499
|
+
sage: G = SymmetricGroup(3)
|
|
500
|
+
sage: def action(g, x): return(M.term(g(x))) # permute coordinates
|
|
501
|
+
sage: T = M.twisted_invariant_module(G, [2,0,-1],
|
|
502
|
+
....: action_on_basis=action)
|
|
503
|
+
sage: import __main__; __main__.action = action
|
|
504
|
+
sage: TestSuite(T).run()
|
|
505
|
+
"""
|
|
506
|
+
|
|
507
|
+
if action_on_basis is not None:
|
|
508
|
+
from sage.modules.with_basis.representation import Representation
|
|
509
|
+
from sage.categories.modules import Modules
|
|
510
|
+
category = kwargs.pop('category', Modules(self.base_ring()).WithBasis())
|
|
511
|
+
M = Representation(G, self, action_on_basis, side=side, category=category)
|
|
512
|
+
else:
|
|
513
|
+
M = self
|
|
514
|
+
|
|
515
|
+
from sage.modules.with_basis.invariant import FiniteDimensionalTwistedInvariantModule
|
|
516
|
+
return FiniteDimensionalTwistedInvariantModule(M, G, chi,
|
|
517
|
+
action, side, **kwargs)
|
|
518
|
+
|
|
519
|
+
class ElementMethods:
|
|
520
|
+
def dense_coefficient_list(self, order=None):
|
|
521
|
+
"""
|
|
522
|
+
Return a list of *all* coefficients of ``self``.
|
|
523
|
+
|
|
524
|
+
By default, this list is ordered in the same way as the
|
|
525
|
+
indexing set of the basis of the parent of ``self``.
|
|
526
|
+
|
|
527
|
+
INPUT:
|
|
528
|
+
|
|
529
|
+
- ``order`` -- (optional) an ordering of the basis indexing set
|
|
530
|
+
|
|
531
|
+
EXAMPLES::
|
|
532
|
+
|
|
533
|
+
sage: # needs sage.modules
|
|
534
|
+
sage: v = vector([0, -1, -3])
|
|
535
|
+
sage: v.dense_coefficient_list()
|
|
536
|
+
[0, -1, -3]
|
|
537
|
+
sage: v.dense_coefficient_list([2,1,0])
|
|
538
|
+
[-3, -1, 0]
|
|
539
|
+
sage: sorted(v.coefficients())
|
|
540
|
+
[-3, -1]
|
|
541
|
+
"""
|
|
542
|
+
if order is None:
|
|
543
|
+
try:
|
|
544
|
+
order = sorted(self.parent().basis().keys())
|
|
545
|
+
except AttributeError: # Not a family, assume it is list-like
|
|
546
|
+
order = range(self.parent().dimension())
|
|
547
|
+
return [self[i] for i in order]
|
|
548
|
+
|
|
549
|
+
def _vector_(self, order=None):
|
|
550
|
+
r"""
|
|
551
|
+
Return ``self`` as a vector.
|
|
552
|
+
|
|
553
|
+
EXAMPLES::
|
|
554
|
+
|
|
555
|
+
sage: # needs sage.modules
|
|
556
|
+
sage: v = vector([0, -1, -3])
|
|
557
|
+
sage: v._vector_()
|
|
558
|
+
(0, -1, -3)
|
|
559
|
+
sage: C = CombinatorialFreeModule(QQ['x'], ['a','b','c'])
|
|
560
|
+
sage: C.an_element()._vector_()
|
|
561
|
+
(2, 2, 3)
|
|
562
|
+
"""
|
|
563
|
+
if order is None:
|
|
564
|
+
dense_free_module = self.parent()._dense_free_module()
|
|
565
|
+
else:
|
|
566
|
+
from sage.modules.free_module import FreeModule
|
|
567
|
+
dense_free_module = FreeModule(self.parent().base_ring(), len(order))
|
|
568
|
+
# We slightly break encapsulation for speed reasons
|
|
569
|
+
return dense_free_module.element_class(dense_free_module,
|
|
570
|
+
self.dense_coefficient_list(order),
|
|
571
|
+
coerce=True, copy=False)
|
|
572
|
+
|
|
573
|
+
class MorphismMethods:
|
|
574
|
+
def matrix(self, base_ring=None, side='left'):
|
|
575
|
+
r"""
|
|
576
|
+
Return the matrix of this morphism in the distinguished
|
|
577
|
+
bases of the domain and codomain.
|
|
578
|
+
|
|
579
|
+
INPUT:
|
|
580
|
+
|
|
581
|
+
- ``base_ring`` -- a ring (default: ``None``, meaning the
|
|
582
|
+
base ring of the codomain)
|
|
583
|
+
|
|
584
|
+
- ``side`` -- ``'left'`` or ``'right'`` (default: ``'left'``)
|
|
585
|
+
|
|
586
|
+
If ``side`` is "left", this morphism is considered as
|
|
587
|
+
acting on the left; i.e. each column of the matrix
|
|
588
|
+
represents the image of an element of the basis of the
|
|
589
|
+
domain.
|
|
590
|
+
|
|
591
|
+
The order of the rows and columns matches with the order
|
|
592
|
+
in which the bases are enumerated.
|
|
593
|
+
|
|
594
|
+
.. SEEALSO:: :func:`Modules.WithBasis.ParentMethods.module_morphism`
|
|
595
|
+
|
|
596
|
+
EXAMPLES::
|
|
597
|
+
|
|
598
|
+
sage: # needs sage.modules
|
|
599
|
+
sage: X = CombinatorialFreeModule(ZZ, [1,2]); x = X.basis()
|
|
600
|
+
sage: Y = CombinatorialFreeModule(ZZ, [3,4]); y = Y.basis()
|
|
601
|
+
sage: phi = X.module_morphism(on_basis={1: y[3] + 3*y[4],
|
|
602
|
+
....: 2: 2*y[3] + 5*y[4]}.__getitem__,
|
|
603
|
+
....: codomain=Y)
|
|
604
|
+
sage: phi.matrix()
|
|
605
|
+
[1 2]
|
|
606
|
+
[3 5]
|
|
607
|
+
sage: phi.matrix(side='right')
|
|
608
|
+
[1 3]
|
|
609
|
+
[2 5]
|
|
610
|
+
|
|
611
|
+
sage: phi.matrix().parent() # needs sage.modules
|
|
612
|
+
Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
|
|
613
|
+
sage: phi.matrix(QQ).parent() # needs sage.modules
|
|
614
|
+
Full MatrixSpace of 2 by 2 dense matrices over Rational Field
|
|
615
|
+
|
|
616
|
+
The resulting matrix is immutable::
|
|
617
|
+
|
|
618
|
+
sage: phi.matrix().is_mutable() # needs sage.modules
|
|
619
|
+
False
|
|
620
|
+
|
|
621
|
+
The zero morphism has a zero matrix::
|
|
622
|
+
|
|
623
|
+
sage: Hom(X, Y).zero().matrix() # needs sage.modules
|
|
624
|
+
[0 0]
|
|
625
|
+
[0 0]
|
|
626
|
+
|
|
627
|
+
.. TODO::
|
|
628
|
+
|
|
629
|
+
Add support for morphisms where the codomain has a
|
|
630
|
+
different base ring than the domain::
|
|
631
|
+
|
|
632
|
+
sage: Y = CombinatorialFreeModule(QQ, [3,4]); y = Y.basis() # needs sage.modules
|
|
633
|
+
sage: phi = X.module_morphism(on_basis={1: y[3] + 3*y[4], # needs sage.modules
|
|
634
|
+
....: 2: 2*y[3] + 5/2*y[4]}.__getitem__,
|
|
635
|
+
....: codomain=Y)
|
|
636
|
+
sage: phi.matrix().parent() # not implemented # needs sage.modules
|
|
637
|
+
Full MatrixSpace of 2 by 2 dense matrices over Rational Field
|
|
638
|
+
|
|
639
|
+
This currently does not work because, in this case,
|
|
640
|
+
the morphism is just in the category of commutative
|
|
641
|
+
additive groups (i.e. the intersection of the
|
|
642
|
+
categories of modules over `\ZZ` and over `\QQ`)::
|
|
643
|
+
|
|
644
|
+
sage: phi.parent().homset_category() # needs sage.modules
|
|
645
|
+
Category of commutative additive semigroups
|
|
646
|
+
sage: phi.parent().homset_category() # not implemented, needs sage.modules
|
|
647
|
+
Category of finite dimensional modules with basis over Integer Ring
|
|
648
|
+
|
|
649
|
+
TESTS:
|
|
650
|
+
|
|
651
|
+
Check that :issue:`23216` is fixed::
|
|
652
|
+
|
|
653
|
+
sage: # needs sage.modules
|
|
654
|
+
sage: X = CombinatorialFreeModule(QQ, [])
|
|
655
|
+
sage: Y = CombinatorialFreeModule(QQ, [1,2,3])
|
|
656
|
+
sage: Hom(X, Y).zero().matrix()
|
|
657
|
+
[]
|
|
658
|
+
sage: Hom(X, Y).zero().matrix().parent()
|
|
659
|
+
Full MatrixSpace of 3 by 0 dense matrices over Rational Field
|
|
660
|
+
"""
|
|
661
|
+
if base_ring is None:
|
|
662
|
+
base_ring = self.codomain().base_ring()
|
|
663
|
+
|
|
664
|
+
on_basis = self.on_basis()
|
|
665
|
+
basis_keys = self.domain().basis().keys()
|
|
666
|
+
from sage.matrix.matrix_space import MatrixSpace
|
|
667
|
+
if isinstance(basis_keys, list):
|
|
668
|
+
nrows = len(basis_keys)
|
|
669
|
+
else:
|
|
670
|
+
nrows = basis_keys.cardinality()
|
|
671
|
+
MS = MatrixSpace(base_ring, nrows, self.codomain().dimension())
|
|
672
|
+
m = MS([on_basis(x)._vector_() for x in basis_keys])
|
|
673
|
+
if side == "left":
|
|
674
|
+
m = m.transpose()
|
|
675
|
+
m.set_immutable()
|
|
676
|
+
return m
|
|
677
|
+
|
|
678
|
+
def _repr_matrix(self):
|
|
679
|
+
r"""
|
|
680
|
+
Return a string representation of this morphism (as a matrix).
|
|
681
|
+
|
|
682
|
+
EXAMPLES::
|
|
683
|
+
|
|
684
|
+
sage: # needs sage.modules
|
|
685
|
+
sage: M = matrix(ZZ, [[1, 0, 0], [0, 1, 0]],
|
|
686
|
+
....: column_keys=['a', 'b', 'c'],
|
|
687
|
+
....: row_keys=['v', 'w']); M
|
|
688
|
+
Generic morphism:
|
|
689
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
690
|
+
To: Free module generated by {'v', 'w'} over Integer Ring
|
|
691
|
+
sage: M._repr_ = M._repr_matrix
|
|
692
|
+
sage: M # indirect doctest
|
|
693
|
+
a b c
|
|
694
|
+
v[1 0 0]
|
|
695
|
+
w[0 1 0]
|
|
696
|
+
"""
|
|
697
|
+
matrix = self.matrix()
|
|
698
|
+
|
|
699
|
+
from sage.matrix.constructor import options
|
|
700
|
+
|
|
701
|
+
if matrix.nrows() <= options.max_rows() and matrix.ncols() <= options.max_cols():
|
|
702
|
+
return matrix.str(top_border=self.domain().basis().keys(),
|
|
703
|
+
left_border=self.codomain().basis().keys())
|
|
704
|
+
|
|
705
|
+
return repr(matrix)
|
|
706
|
+
|
|
707
|
+
def _ascii_art_matrix(self):
|
|
708
|
+
r"""
|
|
709
|
+
Return an ASCII art representation of this morphism (as a matrix).
|
|
710
|
+
|
|
711
|
+
EXAMPLES::
|
|
712
|
+
|
|
713
|
+
sage: # needs sage.modules
|
|
714
|
+
sage: M = matrix(ZZ, [[1, 0, 0], [0, 1, 0]],
|
|
715
|
+
....: column_keys=['a', 'b', 'c'],
|
|
716
|
+
....: row_keys=['v', 'w']); M
|
|
717
|
+
Generic morphism:
|
|
718
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
719
|
+
To: Free module generated by {'v', 'w'} over Integer Ring
|
|
720
|
+
sage: M._ascii_art_ = M._ascii_art_matrix
|
|
721
|
+
sage: ascii_art(M) # indirect doctest
|
|
722
|
+
a b c
|
|
723
|
+
v[1 0 0]
|
|
724
|
+
w[0 1 0]
|
|
725
|
+
"""
|
|
726
|
+
matrix = self.matrix()
|
|
727
|
+
|
|
728
|
+
from sage.matrix.constructor import options
|
|
729
|
+
|
|
730
|
+
if matrix.nrows() <= options.max_rows() and matrix.ncols() <= options.max_cols():
|
|
731
|
+
return matrix.str(character_art=True,
|
|
732
|
+
top_border=self.domain().basis().keys(),
|
|
733
|
+
left_border=self.codomain().basis().keys())
|
|
734
|
+
|
|
735
|
+
from sage.typeset.ascii_art import AsciiArt
|
|
736
|
+
|
|
737
|
+
return AsciiArt(repr(self).splitlines())
|
|
738
|
+
|
|
739
|
+
def _unicode_art_matrix(self):
|
|
740
|
+
r"""
|
|
741
|
+
Return a unicode art representation of this morphism (as a matrix).
|
|
742
|
+
|
|
743
|
+
EXAMPLES::
|
|
744
|
+
|
|
745
|
+
sage: # needs sage.modules
|
|
746
|
+
sage: M = matrix(ZZ, [[1, 0, 0], [0, 1, 0]],
|
|
747
|
+
....: column_keys=['a', 'b', 'c'],
|
|
748
|
+
....: row_keys=['v', 'w']); M
|
|
749
|
+
Generic morphism:
|
|
750
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
751
|
+
To: Free module generated by {'v', 'w'} over Integer Ring
|
|
752
|
+
sage: M._unicode_art_ = M._unicode_art_matrix
|
|
753
|
+
sage: unicode_art(M) # indirect doctest
|
|
754
|
+
a b c
|
|
755
|
+
v⎛1 0 0⎞
|
|
756
|
+
w⎝0 1 0⎠
|
|
757
|
+
"""
|
|
758
|
+
matrix = self.matrix()
|
|
759
|
+
|
|
760
|
+
from sage.matrix.constructor import options
|
|
761
|
+
|
|
762
|
+
if matrix.nrows() <= options.max_rows() and matrix.ncols() <= options.max_cols():
|
|
763
|
+
return matrix.str(unicode=True, character_art=True,
|
|
764
|
+
top_border=self.domain().basis().keys(),
|
|
765
|
+
left_border=self.codomain().basis().keys())
|
|
766
|
+
|
|
767
|
+
from sage.typeset.unicode_art import UnicodeArt
|
|
768
|
+
|
|
769
|
+
return UnicodeArt(repr(self).splitlines())
|
|
770
|
+
|
|
771
|
+
def __invert__(self):
|
|
772
|
+
"""
|
|
773
|
+
Return the inverse morphism of ``self``.
|
|
774
|
+
|
|
775
|
+
This is achieved by inverting the ``self.matrix()``.
|
|
776
|
+
An error is raised if ``self`` is not invertible.
|
|
777
|
+
|
|
778
|
+
EXAMPLES::
|
|
779
|
+
|
|
780
|
+
sage: # needs sage.modules
|
|
781
|
+
sage: category = FiniteDimensionalModulesWithBasis(ZZ)
|
|
782
|
+
sage: X = CombinatorialFreeModule(ZZ, [1,2], category=category); X.rename('X'); x = X.basis()
|
|
783
|
+
sage: Y = CombinatorialFreeModule(ZZ, [3,4], category=category); Y.rename('Y'); y = Y.basis()
|
|
784
|
+
sage: phi = X.module_morphism(on_basis={1: y[3] + 3*y[4], 2: 2*y[3] + 5*y[4]}.__getitem__,
|
|
785
|
+
....: codomain=Y, category=category)
|
|
786
|
+
sage: psi = ~phi
|
|
787
|
+
sage: psi
|
|
788
|
+
Generic morphism:
|
|
789
|
+
From: Y
|
|
790
|
+
To: X
|
|
791
|
+
sage: psi.parent()
|
|
792
|
+
Set of Morphisms from Y to X in Category of finite dimensional modules with basis over Integer Ring
|
|
793
|
+
sage: psi(y[3])
|
|
794
|
+
-5*B[1] + 3*B[2]
|
|
795
|
+
sage: psi(y[4])
|
|
796
|
+
2*B[1] - B[2]
|
|
797
|
+
sage: psi.matrix()
|
|
798
|
+
[-5 2]
|
|
799
|
+
[ 3 -1]
|
|
800
|
+
sage: psi(phi(x[1])), psi(phi(x[2]))
|
|
801
|
+
(B[1], B[2])
|
|
802
|
+
sage: phi(psi(y[3])), phi(psi(y[4]))
|
|
803
|
+
(B[3], B[4])
|
|
804
|
+
|
|
805
|
+
We check that this function complains if the morphism is not invertible::
|
|
806
|
+
|
|
807
|
+
sage: # needs sage.modules
|
|
808
|
+
sage: phi = X.module_morphism(on_basis={1: y[3] + y[4], 2: y[3] + y[4]}.__getitem__,
|
|
809
|
+
....: codomain=Y, category=category)
|
|
810
|
+
sage: ~phi
|
|
811
|
+
Traceback (most recent call last):
|
|
812
|
+
...
|
|
813
|
+
RuntimeError: morphism is not invertible
|
|
814
|
+
sage: phi = X.module_morphism(on_basis={1: y[3] + y[4], 2: y[3] + 5*y[4]}.__getitem__,
|
|
815
|
+
....: codomain=Y, category=category)
|
|
816
|
+
sage: ~phi
|
|
817
|
+
Traceback (most recent call last):
|
|
818
|
+
...
|
|
819
|
+
RuntimeError: morphism is not invertible
|
|
820
|
+
"""
|
|
821
|
+
mat = self.matrix()
|
|
822
|
+
try:
|
|
823
|
+
inv_mat = mat.parent()(~mat)
|
|
824
|
+
except (ZeroDivisionError, TypeError):
|
|
825
|
+
raise RuntimeError("morphism is not invertible")
|
|
826
|
+
return self.codomain().module_morphism(
|
|
827
|
+
matrix=inv_mat,
|
|
828
|
+
codomain=self.domain(), category=self.category_for())
|
|
829
|
+
|
|
830
|
+
def kernel_basis(self):
|
|
831
|
+
"""
|
|
832
|
+
Return a basis of the kernel of ``self`` in echelon form.
|
|
833
|
+
|
|
834
|
+
EXAMPLES::
|
|
835
|
+
|
|
836
|
+
sage: SGA = SymmetricGroupAlgebra(QQ, 3) # needs sage.combinat sage.groups
|
|
837
|
+
sage: f = SGA.module_morphism(lambda x: SGA(x**2), codomain=SGA) # needs sage.combinat sage.groups
|
|
838
|
+
sage: f.kernel_basis() # needs sage.combinat sage.groups
|
|
839
|
+
([1, 2, 3] - [3, 2, 1], [1, 3, 2] - [3, 2, 1], [2, 1, 3] - [3, 2, 1])
|
|
840
|
+
"""
|
|
841
|
+
return tuple(map( self.domain().from_vector,
|
|
842
|
+
self.matrix().right_kernel_matrix().rows() ))
|
|
843
|
+
|
|
844
|
+
def kernel(self):
|
|
845
|
+
"""
|
|
846
|
+
Return the kernel of ``self`` as a submodule of the domain.
|
|
847
|
+
|
|
848
|
+
EXAMPLES::
|
|
849
|
+
|
|
850
|
+
sage: # needs sage.combinat sage.groups
|
|
851
|
+
sage: SGA = SymmetricGroupAlgebra(QQ, 3)
|
|
852
|
+
sage: f = SGA.module_morphism(lambda x: SGA(x**2), codomain=SGA)
|
|
853
|
+
sage: K = f.kernel()
|
|
854
|
+
sage: K
|
|
855
|
+
Free module generated by {0, 1, 2} over Rational Field
|
|
856
|
+
sage: K.ambient()
|
|
857
|
+
Symmetric group algebra of order 3 over Rational Field
|
|
858
|
+
"""
|
|
859
|
+
D = self.domain()
|
|
860
|
+
return D.submodule(self.kernel_basis(), already_echelonized=True,
|
|
861
|
+
category=self.category_for())
|
|
862
|
+
|
|
863
|
+
def image_basis(self):
|
|
864
|
+
"""
|
|
865
|
+
Return a basis for the image of ``self`` in echelon form.
|
|
866
|
+
|
|
867
|
+
EXAMPLES::
|
|
868
|
+
|
|
869
|
+
sage: SGA = SymmetricGroupAlgebra(QQ, 3) # needs sage.combinat sage.groups
|
|
870
|
+
sage: f = SGA.module_morphism(lambda x: SGA(x**2), codomain=SGA) # needs sage.combinat sage.groups
|
|
871
|
+
sage: f.image_basis() # needs sage.combinat sage.groups
|
|
872
|
+
([1, 2, 3], [2, 3, 1], [3, 1, 2])
|
|
873
|
+
"""
|
|
874
|
+
C = self.codomain()
|
|
875
|
+
return tuple(C.echelon_form( map(self, self.domain().basis()) ))
|
|
876
|
+
|
|
877
|
+
def image(self):
|
|
878
|
+
"""
|
|
879
|
+
Return the image of ``self`` as a submodule of the codomain.
|
|
880
|
+
|
|
881
|
+
EXAMPLES::
|
|
882
|
+
|
|
883
|
+
sage: SGA = SymmetricGroupAlgebra(QQ, 3) # needs sage.combinat sage.groups
|
|
884
|
+
sage: f = SGA.module_morphism(lambda x: SGA(x**2), codomain=SGA) # needs sage.combinat sage.groups
|
|
885
|
+
sage: f.image() # needs sage.combinat sage.groups
|
|
886
|
+
Free module generated by {0, 1, 2} over Rational Field
|
|
887
|
+
"""
|
|
888
|
+
C = self.codomain()
|
|
889
|
+
return C.submodule(self.image_basis(), already_echelonized=True,
|
|
890
|
+
category=self.category_for())
|
|
891
|
+
|
|
892
|
+
@cached_method
|
|
893
|
+
def _matrix_cmr(self):
|
|
894
|
+
r"""
|
|
895
|
+
Return ``self`` as a :class:`sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse`.
|
|
896
|
+
|
|
897
|
+
EXAMPLES::
|
|
898
|
+
|
|
899
|
+
sage: # needs sage.libs.cmr
|
|
900
|
+
sage: M = matrix(ZZ, [[1, 0, 1], [0, 1, 1], [1, 2, 3]],
|
|
901
|
+
....: column_keys=['a', 'b', 'c'],
|
|
902
|
+
....: row_keys=['u', 'v', 'w']); M
|
|
903
|
+
Generic morphism:
|
|
904
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
905
|
+
To: Free module generated by {'u', 'v', 'w'} over Integer Ring
|
|
906
|
+
sage: M_cmr = M._matrix_cmr(); M_cmr
|
|
907
|
+
[1 0 1]
|
|
908
|
+
[0 1 1]
|
|
909
|
+
[1 2 3]
|
|
910
|
+
sage: type(M_cmr)
|
|
911
|
+
<class 'sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse'>
|
|
912
|
+
"""
|
|
913
|
+
from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
|
|
914
|
+
from sage.matrix.matrix_space import MatrixSpace
|
|
915
|
+
M = self.matrix()
|
|
916
|
+
MS = MatrixSpace(self.base_ring(), M.nrows(), M.ncols(), sparse=True)
|
|
917
|
+
return Matrix_cmr_chr_sparse(MS, M)
|
|
918
|
+
|
|
919
|
+
def is_unimodular(self, **kwds):
|
|
920
|
+
r"""
|
|
921
|
+
Return whether ``self`` is a unimodular morphism.
|
|
922
|
+
|
|
923
|
+
This does not depend on the choice of bases for
|
|
924
|
+
domain and codomain.
|
|
925
|
+
|
|
926
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_unimodular` for
|
|
927
|
+
the detailed documentation.
|
|
928
|
+
|
|
929
|
+
EXAMPLES::
|
|
930
|
+
|
|
931
|
+
sage: # needs sage.modules
|
|
932
|
+
sage: M = matrix(ZZ, [[1, 0, 0], [0, 1, 0]],
|
|
933
|
+
....: column_keys=['a', 'b', 'c'],
|
|
934
|
+
....: row_keys=['v', 'w']); M
|
|
935
|
+
Generic morphism:
|
|
936
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
937
|
+
To: Free module generated by {'v', 'w'} over Integer Ring
|
|
938
|
+
sage: M.is_unimodular() # needs sage.libs.cmr
|
|
939
|
+
True
|
|
940
|
+
"""
|
|
941
|
+
try:
|
|
942
|
+
matrix = self._matrix_cmr()
|
|
943
|
+
except (ImportError, TypeError):
|
|
944
|
+
matrix = self.matrix()
|
|
945
|
+
try:
|
|
946
|
+
return matrix.is_unimodular(**kwds)
|
|
947
|
+
except AttributeError:
|
|
948
|
+
raise NotImplementedError
|
|
949
|
+
|
|
950
|
+
def is_strongly_unimodular(self, **kwds):
|
|
951
|
+
r"""
|
|
952
|
+
Return whether ``self`` is a strongly unimodular morphism.
|
|
953
|
+
|
|
954
|
+
This does not depend on the choice of bases for
|
|
955
|
+
domain and codomain.
|
|
956
|
+
|
|
957
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_strongly_unimodular` for
|
|
958
|
+
the detailed documentation.
|
|
959
|
+
|
|
960
|
+
EXAMPLES::
|
|
961
|
+
|
|
962
|
+
sage: # needs sage.modules
|
|
963
|
+
sage: M = matrix(ZZ, [[1, 0, 1], [0, 1, 1], [1, 2, 3]],
|
|
964
|
+
....: column_keys=['a', 'b', 'c'],
|
|
965
|
+
....: row_keys=['u', 'v', 'w']); M
|
|
966
|
+
Generic morphism:
|
|
967
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
968
|
+
To: Free module generated by {'u', 'v', 'w'} over Integer Ring
|
|
969
|
+
sage: M.is_unimodular() # needs sage.libs.cmr
|
|
970
|
+
True
|
|
971
|
+
sage: M.is_strongly_unimodular() # needs sage.libs.cmr
|
|
972
|
+
False
|
|
973
|
+
"""
|
|
974
|
+
try:
|
|
975
|
+
matrix = self._matrix_cmr()
|
|
976
|
+
except (ImportError, TypeError):
|
|
977
|
+
matrix = self.matrix()
|
|
978
|
+
try:
|
|
979
|
+
return matrix.is_strongly_unimodular(**kwds)
|
|
980
|
+
except AttributeError:
|
|
981
|
+
raise NotImplementedError
|
|
982
|
+
|
|
983
|
+
def equimodulus(self, **kwds):
|
|
984
|
+
r"""
|
|
985
|
+
Return the integer `k` such that ``self`` is equimodular with determinant gcd `k`.
|
|
986
|
+
|
|
987
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.equimodulus` for
|
|
988
|
+
the detailed documentation.
|
|
989
|
+
"""
|
|
990
|
+
try:
|
|
991
|
+
matrix = self._matrix_cmr()
|
|
992
|
+
except (ImportError, TypeError):
|
|
993
|
+
matrix = self.matrix()
|
|
994
|
+
try:
|
|
995
|
+
return matrix.equimodulus(**kwds)
|
|
996
|
+
except AttributeError:
|
|
997
|
+
raise NotImplementedError
|
|
998
|
+
|
|
999
|
+
def strong_equimodulus(self, **kwds):
|
|
1000
|
+
r"""
|
|
1001
|
+
Return the integer `k` such that ``self`` is strongly equimodular with determinant gcd `k`.
|
|
1002
|
+
|
|
1003
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.strong_equimodulus` for
|
|
1004
|
+
the detailed documentation.
|
|
1005
|
+
"""
|
|
1006
|
+
try:
|
|
1007
|
+
matrix = self._matrix_cmr()
|
|
1008
|
+
except (ImportError, TypeError):
|
|
1009
|
+
matrix = self.matrix()
|
|
1010
|
+
try:
|
|
1011
|
+
return matrix.strong_equimodulus(**kwds)
|
|
1012
|
+
except AttributeError:
|
|
1013
|
+
raise NotImplementedError
|
|
1014
|
+
|
|
1015
|
+
def is_k_equimodular(self, k, **kwds):
|
|
1016
|
+
r"""
|
|
1017
|
+
Return whether ``self`` is an equimodular morphism with determinant gcd `k`.
|
|
1018
|
+
|
|
1019
|
+
This does not depend on the choice of bases for
|
|
1020
|
+
domain and codomain.
|
|
1021
|
+
|
|
1022
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_k_equimodular` for
|
|
1023
|
+
the detailed documentation.
|
|
1024
|
+
|
|
1025
|
+
EXAMPLES::
|
|
1026
|
+
|
|
1027
|
+
sage: # needs sage.modules
|
|
1028
|
+
sage: M = matrix(ZZ, [[1, 0, 1], [0, 1, 1], [1, 2, 3]],
|
|
1029
|
+
....: column_keys=['a', 'b', 'c'],
|
|
1030
|
+
....: row_keys=['u', 'v', 'w']); M
|
|
1031
|
+
Generic morphism:
|
|
1032
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
1033
|
+
To: Free module generated by {'u', 'v', 'w'} over Integer Ring
|
|
1034
|
+
sage: M.is_k_equimodular(1) # needs sage.libs.cmr
|
|
1035
|
+
True
|
|
1036
|
+
sage: M.is_k_equimodular(2) # needs sage.libs.cmr
|
|
1037
|
+
False
|
|
1038
|
+
"""
|
|
1039
|
+
try:
|
|
1040
|
+
matrix = self._matrix_cmr()
|
|
1041
|
+
except (ImportError, TypeError):
|
|
1042
|
+
matrix = self.matrix()
|
|
1043
|
+
try:
|
|
1044
|
+
return matrix.is_k_equimodular(k, **kwds)
|
|
1045
|
+
except AttributeError:
|
|
1046
|
+
raise NotImplementedError
|
|
1047
|
+
|
|
1048
|
+
def is_strongly_k_equimodular(self, k, **kwds):
|
|
1049
|
+
r"""
|
|
1050
|
+
Return whether ``self`` is a strongly equimodular morphism with determinant gcd `k`.
|
|
1051
|
+
|
|
1052
|
+
This does not depend on the choice of bases for
|
|
1053
|
+
domain and codomain.
|
|
1054
|
+
|
|
1055
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_strongly_k_equimodular` for
|
|
1056
|
+
the detailed documentation.
|
|
1057
|
+
|
|
1058
|
+
EXAMPLES::
|
|
1059
|
+
|
|
1060
|
+
sage: # needs sage.modules
|
|
1061
|
+
sage: M = matrix(ZZ, [[1, 0, 1], [0, 1, 1], [1, 2, 3]],
|
|
1062
|
+
....: column_keys=['a', 'b', 'c'],
|
|
1063
|
+
....: row_keys=['u', 'v', 'w']); M
|
|
1064
|
+
Generic morphism:
|
|
1065
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
1066
|
+
To: Free module generated by {'u', 'v', 'w'} over Integer Ring
|
|
1067
|
+
sage: M.is_strongly_k_equimodular(1) # needs sage.libs.cmr
|
|
1068
|
+
False
|
|
1069
|
+
sage: M = matrix(ZZ, [[1, 0, 0], [0, 1, 0]],
|
|
1070
|
+
....: column_keys=['a', 'b', 'c'],
|
|
1071
|
+
....: row_keys=['v', 'w']); M
|
|
1072
|
+
Generic morphism:
|
|
1073
|
+
From: Free module generated by {'a', 'b', 'c'} over Integer Ring
|
|
1074
|
+
To: Free module generated by {'v', 'w'} over Integer Ring
|
|
1075
|
+
sage: M.is_strongly_k_equimodular(1) # needs sage.libs.cmr
|
|
1076
|
+
True
|
|
1077
|
+
"""
|
|
1078
|
+
try:
|
|
1079
|
+
matrix = self._matrix_cmr()
|
|
1080
|
+
except (ImportError, TypeError):
|
|
1081
|
+
matrix = self.matrix()
|
|
1082
|
+
try:
|
|
1083
|
+
return matrix.is_strongly_k_equimodular(k, **kwds)
|
|
1084
|
+
except AttributeError:
|
|
1085
|
+
raise NotImplementedError
|
|
1086
|
+
|
|
1087
|
+
def _wrapped_method_with_certificate(self, matrix_method):
|
|
1088
|
+
|
|
1089
|
+
@functools.wraps(matrix_method)
|
|
1090
|
+
def wrapper(*, certificate=False, **kwds):
|
|
1091
|
+
if not certificate:
|
|
1092
|
+
return matrix_method(**kwds)
|
|
1093
|
+
column_keys = self.domain().basis().keys()
|
|
1094
|
+
row_keys = self.codomain().basis().keys()
|
|
1095
|
+
return matrix_method(certificate=True,
|
|
1096
|
+
column_keys=column_keys,
|
|
1097
|
+
row_keys=row_keys,
|
|
1098
|
+
**kwds)
|
|
1099
|
+
return wrapper
|
|
1100
|
+
|
|
1101
|
+
def is_conetwork_matrix(self, **kwds):
|
|
1102
|
+
r"""
|
|
1103
|
+
Return whether the matrix of ``self`` is a conetwork matrix.
|
|
1104
|
+
|
|
1105
|
+
A matrix is a conetwork matrix if and only if its transpose is a network matrix.
|
|
1106
|
+
|
|
1107
|
+
This depends on the choice of bases for domain and codomain.
|
|
1108
|
+
|
|
1109
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_conetwork_matrix` for
|
|
1110
|
+
the detailed documentation.
|
|
1111
|
+
|
|
1112
|
+
EXAMPLES::
|
|
1113
|
+
|
|
1114
|
+
sage: # needs sage.libs.cmr
|
|
1115
|
+
sage: M = matrix([[1, 0, 0, 0, 1, -1, 1, 0, 0],
|
|
1116
|
+
....: [0, 1, 0, 0, 0, 1, -1, 1, 0],
|
|
1117
|
+
....: [0, 0, 1, 0, 0, 0, 1, -1, 1],
|
|
1118
|
+
....: [0, 0, 0, 1, 1, 0, 0, 1, -1]],
|
|
1119
|
+
....: column_keys=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],
|
|
1120
|
+
....: row_keys=range(4)); M
|
|
1121
|
+
Generic morphism:
|
|
1122
|
+
From: Free module generated by {'a', 'b', 'c', 'd',
|
|
1123
|
+
'e', 'f', 'g', 'h', 'i'} over Integer Ring
|
|
1124
|
+
To: Free module generated by {0, 1, 2, 3} over Integer Ring
|
|
1125
|
+
sage: M.is_conetwork_matrix()
|
|
1126
|
+
True
|
|
1127
|
+
sage: result, certificate = M.is_conetwork_matrix(certificate=True)
|
|
1128
|
+
sage: result, certificate
|
|
1129
|
+
(True,
|
|
1130
|
+
(Digraph on 10 vertices,
|
|
1131
|
+
{'a': (8, 7),
|
|
1132
|
+
'b': (1, 29),
|
|
1133
|
+
'c': (34, 2),
|
|
1134
|
+
'd': (41, 7),
|
|
1135
|
+
'e': (7, 3),
|
|
1136
|
+
'f': (22, 0),
|
|
1137
|
+
'g': (3, 0),
|
|
1138
|
+
'h': (3, 1),
|
|
1139
|
+
'i': (2, 1)},
|
|
1140
|
+
{0: (8, 22), 1: (22, 29), 2: (34, 0), 3: (41, 2)}))
|
|
1141
|
+
"""
|
|
1142
|
+
try:
|
|
1143
|
+
matrix = self._matrix_cmr()
|
|
1144
|
+
except (ImportError, TypeError):
|
|
1145
|
+
matrix = self.matrix()
|
|
1146
|
+
try:
|
|
1147
|
+
return self._wrapped_method_with_certificate(matrix.is_conetwork_matrix)(**kwds)
|
|
1148
|
+
except AttributeError:
|
|
1149
|
+
raise NotImplementedError
|
|
1150
|
+
|
|
1151
|
+
def is_network_matrix(self, **kwds):
|
|
1152
|
+
r"""
|
|
1153
|
+
Return whether the matrix of ``self`` is a network matrix.
|
|
1154
|
+
|
|
1155
|
+
This depends on the choice of bases for domain and codomain.
|
|
1156
|
+
|
|
1157
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_network_matrix` for
|
|
1158
|
+
the detailed documentation.
|
|
1159
|
+
|
|
1160
|
+
EXAMPLES::
|
|
1161
|
+
|
|
1162
|
+
sage: # needs sage.libs.cmr
|
|
1163
|
+
sage: M = matrix([[-1, 0, 0, 0, 1, -1, 0],
|
|
1164
|
+
....: [ 1, 0, 0, 1, -1, 1, 0],
|
|
1165
|
+
....: [ 0, -1, 0, -1, 1, -1, 0],
|
|
1166
|
+
....: [ 0, 1, 0, 0, 0, 0, 1],
|
|
1167
|
+
....: [ 0, 0, 1, -1, 1, 0, 1],
|
|
1168
|
+
....: [ 0, 0, -1, 1, -1, 0, 0]],
|
|
1169
|
+
....: column_keys=['a', 'b', 'c', 'd', 'e', 'f', 'g'],
|
|
1170
|
+
....: row_keys=range(6)); M
|
|
1171
|
+
Generic morphism:
|
|
1172
|
+
From: Free module generated by {'a', 'b', 'c', 'd', 'e', 'f', 'g'} over Integer Ring
|
|
1173
|
+
To: Free module generated by {0, 1, 2, 3, 4, 5} over Integer Ring
|
|
1174
|
+
sage: M.is_network_matrix()
|
|
1175
|
+
True
|
|
1176
|
+
sage: result, certificate = M.is_network_matrix(certificate=True)
|
|
1177
|
+
sage: result, certificate
|
|
1178
|
+
(True,
|
|
1179
|
+
(Digraph on 7 vertices,
|
|
1180
|
+
{0: (9, 8), 1: (3, 8), 2: (3, 4), 3: (5, 4), 4: (4, 6), 5: (0, 6)},
|
|
1181
|
+
{'a': (3, 9), 'b': (5, 3), 'c': (4, 0), 'd': (0, 8),
|
|
1182
|
+
'e': (9, 0), 'f': (4, 9), 'g': (5, 6)}))
|
|
1183
|
+
sage: digraph, forest_arcs, coforest_arcs = certificate
|
|
1184
|
+
sage: digraph.plot(edge_colors={'red': forest_arcs.values()}) # needs sage.plot
|
|
1185
|
+
Graphics object consisting of 21 graphics primitives
|
|
1186
|
+
"""
|
|
1187
|
+
try:
|
|
1188
|
+
matrix = self._matrix_cmr()
|
|
1189
|
+
except (ImportError, TypeError):
|
|
1190
|
+
matrix = self.matrix()
|
|
1191
|
+
try:
|
|
1192
|
+
return self._wrapped_method_with_certificate(matrix.is_network_matrix)(**kwds)
|
|
1193
|
+
except AttributeError:
|
|
1194
|
+
raise NotImplementedError
|
|
1195
|
+
|
|
1196
|
+
def is_totally_unimodular(self, **kwds):
|
|
1197
|
+
r"""
|
|
1198
|
+
Return whether the matrix of ``self`` is totally unimodular.
|
|
1199
|
+
|
|
1200
|
+
This depends on the choice of bases for domain and codomain.
|
|
1201
|
+
|
|
1202
|
+
See :meth:`~sage.matrix.matrix_cmr_sparse.Matrix_cmr_chr_sparse.is_totally_unimodular` for
|
|
1203
|
+
the detailed documentation.
|
|
1204
|
+
|
|
1205
|
+
EXAMPLES::
|
|
1206
|
+
|
|
1207
|
+
sage: # needs sage.libs.cmr
|
|
1208
|
+
sage: M = matrix(ZZ, [[1, 0], [-1, 1], [0, 1]],
|
|
1209
|
+
....: column_keys=['a', 'b'],
|
|
1210
|
+
....: row_keys=['u', 'v', 'w']); M
|
|
1211
|
+
Generic morphism:
|
|
1212
|
+
From: Free module generated by {'a', 'b'} over Integer Ring
|
|
1213
|
+
To: Free module generated by {'u', 'v', 'w'} over Integer Ring
|
|
1214
|
+
sage: M.is_totally_unimodular()
|
|
1215
|
+
True
|
|
1216
|
+
sage: result, certificate = M.is_totally_unimodular(certificate=True)
|
|
1217
|
+
sage: result, certificate
|
|
1218
|
+
(True, GraphicNode (3×2))
|
|
1219
|
+
sage: certificate.graph()
|
|
1220
|
+
Digraph on 4 vertices
|
|
1221
|
+
"""
|
|
1222
|
+
try:
|
|
1223
|
+
matrix = self._matrix_cmr()
|
|
1224
|
+
except (ImportError, TypeError):
|
|
1225
|
+
matrix = self.matrix()
|
|
1226
|
+
try:
|
|
1227
|
+
return self._wrapped_method_with_certificate(matrix.is_totally_unimodular)(**kwds)
|
|
1228
|
+
except AttributeError:
|
|
1229
|
+
raise NotImplementedError
|
|
1230
|
+
|
|
1231
|
+
class Homsets(HomsetsCategory):
|
|
1232
|
+
|
|
1233
|
+
class Endset(CategoryWithAxiom):
|
|
1234
|
+
|
|
1235
|
+
class ElementMethods:
|
|
1236
|
+
|
|
1237
|
+
@lazy_attribute
|
|
1238
|
+
def characteristic_polynomial(self):
|
|
1239
|
+
r"""
|
|
1240
|
+
Return the characteristic polynomial of this endomorphism.
|
|
1241
|
+
|
|
1242
|
+
:meth:`characteristic_polynomial` and :meth:`charpoly` are the same method.
|
|
1243
|
+
|
|
1244
|
+
INPUT:
|
|
1245
|
+
|
|
1246
|
+
- ``var`` -- variable
|
|
1247
|
+
|
|
1248
|
+
EXAMPLES::
|
|
1249
|
+
|
|
1250
|
+
sage: # needs sage.modules
|
|
1251
|
+
sage: V = ZZ^2; phi = V.hom([V.0 + V.1, 2*V.1])
|
|
1252
|
+
sage: phi.characteristic_polynomial()
|
|
1253
|
+
x^2 - 3*x + 2
|
|
1254
|
+
sage: phi.charpoly()
|
|
1255
|
+
x^2 - 3*x + 2
|
|
1256
|
+
sage: phi.matrix().charpoly()
|
|
1257
|
+
x^2 - 3*x + 2
|
|
1258
|
+
sage: phi.charpoly('T')
|
|
1259
|
+
T^2 - 3*T + 2
|
|
1260
|
+
sage: W = CombinatorialFreeModule(ZZ, ['x', 'y'])
|
|
1261
|
+
sage: M = matrix(ZZ, [[1, 0], [1, 2]])
|
|
1262
|
+
sage: psi = W.module_morphism(matrix=M, codomain=W)
|
|
1263
|
+
sage: psi.charpoly()
|
|
1264
|
+
x^2 - 3*x + 2
|
|
1265
|
+
"""
|
|
1266
|
+
return self.matrix().charpoly
|
|
1267
|
+
|
|
1268
|
+
charpoly = characteristic_polynomial
|
|
1269
|
+
|
|
1270
|
+
@lazy_attribute
|
|
1271
|
+
def determinant(self):
|
|
1272
|
+
"""
|
|
1273
|
+
Return the determinant of this endomorphism.
|
|
1274
|
+
|
|
1275
|
+
:meth:`determinant` and :meth:`det` are the same method.
|
|
1276
|
+
|
|
1277
|
+
EXAMPLES::
|
|
1278
|
+
|
|
1279
|
+
sage: # needs sage.modules
|
|
1280
|
+
sage: V = ZZ^2; phi = V.hom([V.0 + V.1, 2*V.1])
|
|
1281
|
+
sage: phi.determinant()
|
|
1282
|
+
2
|
|
1283
|
+
sage: phi.det()
|
|
1284
|
+
2
|
|
1285
|
+
sage: W = CombinatorialFreeModule(ZZ, ['x', 'y'])
|
|
1286
|
+
sage: M = matrix(ZZ, [[1, 0], [1, 2]])
|
|
1287
|
+
sage: psi = W.module_morphism(matrix=M, codomain=W)
|
|
1288
|
+
sage: psi.det()
|
|
1289
|
+
2
|
|
1290
|
+
"""
|
|
1291
|
+
return self.matrix().determinant
|
|
1292
|
+
|
|
1293
|
+
det = determinant
|
|
1294
|
+
|
|
1295
|
+
@lazy_attribute
|
|
1296
|
+
def fcp(self):
|
|
1297
|
+
"""
|
|
1298
|
+
Return the factorization of the characteristic polynomial.
|
|
1299
|
+
|
|
1300
|
+
INPUT:
|
|
1301
|
+
|
|
1302
|
+
- ``var`` -- variable
|
|
1303
|
+
|
|
1304
|
+
EXAMPLES::
|
|
1305
|
+
|
|
1306
|
+
sage: # needs sage.modules
|
|
1307
|
+
sage: V = ZZ^2; phi = V.hom([V.0 + V.1, 2*V.1])
|
|
1308
|
+
sage: phi.fcp() # needs sage.libs.pari
|
|
1309
|
+
(x - 2) * (x - 1)
|
|
1310
|
+
sage: phi.fcp('T') # needs sage.libs.pari
|
|
1311
|
+
(T - 2) * (T - 1)
|
|
1312
|
+
sage: W = CombinatorialFreeModule(ZZ, ['x', 'y'])
|
|
1313
|
+
sage: M = matrix(ZZ, [[1, 0], [1, 2]])
|
|
1314
|
+
sage: psi = W.module_morphism(matrix=M, codomain=W)
|
|
1315
|
+
sage: psi.fcp() # needs sage.libs.pari
|
|
1316
|
+
(x - 2) * (x - 1)
|
|
1317
|
+
"""
|
|
1318
|
+
return self.matrix().fcp
|
|
1319
|
+
|
|
1320
|
+
@lazy_attribute
|
|
1321
|
+
def minimal_polynomial(self):
|
|
1322
|
+
r"""
|
|
1323
|
+
Return the minimal polynomial of this endomorphism.
|
|
1324
|
+
|
|
1325
|
+
:meth:`minimal_polynomial` and :meth:`minpoly` are the same method.
|
|
1326
|
+
|
|
1327
|
+
INPUT:
|
|
1328
|
+
|
|
1329
|
+
- ``var`` -- string (default: ``'x'``); a variable name
|
|
1330
|
+
|
|
1331
|
+
EXAMPLES:
|
|
1332
|
+
|
|
1333
|
+
Compute the minimal polynomial, and check it. ::
|
|
1334
|
+
|
|
1335
|
+
sage: # needs sage.modules
|
|
1336
|
+
sage: V = GF(7)^3
|
|
1337
|
+
sage: H = V.Hom(V)([[0,1,2], [-1,0,3], [2,4,1]]); H
|
|
1338
|
+
Vector space morphism represented by the matrix:
|
|
1339
|
+
[0 1 2]
|
|
1340
|
+
[6 0 3]
|
|
1341
|
+
[2 4 1]
|
|
1342
|
+
Domain: Vector space of dimension 3 over Finite Field of size 7
|
|
1343
|
+
Codomain: Vector space of dimension 3 over Finite Field of size 7
|
|
1344
|
+
sage: H.minpoly() # needs sage.libs.pari
|
|
1345
|
+
x^3 + 6*x^2 + 6*x + 1
|
|
1346
|
+
sage: H.minimal_polynomial() # needs sage.libs.pari
|
|
1347
|
+
x^3 + 6*x^2 + 6*x + 1
|
|
1348
|
+
sage: H^3 + (H^2)*6 + H*6 + 1
|
|
1349
|
+
Vector space morphism represented by the matrix:
|
|
1350
|
+
[0 0 0]
|
|
1351
|
+
[0 0 0]
|
|
1352
|
+
[0 0 0]
|
|
1353
|
+
Domain: Vector space of dimension 3 over Finite Field of size 7
|
|
1354
|
+
Codomain: Vector space of dimension 3 over Finite Field of size 7
|
|
1355
|
+
|
|
1356
|
+
sage: # needs sage.modules sage.rings.finite_rings
|
|
1357
|
+
sage: k = GF(9, 'c')
|
|
1358
|
+
sage: V = CombinatorialFreeModule(k, ['x', 'y', 'z', 'w'])
|
|
1359
|
+
sage: A = matrix(k, 4, [1,1,0,0, 0,1,0,0, 0,0,5,0, 0,0,0,5])
|
|
1360
|
+
sage: phi = V.module_morphism(matrix=A, codomain=V)
|
|
1361
|
+
sage: factor(phi.minpoly())
|
|
1362
|
+
(x + 1) * (x + 2)^2
|
|
1363
|
+
sage: A.minpoly()(A) == 0
|
|
1364
|
+
True
|
|
1365
|
+
sage: factor(phi.charpoly())
|
|
1366
|
+
(x + 1)^2 * (x + 2)^2
|
|
1367
|
+
"""
|
|
1368
|
+
return self.matrix().minimal_polynomial
|
|
1369
|
+
|
|
1370
|
+
minpoly = minimal_polynomial
|
|
1371
|
+
|
|
1372
|
+
@lazy_attribute
|
|
1373
|
+
def trace(self):
|
|
1374
|
+
r"""
|
|
1375
|
+
Return the trace of this endomorphism.
|
|
1376
|
+
|
|
1377
|
+
EXAMPLES::
|
|
1378
|
+
|
|
1379
|
+
sage: # needs sage.modules
|
|
1380
|
+
sage: V = ZZ^2; phi = V.hom([V.0 + V.1, 2*V.1])
|
|
1381
|
+
sage: phi.trace()
|
|
1382
|
+
3
|
|
1383
|
+
sage: W = CombinatorialFreeModule(ZZ, ['x', 'y'])
|
|
1384
|
+
sage: M = matrix(ZZ, [[1, 0], [1, 2]])
|
|
1385
|
+
sage: psi = W.module_morphism(matrix=M, codomain=W)
|
|
1386
|
+
sage: psi.trace()
|
|
1387
|
+
3
|
|
1388
|
+
"""
|
|
1389
|
+
return self.matrix().trace
|
|
1390
|
+
|
|
1391
|
+
class TensorProducts(TensorProductsCategory):
|
|
1392
|
+
|
|
1393
|
+
def extra_super_categories(self):
|
|
1394
|
+
"""
|
|
1395
|
+
Implement the fact that a (finite) tensor product of
|
|
1396
|
+
finite dimensional modules is a finite dimensional module.
|
|
1397
|
+
|
|
1398
|
+
EXAMPLES::
|
|
1399
|
+
|
|
1400
|
+
sage: C = ModulesWithBasis(ZZ).FiniteDimensional().TensorProducts()
|
|
1401
|
+
sage: C.extra_super_categories()
|
|
1402
|
+
[Category of finite dimensional modules with basis over Integer Ring]
|
|
1403
|
+
sage: C.FiniteDimensional()
|
|
1404
|
+
Category of tensor products of
|
|
1405
|
+
finite dimensional modules with basis over Integer Ring
|
|
1406
|
+
"""
|
|
1407
|
+
return [self.base_category()]
|