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,2279 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Term orders
|
|
4
|
+
|
|
5
|
+
Sage supports the following term orders:
|
|
6
|
+
|
|
7
|
+
Lexicographic (lex)
|
|
8
|
+
`x^a < x^b` if and only if there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
9
|
+
This term order is called 'lp' in Singular.
|
|
10
|
+
|
|
11
|
+
EXAMPLES:
|
|
12
|
+
|
|
13
|
+
::
|
|
14
|
+
|
|
15
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='lex')
|
|
16
|
+
sage: x > y
|
|
17
|
+
True
|
|
18
|
+
sage: x > y^2
|
|
19
|
+
True
|
|
20
|
+
sage: x > 1
|
|
21
|
+
True
|
|
22
|
+
sage: x^1*y^2 > y^3*z^4
|
|
23
|
+
True
|
|
24
|
+
sage: x^3*y^2*z^4 < x^3*y^2*z^1
|
|
25
|
+
False
|
|
26
|
+
|
|
27
|
+
Degree reverse lexicographic (degrevlex)
|
|
28
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
29
|
+
`x^a < x^b` if and only if `\deg(x^a) < \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
30
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
31
|
+
This term order is called 'dp' in Singular.
|
|
32
|
+
|
|
33
|
+
EXAMPLES:
|
|
34
|
+
|
|
35
|
+
::
|
|
36
|
+
|
|
37
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='degrevlex')
|
|
38
|
+
sage: x > y
|
|
39
|
+
True
|
|
40
|
+
sage: x > y^2*z
|
|
41
|
+
False
|
|
42
|
+
sage: x > 1
|
|
43
|
+
True
|
|
44
|
+
sage: x^1*y^5*z^2 > x^4*y^1*z^3
|
|
45
|
+
True
|
|
46
|
+
sage: x^2*y*z^2 > x*y^3*z
|
|
47
|
+
False
|
|
48
|
+
|
|
49
|
+
Degree lexicographic (deglex)
|
|
50
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
51
|
+
`x^a < x^b` if and only if `\deg(x^a) < \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
52
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
53
|
+
This term order is called 'Dp' in Singular.
|
|
54
|
+
|
|
55
|
+
EXAMPLES:
|
|
56
|
+
|
|
57
|
+
::
|
|
58
|
+
|
|
59
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='deglex')
|
|
60
|
+
sage: x > y
|
|
61
|
+
True
|
|
62
|
+
sage: x > y^2*z
|
|
63
|
+
False
|
|
64
|
+
sage: x > 1
|
|
65
|
+
True
|
|
66
|
+
sage: x^1*y^2*z^3 > x^3*y^2*z^0
|
|
67
|
+
True
|
|
68
|
+
sage: x^2*y*z^2 > x*y^3*z
|
|
69
|
+
True
|
|
70
|
+
|
|
71
|
+
Inverse lexicographic (invlex)
|
|
72
|
+
`x^a < x^b` if and only if there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i < b_i`.
|
|
73
|
+
This order is called 'rp' in Singular.
|
|
74
|
+
|
|
75
|
+
EXAMPLES:
|
|
76
|
+
|
|
77
|
+
::
|
|
78
|
+
|
|
79
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='invlex')
|
|
80
|
+
sage: x > y
|
|
81
|
+
False
|
|
82
|
+
sage: y > x^2
|
|
83
|
+
True
|
|
84
|
+
sage: x > 1
|
|
85
|
+
True
|
|
86
|
+
sage: x*y > z
|
|
87
|
+
False
|
|
88
|
+
|
|
89
|
+
This term order only makes sense in a non-commutative setting
|
|
90
|
+
because if P is the ring `k[x_1, \dots, x_n]` and term
|
|
91
|
+
order 'invlex' then it is equivalent to the ring
|
|
92
|
+
`k[x_n, \dots, x_1]` with term order 'lex'.
|
|
93
|
+
|
|
94
|
+
Negative lexicographic (neglex)
|
|
95
|
+
`x^a < x^b` if and only if there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i > b_i`.
|
|
96
|
+
This term order is called 'ls' in Singular.
|
|
97
|
+
|
|
98
|
+
EXAMPLES:
|
|
99
|
+
|
|
100
|
+
::
|
|
101
|
+
|
|
102
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='neglex')
|
|
103
|
+
sage: x > y
|
|
104
|
+
False
|
|
105
|
+
sage: x > 1
|
|
106
|
+
False
|
|
107
|
+
sage: x^1*y^2 > y^3*z^4
|
|
108
|
+
False
|
|
109
|
+
sage: x^3*y^2*z^4 < x^3*y^2*z^1
|
|
110
|
+
True
|
|
111
|
+
sage: x*y > z
|
|
112
|
+
False
|
|
113
|
+
|
|
114
|
+
Negative degree reverse lexicographic (negdegrevlex)
|
|
115
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
116
|
+
`x^a < x^b` if and only if `\deg(x^a) > \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
117
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
118
|
+
This term order is called 'ds' in Singular.
|
|
119
|
+
|
|
120
|
+
EXAMPLES:
|
|
121
|
+
|
|
122
|
+
::
|
|
123
|
+
|
|
124
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='negdegrevlex')
|
|
125
|
+
sage: x > y
|
|
126
|
+
True
|
|
127
|
+
sage: x > x^2
|
|
128
|
+
True
|
|
129
|
+
sage: x > 1
|
|
130
|
+
False
|
|
131
|
+
sage: x^1*y^2 > y^3*z^4
|
|
132
|
+
True
|
|
133
|
+
sage: x^2*y*z^2 > x*y^3*z
|
|
134
|
+
False
|
|
135
|
+
|
|
136
|
+
Negative degree lexicographic (negdeglex)
|
|
137
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
138
|
+
`x^a < x^b` if and only if `\deg(x^a) > \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
139
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
140
|
+
This term order is called 'Ds' in Singular.
|
|
141
|
+
|
|
142
|
+
EXAMPLES:
|
|
143
|
+
|
|
144
|
+
::
|
|
145
|
+
|
|
146
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='negdeglex')
|
|
147
|
+
sage: x > y
|
|
148
|
+
True
|
|
149
|
+
sage: x > x^2
|
|
150
|
+
True
|
|
151
|
+
sage: x > 1
|
|
152
|
+
False
|
|
153
|
+
sage: x^1*y^2 > y^3*z^4
|
|
154
|
+
True
|
|
155
|
+
sage: x^2*y*z^2 > x*y^3*z
|
|
156
|
+
True
|
|
157
|
+
|
|
158
|
+
Weighted degree reverse lexicographic (wdegrevlex), positive integral weights
|
|
159
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
160
|
+
`x^a < x^b` if and only if `\deg_w(x^a) < \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
161
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
162
|
+
This term order is called 'wp' in Singular.
|
|
163
|
+
|
|
164
|
+
EXAMPLES:
|
|
165
|
+
|
|
166
|
+
::
|
|
167
|
+
|
|
168
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdegrevlex',(1,2,3)))
|
|
169
|
+
sage: x > y
|
|
170
|
+
False
|
|
171
|
+
sage: x > x^2
|
|
172
|
+
False
|
|
173
|
+
sage: x > 1
|
|
174
|
+
True
|
|
175
|
+
sage: x^1*y^2 > x^2*z
|
|
176
|
+
True
|
|
177
|
+
sage: y*z > x^3*y
|
|
178
|
+
False
|
|
179
|
+
|
|
180
|
+
Weighted degree lexicographic (wdeglex), positive integral weights
|
|
181
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
182
|
+
`x^a < x^b` if and only if `\deg_w(x^a) < \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
183
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
184
|
+
This term order is called 'Wp' in Singular.
|
|
185
|
+
|
|
186
|
+
EXAMPLES:
|
|
187
|
+
|
|
188
|
+
::
|
|
189
|
+
|
|
190
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',(1,2,3)))
|
|
191
|
+
sage: x > y
|
|
192
|
+
False
|
|
193
|
+
sage: x > x^2
|
|
194
|
+
False
|
|
195
|
+
sage: x > 1
|
|
196
|
+
True
|
|
197
|
+
sage: x^1*y^2 > x^2*z
|
|
198
|
+
False
|
|
199
|
+
sage: y*z > x^3*y
|
|
200
|
+
False
|
|
201
|
+
|
|
202
|
+
Negative weighted degree reverse lexicographic (negwdegrevlex), positive integral weights
|
|
203
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
204
|
+
`x^a < x^b` if and only if `\deg_w(x^a) > \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
205
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
206
|
+
This term order is called 'ws' in Singular.
|
|
207
|
+
|
|
208
|
+
EXAMPLES:
|
|
209
|
+
|
|
210
|
+
::
|
|
211
|
+
|
|
212
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('negwdegrevlex',(1,2,3)))
|
|
213
|
+
sage: x > y
|
|
214
|
+
True
|
|
215
|
+
sage: x > x^2
|
|
216
|
+
True
|
|
217
|
+
sage: x > 1
|
|
218
|
+
False
|
|
219
|
+
sage: x^1*y^2 > x^2*z
|
|
220
|
+
True
|
|
221
|
+
sage: y*z > x^3*y
|
|
222
|
+
False
|
|
223
|
+
|
|
224
|
+
Degree negative lexicographic (degneglex)
|
|
225
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
226
|
+
`x^a < x^b` if and only if `\deg(x^a) < \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
227
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i > b_i`.
|
|
228
|
+
This term order is called 'dp_asc' in PolyBoRi.
|
|
229
|
+
Singular has the extra weight vector ordering ``(a(1:n),ls)`` for this
|
|
230
|
+
purpose.
|
|
231
|
+
|
|
232
|
+
EXAMPLES:
|
|
233
|
+
|
|
234
|
+
::
|
|
235
|
+
|
|
236
|
+
sage: t = TermOrder('degneglex')
|
|
237
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, order=t)
|
|
238
|
+
sage: x*y > y*z # indirect doctest
|
|
239
|
+
False
|
|
240
|
+
sage: x*y > x
|
|
241
|
+
True
|
|
242
|
+
|
|
243
|
+
Negative weighted degree lexicographic (negwdeglex), positive integral weights
|
|
244
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
245
|
+
`x^a < x^b` if and only if `\deg_w(x^a) > \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
246
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
247
|
+
This term order is called 'Ws' in Singular.
|
|
248
|
+
|
|
249
|
+
EXAMPLES:
|
|
250
|
+
|
|
251
|
+
::
|
|
252
|
+
|
|
253
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('negwdeglex',(1,2,3)))
|
|
254
|
+
sage: x > y
|
|
255
|
+
True
|
|
256
|
+
sage: x > x^2
|
|
257
|
+
True
|
|
258
|
+
sage: x > 1
|
|
259
|
+
False
|
|
260
|
+
sage: x^1*y^2 > x^2*z
|
|
261
|
+
False
|
|
262
|
+
sage: y*z > x^3*y
|
|
263
|
+
False
|
|
264
|
+
|
|
265
|
+
Of these, only 'degrevlex', 'deglex', 'degneglex', 'wdegrevlex', 'wdeglex',
|
|
266
|
+
'invlex' and 'lex' are global orders.
|
|
267
|
+
|
|
268
|
+
Sage also supports matrix term order. Given a square matrix `A`,
|
|
269
|
+
|
|
270
|
+
`x^a <_A x^b` if and only if `Aa < Ab`
|
|
271
|
+
|
|
272
|
+
where `<` is the lexicographic term order.
|
|
273
|
+
|
|
274
|
+
EXAMPLES::
|
|
275
|
+
|
|
276
|
+
sage: # needs sage.modules
|
|
277
|
+
sage: m = matrix(2, [2,3,0,1]); m
|
|
278
|
+
[2 3]
|
|
279
|
+
[0 1]
|
|
280
|
+
sage: T = TermOrder(m); T
|
|
281
|
+
Matrix term order with matrix
|
|
282
|
+
[2 3]
|
|
283
|
+
[0 1]
|
|
284
|
+
sage: P.<a,b> = PolynomialRing(QQ, 2, order=T)
|
|
285
|
+
sage: P
|
|
286
|
+
Multivariate Polynomial Ring in a, b over Rational Field
|
|
287
|
+
sage: a > b
|
|
288
|
+
False
|
|
289
|
+
sage: a^3 < b^2
|
|
290
|
+
True
|
|
291
|
+
sage: S = TermOrder('M(2,3,0,1)')
|
|
292
|
+
sage: T == S
|
|
293
|
+
True
|
|
294
|
+
|
|
295
|
+
Additionally all these monomial orders may be combined to product or block
|
|
296
|
+
orders, defined as:
|
|
297
|
+
|
|
298
|
+
Let `x = (x_1, x_2, \dots, x_n)` and `y = (y_1, y_2, \dots, y_m)` be two
|
|
299
|
+
ordered sets of variables, `<_1` a monomial order on `k[x]` and `<_2` a
|
|
300
|
+
monomial order on `k[y]`.
|
|
301
|
+
|
|
302
|
+
The product order (or block order) `<` `:=` `(<_1,<_2)` on `k[x,y]` is defined
|
|
303
|
+
as: `x^a y^b < x^A y^B` if and only if `x^a <_1 x^A` or (`x^a =x^A` and `y^b
|
|
304
|
+
<_2 y^B`).
|
|
305
|
+
|
|
306
|
+
These block orders are constructed in Sage by giving a comma separated list of
|
|
307
|
+
monomial orders with the length of each block attached to them.
|
|
308
|
+
|
|
309
|
+
EXAMPLES:
|
|
310
|
+
|
|
311
|
+
As an example, consider constructing a block order where the first four
|
|
312
|
+
variables are compared using the degree reverse lexicographical order while the
|
|
313
|
+
last two variables in the second block are compared using negative
|
|
314
|
+
lexicographical order.
|
|
315
|
+
|
|
316
|
+
::
|
|
317
|
+
|
|
318
|
+
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQ, 6, order='degrevlex(4),neglex(2)')
|
|
319
|
+
sage: a > c^4
|
|
320
|
+
False
|
|
321
|
+
sage: a > e^4
|
|
322
|
+
True
|
|
323
|
+
sage: e > f^2
|
|
324
|
+
False
|
|
325
|
+
|
|
326
|
+
The same result can be achieved by::
|
|
327
|
+
|
|
328
|
+
sage: T1 = TermOrder('degrevlex',4)
|
|
329
|
+
sage: T2 = TermOrder('neglex',2)
|
|
330
|
+
sage: T = T1 + T2
|
|
331
|
+
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQ, 6, order=T)
|
|
332
|
+
sage: a > c^4
|
|
333
|
+
False
|
|
334
|
+
sage: a > e^4
|
|
335
|
+
True
|
|
336
|
+
|
|
337
|
+
If any other unsupported term order is given the provided string can be forced
|
|
338
|
+
to be passed through as is to Singular, Macaulay2, and Magma. This ensures
|
|
339
|
+
that it is for example possible to calculate a Groebner basis with respect to
|
|
340
|
+
some term order Singular supports but Sage doesn't::
|
|
341
|
+
|
|
342
|
+
sage: T = TermOrder("royalorder")
|
|
343
|
+
Traceback (most recent call last):
|
|
344
|
+
...
|
|
345
|
+
ValueError: unknown term order 'royalorder'
|
|
346
|
+
sage: T = TermOrder("royalorder", force=True)
|
|
347
|
+
sage: T
|
|
348
|
+
royalorder term order
|
|
349
|
+
sage: T.singular_str()
|
|
350
|
+
'royalorder'
|
|
351
|
+
|
|
352
|
+
AUTHORS:
|
|
353
|
+
|
|
354
|
+
- David Joyner and William Stein: initial version of multi_polynomial_ring
|
|
355
|
+
|
|
356
|
+
- Kiran S. Kedlaya: added macaulay2 interface
|
|
357
|
+
|
|
358
|
+
- Martin Albrecht: implemented native term orders, refactoring
|
|
359
|
+
|
|
360
|
+
- Kwankyu Lee: implemented matrix and weighted degree term orders
|
|
361
|
+
|
|
362
|
+
- Simon King (2011-06-06): added termorder_from_singular
|
|
363
|
+
"""
|
|
364
|
+
#*****************************************************************************
|
|
365
|
+
# This program is free software: you can redistribute it and/or modify
|
|
366
|
+
# it under the terms of the GNU General Public License as published by
|
|
367
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
368
|
+
# (at your option) any later version.
|
|
369
|
+
# http://www.gnu.org/licenses/
|
|
370
|
+
#*****************************************************************************
|
|
371
|
+
import re
|
|
372
|
+
from sage.structure.sage_object import SageObject
|
|
373
|
+
|
|
374
|
+
print_name_mapping = {
|
|
375
|
+
'lex' : 'Lexicographic',
|
|
376
|
+
'invlex' : 'Inverse lexicographic',
|
|
377
|
+
'degrevlex' : 'Degree reverse lexicographic',
|
|
378
|
+
'deglex' : 'Degree lexicographic',
|
|
379
|
+
'neglex' : 'Negative lexicographic',
|
|
380
|
+
'negdegrevlex' : 'Negative degree reverse lexicographic',
|
|
381
|
+
'negdeglex' : 'Negative degree lexicographic',
|
|
382
|
+
'degneglex' : 'Degree negative lexicographic',
|
|
383
|
+
'wdegrevlex' : 'Weighted degree reverse lexicographic',
|
|
384
|
+
'wdeglex' : 'Weighted degree lexicographic',
|
|
385
|
+
'negwdegrevlex' : 'Negative weighted degree reverse lexicographic',
|
|
386
|
+
'negwdeglex' : 'Negative weighted degree lexicographic',
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
singular_name_mapping = {
|
|
390
|
+
'lex' : 'lp',
|
|
391
|
+
'invlex' : 'ip',
|
|
392
|
+
'degrevlex' : 'dp',
|
|
393
|
+
'deglex' : 'Dp',
|
|
394
|
+
'neglex' : 'ls',
|
|
395
|
+
'negdegrevlex' : 'ds',
|
|
396
|
+
'negdeglex' : 'Ds',
|
|
397
|
+
'degneglex' : '(a(1:%(ngens)i),ls(%(ngens)i))',
|
|
398
|
+
'wdegrevlex' : 'wp',
|
|
399
|
+
'wdeglex' : 'Wp',
|
|
400
|
+
'negwdegrevlex' : 'ws',
|
|
401
|
+
'negwdeglex' : 'Ws',
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
inv_singular_name_mapping = dict(zip(singular_name_mapping.values(),singular_name_mapping.keys()))
|
|
405
|
+
|
|
406
|
+
macaulay2_name_mapping = {
|
|
407
|
+
'lex' : 'Lex',
|
|
408
|
+
'revlex' : 'RevLex, Global=>false',
|
|
409
|
+
'degrevlex' : 'GRevLex',
|
|
410
|
+
'deglex' : 'GLex',
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
inv_macaulay2_name_mapping = dict(zip(macaulay2_name_mapping.values(),macaulay2_name_mapping.keys()))
|
|
414
|
+
|
|
415
|
+
magma_name_mapping = {
|
|
416
|
+
'lex' : '"lex"',
|
|
417
|
+
'degrevlex' : '"grevlex"',
|
|
418
|
+
'deglex' : '"glex"',
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
inv_magma_name_mapping = dict(zip(magma_name_mapping.values(),magma_name_mapping.keys()))
|
|
422
|
+
|
|
423
|
+
lex_description = r"""
|
|
424
|
+
Lexicographic (lex) term order.
|
|
425
|
+
|
|
426
|
+
`x^a < x^b` if and only if there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
427
|
+
"""
|
|
428
|
+
|
|
429
|
+
invlex_description = r"""
|
|
430
|
+
Inverse lexicographic (invlex) term order.
|
|
431
|
+
|
|
432
|
+
`x^a < x^b` if and only if there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i < b_i`.
|
|
433
|
+
"""
|
|
434
|
+
|
|
435
|
+
degrevlex_description = r"""
|
|
436
|
+
Degree reverse lexicographic (degrevlex) term order.
|
|
437
|
+
|
|
438
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
439
|
+
`x^a < x^b` if and only if `\deg(x^a) < \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
440
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
441
|
+
"""
|
|
442
|
+
|
|
443
|
+
deglex_description = r"""
|
|
444
|
+
Degree lexicographic (deglex) term order.
|
|
445
|
+
|
|
446
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
447
|
+
`x^a < x^b` if and only if `\deg(x^a) < \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
448
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
449
|
+
"""
|
|
450
|
+
|
|
451
|
+
neglex_description = r"""
|
|
452
|
+
Negative lexicographic (neglex) term order.
|
|
453
|
+
|
|
454
|
+
`x^a < x^b` if and only if there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i > b_i`.
|
|
455
|
+
"""
|
|
456
|
+
|
|
457
|
+
negdegrevlex_description = r"""
|
|
458
|
+
Negative degree reverse lexicographic (negdegrevlex) term order.
|
|
459
|
+
|
|
460
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
461
|
+
`x^a < x^b` if and only if `\deg(x^a) > \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
462
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
463
|
+
"""
|
|
464
|
+
|
|
465
|
+
negdeglex_description = r"""
|
|
466
|
+
Negative degree lexicographic (negdeglex) term order.
|
|
467
|
+
|
|
468
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
469
|
+
`x^a < x^b` if and only if `\deg(x^a) > \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
470
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
471
|
+
"""
|
|
472
|
+
|
|
473
|
+
degneglex_description = r"""
|
|
474
|
+
Degree negative lexicographic (degneglex) term order.
|
|
475
|
+
|
|
476
|
+
Let `\deg(x^a) = a_1 + a_2 + \dots + a_n`, then
|
|
477
|
+
`x^a < x^b` if and only if `\deg(x^a) < \deg(x^b)` or `\deg(x^a) = \deg(x^b)` and
|
|
478
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i > b_i`.
|
|
479
|
+
"""
|
|
480
|
+
|
|
481
|
+
wdegrevlex_description = r"""
|
|
482
|
+
Weighted degree reverse lexicographic (wdegrevlex) term order.
|
|
483
|
+
|
|
484
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
485
|
+
`x^a < x^b` if and only if `\deg_w(x^a) < \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
486
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
487
|
+
"""
|
|
488
|
+
|
|
489
|
+
wdeglex_description = r"""
|
|
490
|
+
Weighted degree lexicographic (wdeglex) term order.
|
|
491
|
+
|
|
492
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
493
|
+
`x^a < x^b` if and only if `\deg_w(x^a) < \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
494
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
495
|
+
"""
|
|
496
|
+
|
|
497
|
+
negwdegrevlex_description = r"""
|
|
498
|
+
Negative weighted degree reverse lexicographic (negwdegrevlex) term order.
|
|
499
|
+
|
|
500
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
501
|
+
`x^a < x^b` if and only if `\deg_w(x^a) > \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
502
|
+
there exists `1 \le i \le n` such that `a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i`.
|
|
503
|
+
"""
|
|
504
|
+
|
|
505
|
+
negwdeglex_description = r"""
|
|
506
|
+
Negative weighted degree lexicographic (negwdeglex) term order.
|
|
507
|
+
|
|
508
|
+
Let `\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n` with weights `w`, then
|
|
509
|
+
`x^a < x^b` if and only if `\deg_w(x^a) > \deg_w(x^b)` or `\deg_w(x^a) = \deg_w(x^b)` and
|
|
510
|
+
there exists `1 \le i \le n` such that `a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i`.
|
|
511
|
+
"""
|
|
512
|
+
|
|
513
|
+
matrix_description = """
|
|
514
|
+
Matrix term order defined by a matrix A.
|
|
515
|
+
|
|
516
|
+
`x^a < x^b` if and only if `x^{Aa} < x^{Ab}` where `<` is the lexicographic term order.
|
|
517
|
+
"""
|
|
518
|
+
|
|
519
|
+
block_description = r"""
|
|
520
|
+
Block term order defined by term orders `<_1, <_2, \dots, <_n`.
|
|
521
|
+
|
|
522
|
+
`x^a < x^b` if and only if `a = b` with respect to the first `n-1` term orders and `a <_n b`
|
|
523
|
+
with respect to the `n`-th term order `<_n`.
|
|
524
|
+
"""
|
|
525
|
+
|
|
526
|
+
description_mapping = {
|
|
527
|
+
'lex' : lex_description,
|
|
528
|
+
'invlex' : invlex_description,
|
|
529
|
+
'degrevlex' : degrevlex_description,
|
|
530
|
+
'deglex' : deglex_description,
|
|
531
|
+
'neglex' : neglex_description,
|
|
532
|
+
'negdegrevlex' : negdegrevlex_description,
|
|
533
|
+
'negdeglex' : negdeglex_description,
|
|
534
|
+
'degneglex' : degneglex_description,
|
|
535
|
+
'wdeglex' : wdeglex_description,
|
|
536
|
+
'wdegrevlex' : wdegrevlex_description,
|
|
537
|
+
'negwdegrevlex' : negwdegrevlex_description,
|
|
538
|
+
'negwdeglex' : negwdeglex_description,
|
|
539
|
+
'matrix' : matrix_description,
|
|
540
|
+
'block' : block_description,
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
class TermOrder(SageObject):
|
|
545
|
+
"""
|
|
546
|
+
A term order.
|
|
547
|
+
|
|
548
|
+
See ``sage.rings.polynomial.term_order`` for details on supported
|
|
549
|
+
term orders.
|
|
550
|
+
"""
|
|
551
|
+
def __setstate__(self, dict):
|
|
552
|
+
"""
|
|
553
|
+
Translate old pickled TermOrder objects.
|
|
554
|
+
|
|
555
|
+
See Issue :issue:`11316`.
|
|
556
|
+
|
|
557
|
+
EXAMPLES::
|
|
558
|
+
|
|
559
|
+
sage: t = TermOrder('lex')
|
|
560
|
+
sage: t2 = loads(dumps(t))
|
|
561
|
+
sage: t2._weights is None
|
|
562
|
+
True
|
|
563
|
+
"""
|
|
564
|
+
if '_weights' not in dict:
|
|
565
|
+
name = dict['_TermOrder__name']
|
|
566
|
+
n = dict['_TermOrder__length']
|
|
567
|
+
t = TermOrder(name,n)
|
|
568
|
+
self.__dict__.update(t.__dict__)
|
|
569
|
+
else:
|
|
570
|
+
self.__dict__.update(dict)
|
|
571
|
+
|
|
572
|
+
def __init__(self, name='lex', n=0, force=False):
|
|
573
|
+
"""
|
|
574
|
+
Construct a new term order object.
|
|
575
|
+
|
|
576
|
+
INPUT:
|
|
577
|
+
|
|
578
|
+
- ``name`` -- name of the term order (default: ``'lex'``)
|
|
579
|
+
|
|
580
|
+
- ``n`` -- number of variables (default: `0`) weights for
|
|
581
|
+
weighted degree orders. The weights are converted to
|
|
582
|
+
integers and must be positive.
|
|
583
|
+
|
|
584
|
+
- ``force`` -- ignore unknown term orders
|
|
585
|
+
|
|
586
|
+
See the ``sage.rings.polynomial.term_order`` module
|
|
587
|
+
for help which names and orders are available.
|
|
588
|
+
|
|
589
|
+
EXAMPLES::
|
|
590
|
+
|
|
591
|
+
sage: t = TermOrder('lex')
|
|
592
|
+
sage: t
|
|
593
|
+
Lexicographic term order
|
|
594
|
+
sage: loads(dumps(t)) == t
|
|
595
|
+
True
|
|
596
|
+
|
|
597
|
+
We can construct block orders directly as::
|
|
598
|
+
|
|
599
|
+
sage: TermOrder('degrevlex(3),neglex(2)')
|
|
600
|
+
Block term order with blocks:
|
|
601
|
+
(Degree reverse lexicographic term order of length 3,
|
|
602
|
+
Negative lexicographic term order of length 2)
|
|
603
|
+
|
|
604
|
+
or by adding together the blocks::
|
|
605
|
+
|
|
606
|
+
sage: t1 = TermOrder('degrevlex',3)
|
|
607
|
+
sage: t2 = TermOrder('neglex',2)
|
|
608
|
+
sage: t1 + t2
|
|
609
|
+
Block term order with blocks:
|
|
610
|
+
(Degree reverse lexicographic term order of length 3,
|
|
611
|
+
Negative lexicographic term order of length 2)
|
|
612
|
+
sage: t3 = TermOrder('wdeglex',(1,2))
|
|
613
|
+
sage: t1 + t3
|
|
614
|
+
Block term order with blocks:
|
|
615
|
+
(Degree reverse lexicographic term order of length 3,
|
|
616
|
+
Weighted degree lexicographic term order with weights (1, 2))
|
|
617
|
+
sage: t4 = TermOrder('degneglex')
|
|
618
|
+
sage: t4
|
|
619
|
+
Degree negative lexicographic term order
|
|
620
|
+
|
|
621
|
+
We allow blocks of length 0, these are simply ignored::
|
|
622
|
+
|
|
623
|
+
sage: TermOrder('lex(0),degrevlex(5),deglex(0),deglex(2)')
|
|
624
|
+
Block term order with blocks:
|
|
625
|
+
(Degree reverse lexicographic term order of length 5,
|
|
626
|
+
Degree lexicographic term order of length 2)
|
|
627
|
+
|
|
628
|
+
.. NOTE::
|
|
629
|
+
|
|
630
|
+
The optional `n` parameter is not necessary if only
|
|
631
|
+
non-block orders like `deglex` are
|
|
632
|
+
constructed. However, it is useful if block orders are
|
|
633
|
+
to be constructed from this ``TermOrder`` object later.
|
|
634
|
+
|
|
635
|
+
TESTS:
|
|
636
|
+
|
|
637
|
+
We demonstrate that nonpositive weights are refused and non-integral weights
|
|
638
|
+
are converted to integers (and potentially rounded)::
|
|
639
|
+
|
|
640
|
+
sage: N.<a,b,c> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',[-1,2,-3]))
|
|
641
|
+
Traceback (most recent call last):
|
|
642
|
+
...
|
|
643
|
+
ValueError: the degree weights must be positive integers
|
|
644
|
+
sage: N.<a,b,c> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',[1.1,2,3]))
|
|
645
|
+
sage: a.degree()
|
|
646
|
+
1
|
|
647
|
+
|
|
648
|
+
We enforce consistency when calling the copy constructor (cf.
|
|
649
|
+
:issue:`12748`)::
|
|
650
|
+
|
|
651
|
+
sage: T = TermOrder('degrevlex', 6) + TermOrder('degrevlex',10)
|
|
652
|
+
sage: R.<x0,y0,z0,x1,y1,z1,a0,a1,a2,a3,a4,a5,a6,a7,a8> = PolynomialRing(QQ, order=T)
|
|
653
|
+
Traceback (most recent call last):
|
|
654
|
+
...
|
|
655
|
+
ValueError: the length of the given term order (16) differs from the number of variables (15)
|
|
656
|
+
|
|
657
|
+
If ``_singular_ringorder_column`` attribute is set, then it is regarded
|
|
658
|
+
as a different term order::
|
|
659
|
+
|
|
660
|
+
sage: T = TermOrder('degrevlex')
|
|
661
|
+
sage: R.<x,y,z> = PolynomialRing(QQ, order=T)
|
|
662
|
+
sage: R._singular_() # needs sage.libs.singular
|
|
663
|
+
polynomial ring, over a field, global ordering
|
|
664
|
+
// coefficients: QQ...
|
|
665
|
+
// number of vars : 3
|
|
666
|
+
// block 1 : ordering dp
|
|
667
|
+
// : names x y z
|
|
668
|
+
// block 2 : ordering C
|
|
669
|
+
sage: T2 = copy(T)
|
|
670
|
+
sage: T2 == T
|
|
671
|
+
True
|
|
672
|
+
sage: T2._singular_ringorder_column = 0
|
|
673
|
+
sage: T2 == T
|
|
674
|
+
False
|
|
675
|
+
sage: S = R.change_ring(order=T2)
|
|
676
|
+
sage: S == T
|
|
677
|
+
False
|
|
678
|
+
sage: S._singular_() # needs sage.libs.singular
|
|
679
|
+
polynomial ring, over a field, global ordering
|
|
680
|
+
// coefficients: QQ...
|
|
681
|
+
// number of vars : 3
|
|
682
|
+
// block 1 : ordering C
|
|
683
|
+
// block 2 : ordering dp
|
|
684
|
+
// : names x y z
|
|
685
|
+
|
|
686
|
+
Check that :issue:`29635` is fixed::
|
|
687
|
+
|
|
688
|
+
sage: T = PolynomialRing(GF(101^5), 'u,v,w', # needs sage.rings.finite_rings
|
|
689
|
+
....: order=TermOrder('degneglex')).term_order()
|
|
690
|
+
sage: T.singular_str() # needs sage.rings.finite_rings
|
|
691
|
+
'(a(1:3),ls(3))'
|
|
692
|
+
sage: (T + T).singular_str() # needs sage.rings.finite_rings
|
|
693
|
+
'(a(1:3),ls(3),a(1:3),ls(3))'
|
|
694
|
+
"""
|
|
695
|
+
if isinstance(name, TermOrder):
|
|
696
|
+
self.__copy(name)
|
|
697
|
+
if n:
|
|
698
|
+
if not name.is_block_order() and not name.is_weighted_degree_order():
|
|
699
|
+
self._length = n
|
|
700
|
+
if self._length != 0:
|
|
701
|
+
self._singular_str = (self._singular_str
|
|
702
|
+
% dict(ngens=self._length))
|
|
703
|
+
elif self._length != n:
|
|
704
|
+
raise ValueError("the length of the given term order ({}) differs from the number of variables ({})"
|
|
705
|
+
.format(self._length, n))
|
|
706
|
+
return
|
|
707
|
+
|
|
708
|
+
if isinstance(name, str):
|
|
709
|
+
name = name.lower()
|
|
710
|
+
else:
|
|
711
|
+
try:
|
|
712
|
+
if not isinstance(name, (tuple, list)):
|
|
713
|
+
name = name.list() # name may be a matrix
|
|
714
|
+
name = tuple(name)
|
|
715
|
+
except Exception:
|
|
716
|
+
raise ValueError("{!r} is not a valid term order".format(name))
|
|
717
|
+
|
|
718
|
+
self._blocks = tuple()
|
|
719
|
+
self._weights = None
|
|
720
|
+
self._matrix = None
|
|
721
|
+
self._singular_moreblocks = 0
|
|
722
|
+
|
|
723
|
+
# Singular has special C block in ring order, that compares columns of
|
|
724
|
+
# monomials. This does not affect ordering of monomials of a ring, but
|
|
725
|
+
# does ordering of monomials of modules over the ring.
|
|
726
|
+
#
|
|
727
|
+
# If the attribute below is set to an integer i, then i divided by 2
|
|
728
|
+
# gives the position of the C block in the ring order; negative i means
|
|
729
|
+
# the default position at the end. The remainder of i divided by 2
|
|
730
|
+
# decides the ascending order if 0, or descending order if 1, of the
|
|
731
|
+
# column generators. Note that the ascending and descending orders of
|
|
732
|
+
# generators are written as 'C' and 'c', respectively, in Singular
|
|
733
|
+
# ring order string. See singular_str() method of this class.
|
|
734
|
+
#
|
|
735
|
+
# This is to be used for internal code that constructs Singular modules
|
|
736
|
+
# over the ring.
|
|
737
|
+
self._singular_ringorder_column = None
|
|
738
|
+
|
|
739
|
+
if name == "block": # block term order with blocks in a list
|
|
740
|
+
length = 0
|
|
741
|
+
blocks = []
|
|
742
|
+
singular_str = []
|
|
743
|
+
macaulay2_str = []
|
|
744
|
+
|
|
745
|
+
for t in n:
|
|
746
|
+
if not isinstance(t, TermOrder):
|
|
747
|
+
t = TermOrder(t, force=True)
|
|
748
|
+
if t.name() == 'block':
|
|
749
|
+
blocks = blocks + list(t.blocks())
|
|
750
|
+
singular_str.append("%s" % (t.singular_str()[1:-1],)) # [1:-1] is needed to remove parenthesis
|
|
751
|
+
macaulay2_str.append("%s" % (t.macaulay2_str()[1:-1],))
|
|
752
|
+
else:
|
|
753
|
+
if len(t) == 0:
|
|
754
|
+
raise ArithmeticError("Can only concatenate term orders with length attribute.")
|
|
755
|
+
blocks.append(t)
|
|
756
|
+
if t.is_weighted_degree_order(): # true if t is a matrix order as well
|
|
757
|
+
singular_str.append("%s" % (t.singular_str(),))
|
|
758
|
+
elif t.name() == 'degneglex':
|
|
759
|
+
singular_str.append("%s" % (t.singular_str()[1:-1],)) # [1:-1] to remove (,)
|
|
760
|
+
else:
|
|
761
|
+
singular_str.append("%s(%d)" % (t.singular_str(), len(t)))
|
|
762
|
+
macaulay2_str.append("%s => %d" % (t.macaulay2_str(), len(t)))
|
|
763
|
+
length += len(t)
|
|
764
|
+
self._singular_moreblocks += t.singular_moreblocks()
|
|
765
|
+
|
|
766
|
+
self._length = length
|
|
767
|
+
self._name = "block"
|
|
768
|
+
self._singular_str = "(" + ",".join(singular_str) + ")"
|
|
769
|
+
self._macaulay2_str = "{" + ",".join(macaulay2_str) + "}"
|
|
770
|
+
self._magma_str = "" # Magma does not support block order
|
|
771
|
+
self._blocks = tuple(blocks)
|
|
772
|
+
elif isinstance(name, str) and not isinstance(n, (tuple, list)):
|
|
773
|
+
# string representation of simple or block orders
|
|
774
|
+
if force:
|
|
775
|
+
self._length = n
|
|
776
|
+
self._name = name
|
|
777
|
+
self._singular_str = singular_name_mapping.get(name,name)
|
|
778
|
+
self._macaulay2_str = macaulay2_name_mapping.get(name,name)
|
|
779
|
+
self._magma_str = magma_name_mapping.get(name,name)
|
|
780
|
+
else:
|
|
781
|
+
split_pattern = r"([^(),]+(?:\([^()]*\)[^(),]*)*)" # split by outermost commas
|
|
782
|
+
block_names = re.findall(split_pattern,name)
|
|
783
|
+
|
|
784
|
+
if len(block_names) == 0:
|
|
785
|
+
raise ValueError("no term order specified")
|
|
786
|
+
elif len(block_names) == 1:
|
|
787
|
+
name = block_names[0]
|
|
788
|
+
match = re.match(r'm\(([-+0-9,]+)\)$',name)
|
|
789
|
+
if match: # matrix term order
|
|
790
|
+
m = [int(_) for _ in match.groups()[0].split(',')] # replace match.groups()[0] with match.group(1) later
|
|
791
|
+
self.__copy(TermOrder(m))
|
|
792
|
+
else: # simple order
|
|
793
|
+
if name not in print_name_mapping.keys() and name not in singular_name_mapping.values():
|
|
794
|
+
raise ValueError("unknown term order {!r}".format(name))
|
|
795
|
+
self._length = n
|
|
796
|
+
self._name = name
|
|
797
|
+
self._singular_str = singular_name_mapping.get(name,name)
|
|
798
|
+
self._macaulay2_str = macaulay2_name_mapping.get(name,name)
|
|
799
|
+
self._magma_str = magma_name_mapping.get(name,name)
|
|
800
|
+
else: # len(block_names) > 1, and hence block order represented by a string
|
|
801
|
+
length = 0
|
|
802
|
+
blocks = []
|
|
803
|
+
singular_str = []
|
|
804
|
+
macaulay2_str = []
|
|
805
|
+
|
|
806
|
+
length_pattern = re.compile(r"\(([0-9]+)\)$") # match with parenthesized block length at end
|
|
807
|
+
for block in block_names:
|
|
808
|
+
try:
|
|
809
|
+
block_name, block_length, _ = re.split(length_pattern,block.strip())
|
|
810
|
+
block_length = int(block_length)
|
|
811
|
+
if block_length > 0: # ignore blocks with length 0
|
|
812
|
+
blocks.append( TermOrder(block_name, block_length, force=force) )
|
|
813
|
+
singular_str.append("%s(%d)" % (singular_name_mapping.get(block_name, block_name), block_length))
|
|
814
|
+
macaulay2_str.append("%s => %d" % (macaulay2_name_mapping.get(block_name, block_name), block_length))
|
|
815
|
+
length += block_length
|
|
816
|
+
except ValueError:
|
|
817
|
+
block_name = block.strip()
|
|
818
|
+
if block_name.lower() != "c":
|
|
819
|
+
raise ValueError("{!r} is not a valid term order (wrong part: {!r})".format(name, block))
|
|
820
|
+
|
|
821
|
+
if n and length != n:
|
|
822
|
+
raise ValueError("term order length does not match the number of generators")
|
|
823
|
+
self.__copy(TermOrder('block', blocks))
|
|
824
|
+
elif isinstance(name, str) and isinstance(n, (tuple, list)):
|
|
825
|
+
# weighted degree term orders
|
|
826
|
+
if name not in print_name_mapping.keys() and name not in singular_name_mapping.values() and not force:
|
|
827
|
+
raise ValueError("unknown term order {!r}".format(name))
|
|
828
|
+
weights = tuple(int(w) for w in n) # n is a tuple of weights
|
|
829
|
+
if any(w <= 0 for w in weights):
|
|
830
|
+
raise ValueError("the degree weights must be positive integers")
|
|
831
|
+
|
|
832
|
+
self._length = len(weights)
|
|
833
|
+
self._name = name
|
|
834
|
+
self._singular_str = singular_name_mapping.get(name,name) + '(' + ','.join(str(w) for w in weights) + ')'
|
|
835
|
+
self._macaulay2_str = ""
|
|
836
|
+
self._magma_str = ""
|
|
837
|
+
self._weights = weights # defined only for weighted degree orders
|
|
838
|
+
elif isinstance(name, tuple): # name represents a matrix
|
|
839
|
+
if not n:
|
|
840
|
+
from math import sqrt
|
|
841
|
+
n = int(sqrt(len(name)))
|
|
842
|
+
if n*n != len(name):
|
|
843
|
+
raise ValueError("{} does not specify a square matrix".format(name))
|
|
844
|
+
|
|
845
|
+
int_str = ','.join(str(int(e)) for e in name)
|
|
846
|
+
|
|
847
|
+
self._length = n
|
|
848
|
+
self._name = "matrix"
|
|
849
|
+
self._singular_str = "M(%s)" % (int_str,)
|
|
850
|
+
self._macaulay2_str = "" # Macaulay2 does not support matrix term order directly
|
|
851
|
+
self._magma_str = '"weight",[%s]' % (int_str,)
|
|
852
|
+
|
|
853
|
+
from sage.matrix.constructor import matrix
|
|
854
|
+
self._matrix = matrix(n,name) # defined only for matrix term order
|
|
855
|
+
self._matrix.set_immutable()
|
|
856
|
+
self._weights = name[:n] # the first row of the matrix gives weights
|
|
857
|
+
else:
|
|
858
|
+
raise ValueError("{!r} is not a valid term order".format(name))
|
|
859
|
+
|
|
860
|
+
if self._length != 0:
|
|
861
|
+
self._singular_str = self._singular_str % dict(ngens=self._length)
|
|
862
|
+
if self._name == 'degneglex':
|
|
863
|
+
self._singular_moreblocks += 1
|
|
864
|
+
|
|
865
|
+
self.__doc__ = description_mapping.get(self._name, "No description available")
|
|
866
|
+
|
|
867
|
+
def __hash__(self):
|
|
868
|
+
r"""
|
|
869
|
+
A hash function.
|
|
870
|
+
|
|
871
|
+
EXAMPLES::
|
|
872
|
+
|
|
873
|
+
sage: _=hash(TermOrder('lex'))
|
|
874
|
+
"""
|
|
875
|
+
return hash((self._name, self._blocks, self._weights, self._matrix))
|
|
876
|
+
|
|
877
|
+
def __copy(self, other):
|
|
878
|
+
"""
|
|
879
|
+
Copy ``other`` term order to ``self``.
|
|
880
|
+
|
|
881
|
+
EXAMPLES::
|
|
882
|
+
|
|
883
|
+
sage: t = TermOrder('lex')
|
|
884
|
+
sage: s = TermOrder(t)
|
|
885
|
+
sage: t == s # indirect test
|
|
886
|
+
True
|
|
887
|
+
"""
|
|
888
|
+
self.__dict__ = other.__dict__.copy()
|
|
889
|
+
|
|
890
|
+
@property
|
|
891
|
+
def sortkey(self):
|
|
892
|
+
"""
|
|
893
|
+
The default ``sortkey`` method for this term order.
|
|
894
|
+
|
|
895
|
+
EXAMPLES::
|
|
896
|
+
|
|
897
|
+
sage: O = TermOrder()
|
|
898
|
+
sage: O.sortkey.__func__ is O.sortkey_lex.__func__
|
|
899
|
+
True
|
|
900
|
+
sage: O = TermOrder('deglex')
|
|
901
|
+
sage: O.sortkey.__func__ is O.sortkey_deglex.__func__
|
|
902
|
+
True
|
|
903
|
+
"""
|
|
904
|
+
|
|
905
|
+
return getattr(self, 'sortkey_' + self._name)
|
|
906
|
+
|
|
907
|
+
@property
|
|
908
|
+
def greater_tuple(self):
|
|
909
|
+
"""
|
|
910
|
+
The default ``greater_tuple`` method for this term order.
|
|
911
|
+
|
|
912
|
+
EXAMPLES::
|
|
913
|
+
|
|
914
|
+
sage: O = TermOrder()
|
|
915
|
+
sage: O.greater_tuple.__func__ is O.greater_tuple_lex.__func__
|
|
916
|
+
True
|
|
917
|
+
sage: O = TermOrder('deglex')
|
|
918
|
+
sage: O.greater_tuple.__func__ is O.greater_tuple_deglex.__func__
|
|
919
|
+
True
|
|
920
|
+
"""
|
|
921
|
+
|
|
922
|
+
return getattr(self, 'greater_tuple_' + self._name)
|
|
923
|
+
|
|
924
|
+
def sortkey_matrix(self, f):
|
|
925
|
+
"""
|
|
926
|
+
Return the sortkey of an exponent tuple with respect to the matrix
|
|
927
|
+
term order.
|
|
928
|
+
|
|
929
|
+
INPUT:
|
|
930
|
+
|
|
931
|
+
- ``f`` -- exponent tuple
|
|
932
|
+
|
|
933
|
+
EXAMPLES::
|
|
934
|
+
|
|
935
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='m(1,3,1,0)') # needs sage.rings.number_field
|
|
936
|
+
sage: y > x^2 # indirect doctest # needs sage.rings.number_field
|
|
937
|
+
True
|
|
938
|
+
sage: y > x^3 # needs sage.rings.number_field
|
|
939
|
+
False
|
|
940
|
+
"""
|
|
941
|
+
return tuple(sum(l * r for l, r in zip(row, f))
|
|
942
|
+
for row in self._matrix)
|
|
943
|
+
|
|
944
|
+
def sortkey_lex(self, f):
|
|
945
|
+
"""
|
|
946
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
947
|
+
lexicographical term order.
|
|
948
|
+
|
|
949
|
+
INPUT:
|
|
950
|
+
|
|
951
|
+
- ``f`` -- exponent tuple
|
|
952
|
+
|
|
953
|
+
EXAMPLES::
|
|
954
|
+
|
|
955
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='lex') # needs sage.rings.number_field
|
|
956
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
957
|
+
True
|
|
958
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
959
|
+
True
|
|
960
|
+
"""
|
|
961
|
+
return f
|
|
962
|
+
|
|
963
|
+
def sortkey_invlex(self, f):
|
|
964
|
+
"""
|
|
965
|
+
Return the sortkey of an exponent tuple with respect to the inversed
|
|
966
|
+
lexicographical term order.
|
|
967
|
+
|
|
968
|
+
INPUT:
|
|
969
|
+
|
|
970
|
+
- ``f`` -- exponent tuple
|
|
971
|
+
|
|
972
|
+
EXAMPLES::
|
|
973
|
+
|
|
974
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='invlex') # needs sage.rings.number_field
|
|
975
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
976
|
+
False
|
|
977
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
978
|
+
True
|
|
979
|
+
"""
|
|
980
|
+
return f.reversed()
|
|
981
|
+
|
|
982
|
+
def sortkey_deglex(self, f):
|
|
983
|
+
"""
|
|
984
|
+
Return the sortkey of an exponent tuple with respect to the degree
|
|
985
|
+
lexicographical term order.
|
|
986
|
+
|
|
987
|
+
INPUT:
|
|
988
|
+
|
|
989
|
+
- ``f`` -- exponent tuple
|
|
990
|
+
|
|
991
|
+
EXAMPLES::
|
|
992
|
+
|
|
993
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='deglex') # needs sage.rings.number_field
|
|
994
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
995
|
+
False
|
|
996
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
997
|
+
True
|
|
998
|
+
"""
|
|
999
|
+
return (sum(f.nonzero_values(sort=False)), f)
|
|
1000
|
+
|
|
1001
|
+
def sortkey_degrevlex(self, f):
|
|
1002
|
+
"""
|
|
1003
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1004
|
+
degree reversed lexicographical term order.
|
|
1005
|
+
|
|
1006
|
+
INPUT:
|
|
1007
|
+
|
|
1008
|
+
- ``f`` -- exponent tuple
|
|
1009
|
+
|
|
1010
|
+
EXAMPLES::
|
|
1011
|
+
|
|
1012
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='degrevlex') # needs sage.rings.number_field
|
|
1013
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1014
|
+
False
|
|
1015
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
1016
|
+
True
|
|
1017
|
+
"""
|
|
1018
|
+
return (sum(f.nonzero_values(sort=False)),
|
|
1019
|
+
f.reversed().emul(-1))
|
|
1020
|
+
# tuple(-v for v in f.reversed()))
|
|
1021
|
+
|
|
1022
|
+
def sortkey_neglex(self, f):
|
|
1023
|
+
"""
|
|
1024
|
+
Return the sortkey of an exponent tuple with respect to the negative
|
|
1025
|
+
lexicographical term order.
|
|
1026
|
+
|
|
1027
|
+
INPUT:
|
|
1028
|
+
|
|
1029
|
+
- ``f`` -- exponent tuple
|
|
1030
|
+
|
|
1031
|
+
EXAMPLES::
|
|
1032
|
+
|
|
1033
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='neglex') # needs sage.rings.number_field
|
|
1034
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1035
|
+
False
|
|
1036
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
1037
|
+
False
|
|
1038
|
+
"""
|
|
1039
|
+
return tuple(-v for v in f)
|
|
1040
|
+
|
|
1041
|
+
def sortkey_negdegrevlex(self, f):
|
|
1042
|
+
"""
|
|
1043
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1044
|
+
negative degree reverse lexicographical term order.
|
|
1045
|
+
|
|
1046
|
+
INPUT:
|
|
1047
|
+
|
|
1048
|
+
- ``f`` -- exponent tuple
|
|
1049
|
+
|
|
1050
|
+
EXAMPLES::
|
|
1051
|
+
|
|
1052
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='negdegrevlex') # needs sage.rings.number_field
|
|
1053
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1054
|
+
True
|
|
1055
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
1056
|
+
False
|
|
1057
|
+
"""
|
|
1058
|
+
return (-sum(f.nonzero_values(sort=False)),
|
|
1059
|
+
tuple(-v for v in f.reversed()))
|
|
1060
|
+
|
|
1061
|
+
def sortkey_negdeglex(self, f):
|
|
1062
|
+
"""
|
|
1063
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1064
|
+
negative degree lexicographical term order.
|
|
1065
|
+
|
|
1066
|
+
INPUT:
|
|
1067
|
+
|
|
1068
|
+
- ``f`` -- exponent tuple
|
|
1069
|
+
|
|
1070
|
+
EXAMPLES::
|
|
1071
|
+
|
|
1072
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='negdeglex') # needs sage.rings.number_field
|
|
1073
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1074
|
+
True
|
|
1075
|
+
sage: x > 1 # needs sage.rings.number_field
|
|
1076
|
+
False
|
|
1077
|
+
"""
|
|
1078
|
+
return (-sum(f.nonzero_values(sort=False)), f)
|
|
1079
|
+
|
|
1080
|
+
def sortkey_degneglex(self, f):
|
|
1081
|
+
"""
|
|
1082
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1083
|
+
degree negative lexicographical term order.
|
|
1084
|
+
|
|
1085
|
+
INPUT:
|
|
1086
|
+
|
|
1087
|
+
- ``f`` -- exponent tuple
|
|
1088
|
+
|
|
1089
|
+
EXAMPLES::
|
|
1090
|
+
|
|
1091
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='degneglex') # needs sage.rings.number_field
|
|
1092
|
+
sage: x*y > y*z # indirect doctest # needs sage.rings.number_field
|
|
1093
|
+
False
|
|
1094
|
+
sage: x*y > x # needs sage.rings.number_field
|
|
1095
|
+
True
|
|
1096
|
+
"""
|
|
1097
|
+
return (sum(f.nonzero_values(sort=False)), tuple(-v for v in f))
|
|
1098
|
+
|
|
1099
|
+
def sortkey_wdegrevlex(self, f):
|
|
1100
|
+
"""
|
|
1101
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1102
|
+
weighted degree reverse lexicographical term order.
|
|
1103
|
+
|
|
1104
|
+
INPUT:
|
|
1105
|
+
|
|
1106
|
+
- ``f`` -- exponent tuple
|
|
1107
|
+
|
|
1108
|
+
EXAMPLES::
|
|
1109
|
+
|
|
1110
|
+
sage: t = TermOrder('wdegrevlex',(3,2))
|
|
1111
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field
|
|
1112
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1113
|
+
False
|
|
1114
|
+
sage: x^2 > y^3 # needs sage.rings.number_field
|
|
1115
|
+
True
|
|
1116
|
+
"""
|
|
1117
|
+
return (sum(l * r for (l, r) in zip(f, self._weights)),
|
|
1118
|
+
tuple(-v for v in f.reversed()))
|
|
1119
|
+
|
|
1120
|
+
def sortkey_wdeglex(self, f):
|
|
1121
|
+
"""
|
|
1122
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1123
|
+
weighted degree lexicographical term order.
|
|
1124
|
+
|
|
1125
|
+
INPUT:
|
|
1126
|
+
|
|
1127
|
+
- ``f`` -- exponent tuple
|
|
1128
|
+
|
|
1129
|
+
EXAMPLES::
|
|
1130
|
+
|
|
1131
|
+
sage: t = TermOrder('wdeglex',(3,2))
|
|
1132
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field
|
|
1133
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1134
|
+
False
|
|
1135
|
+
sage: x > y # needs sage.rings.number_field
|
|
1136
|
+
True
|
|
1137
|
+
"""
|
|
1138
|
+
return (sum(l * r for (l, r) in zip(f, self._weights)), f)
|
|
1139
|
+
|
|
1140
|
+
def sortkey_negwdeglex(self, f):
|
|
1141
|
+
"""
|
|
1142
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1143
|
+
negative weighted degree lexicographical term order.
|
|
1144
|
+
|
|
1145
|
+
INPUT:
|
|
1146
|
+
|
|
1147
|
+
- ``f`` -- exponent tuple
|
|
1148
|
+
|
|
1149
|
+
EXAMPLES::
|
|
1150
|
+
|
|
1151
|
+
sage: t = TermOrder('negwdeglex',(3,2))
|
|
1152
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field
|
|
1153
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1154
|
+
True
|
|
1155
|
+
sage: x^2 > y^3 # needs sage.rings.number_field
|
|
1156
|
+
True
|
|
1157
|
+
"""
|
|
1158
|
+
return (-sum(l * r for (l, r) in zip(f, self._weights)), f)
|
|
1159
|
+
|
|
1160
|
+
def sortkey_negwdegrevlex(self, f):
|
|
1161
|
+
"""
|
|
1162
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1163
|
+
negative weighted degree reverse lexicographical term order.
|
|
1164
|
+
|
|
1165
|
+
INPUT:
|
|
1166
|
+
|
|
1167
|
+
- ``f`` -- exponent tuple
|
|
1168
|
+
|
|
1169
|
+
EXAMPLES::
|
|
1170
|
+
|
|
1171
|
+
sage: t = TermOrder('negwdegrevlex',(3,2))
|
|
1172
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field
|
|
1173
|
+
sage: x > y^2 # indirect doctest # needs sage.rings.number_field
|
|
1174
|
+
True
|
|
1175
|
+
sage: x^2 > y^3 # needs sage.rings.number_field
|
|
1176
|
+
True
|
|
1177
|
+
"""
|
|
1178
|
+
return (-sum(l * r for (l, r) in zip(f, self._weights)),
|
|
1179
|
+
tuple(-v for v in f.reversed()))
|
|
1180
|
+
|
|
1181
|
+
def sortkey_block(self, f):
|
|
1182
|
+
"""
|
|
1183
|
+
Return the sortkey of an exponent tuple with respect to the
|
|
1184
|
+
block order as specified when constructing this element.
|
|
1185
|
+
|
|
1186
|
+
INPUT:
|
|
1187
|
+
|
|
1188
|
+
- ``f`` -- exponent tuple
|
|
1189
|
+
|
|
1190
|
+
EXAMPLES::
|
|
1191
|
+
|
|
1192
|
+
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQbar, 6, # needs sage.rings.number_field
|
|
1193
|
+
....: order='degrevlex(3),degrevlex(3)')
|
|
1194
|
+
sage: a > c^4 # indirect doctest # needs sage.rings.number_field
|
|
1195
|
+
False
|
|
1196
|
+
sage: a > e^4 # needs sage.rings.number_field
|
|
1197
|
+
True
|
|
1198
|
+
|
|
1199
|
+
TESTS:
|
|
1200
|
+
|
|
1201
|
+
Check that the issue in :issue:`27139` is fixed::
|
|
1202
|
+
|
|
1203
|
+
sage: R.<x,y,z,t> = PolynomialRing(AA, order='lex(2),lex(2)') # needs sage.rings.number_field
|
|
1204
|
+
sage: x > y # needs sage.rings.number_field
|
|
1205
|
+
True
|
|
1206
|
+
"""
|
|
1207
|
+
key = tuple()
|
|
1208
|
+
n = 0
|
|
1209
|
+
for block in self:
|
|
1210
|
+
r = getattr(block, "sortkey_" + block.name())(f[n:n + len(block)])
|
|
1211
|
+
key += tuple(r)
|
|
1212
|
+
n += len(block)
|
|
1213
|
+
return key
|
|
1214
|
+
|
|
1215
|
+
def greater_tuple_matrix(self, f, g):
|
|
1216
|
+
"""
|
|
1217
|
+
Return the greater exponent tuple with respect to the matrix
|
|
1218
|
+
term order.
|
|
1219
|
+
|
|
1220
|
+
INPUT:
|
|
1221
|
+
|
|
1222
|
+
- ``f`` -- exponent tuple
|
|
1223
|
+
|
|
1224
|
+
- ``g`` -- exponent tuple
|
|
1225
|
+
|
|
1226
|
+
EXAMPLES::
|
|
1227
|
+
|
|
1228
|
+
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='m(1,3,1,0)') # needs sage.rings.number_field
|
|
1229
|
+
sage: y > x^2 # indirect doctest # needs sage.rings.number_field
|
|
1230
|
+
True
|
|
1231
|
+
sage: y > x^3 # needs sage.rings.number_field
|
|
1232
|
+
False
|
|
1233
|
+
"""
|
|
1234
|
+
for row in self._matrix:
|
|
1235
|
+
sf = sum(l*r for (l,r) in zip(row,f))
|
|
1236
|
+
sg = sum(l*r for (l,r) in zip(row,g))
|
|
1237
|
+
|
|
1238
|
+
if sf > sg:
|
|
1239
|
+
return f
|
|
1240
|
+
elif sf < sg:
|
|
1241
|
+
return g
|
|
1242
|
+
return g
|
|
1243
|
+
|
|
1244
|
+
def greater_tuple_lex(self, f, g):
|
|
1245
|
+
"""
|
|
1246
|
+
Return the greater exponent tuple with respect to the
|
|
1247
|
+
lexicographical term order.
|
|
1248
|
+
|
|
1249
|
+
INPUT:
|
|
1250
|
+
|
|
1251
|
+
- ``f`` -- exponent tuple
|
|
1252
|
+
|
|
1253
|
+
- ``g`` -- exponent tuple
|
|
1254
|
+
|
|
1255
|
+
EXAMPLES::
|
|
1256
|
+
|
|
1257
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='lex') # needs sage.rings.number_field
|
|
1258
|
+
sage: f = x + y^2; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1259
|
+
x
|
|
1260
|
+
|
|
1261
|
+
This method is called by the lm/lc/lt methods of
|
|
1262
|
+
``MPolynomial_polydict``.
|
|
1263
|
+
"""
|
|
1264
|
+
return f > g and f or g
|
|
1265
|
+
|
|
1266
|
+
def greater_tuple_invlex(self, f, g):
|
|
1267
|
+
"""
|
|
1268
|
+
Return the greater exponent tuple with respect to the inversed
|
|
1269
|
+
lexicographical term order.
|
|
1270
|
+
|
|
1271
|
+
INPUT:
|
|
1272
|
+
|
|
1273
|
+
- ``f`` -- exponent tuple
|
|
1274
|
+
|
|
1275
|
+
- ``g`` -- exponent tuple
|
|
1276
|
+
|
|
1277
|
+
EXAMPLES::
|
|
1278
|
+
|
|
1279
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='invlex') # needs sage.rings.number_field
|
|
1280
|
+
sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1281
|
+
y
|
|
1282
|
+
sage: f = y + x^2; f.lm() # needs sage.rings.number_field
|
|
1283
|
+
y
|
|
1284
|
+
|
|
1285
|
+
This method is called by the lm/lc/lt methods of
|
|
1286
|
+
``MPolynomial_polydict``.
|
|
1287
|
+
"""
|
|
1288
|
+
return f.reversed() > g.reversed() and f or g
|
|
1289
|
+
|
|
1290
|
+
def greater_tuple_deglex(self, f, g):
|
|
1291
|
+
"""
|
|
1292
|
+
Return the greater exponent tuple with respect to the total degree
|
|
1293
|
+
lexicographical term order.
|
|
1294
|
+
|
|
1295
|
+
INPUT:
|
|
1296
|
+
|
|
1297
|
+
- ``f`` -- exponent tuple
|
|
1298
|
+
|
|
1299
|
+
- ``g`` -- exponent tuple
|
|
1300
|
+
|
|
1301
|
+
EXAMPLES::
|
|
1302
|
+
|
|
1303
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='deglex') # needs sage.rings.number_field
|
|
1304
|
+
sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1305
|
+
x
|
|
1306
|
+
sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field
|
|
1307
|
+
y^2*z
|
|
1308
|
+
|
|
1309
|
+
This method is called by the lm/lc/lt methods of
|
|
1310
|
+
``MPolynomial_polydict``.
|
|
1311
|
+
"""
|
|
1312
|
+
sf = sum(f.nonzero_values(sort=False))
|
|
1313
|
+
sg = sum(g.nonzero_values(sort=False))
|
|
1314
|
+
return ( sf > sg or ( sf == sg and f > g )) and f or g
|
|
1315
|
+
|
|
1316
|
+
def greater_tuple_degrevlex(self, f, g):
|
|
1317
|
+
"""
|
|
1318
|
+
Return the greater exponent tuple with respect to the total degree
|
|
1319
|
+
reversed lexicographical term order.
|
|
1320
|
+
|
|
1321
|
+
INPUT:
|
|
1322
|
+
|
|
1323
|
+
- ``f`` -- exponent tuple
|
|
1324
|
+
|
|
1325
|
+
- ``g`` -- exponent tuple
|
|
1326
|
+
|
|
1327
|
+
EXAMPLES::
|
|
1328
|
+
|
|
1329
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='degrevlex') # needs sage.rings.number_field
|
|
1330
|
+
sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1331
|
+
x
|
|
1332
|
+
sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field
|
|
1333
|
+
y^2*z
|
|
1334
|
+
|
|
1335
|
+
This method is called by the lm/lc/lt methods of
|
|
1336
|
+
``MPolynomial_polydict``.
|
|
1337
|
+
"""
|
|
1338
|
+
sf = sum(f.nonzero_values(sort=False))
|
|
1339
|
+
sg = sum(g.nonzero_values(sort=False))
|
|
1340
|
+
return ( sf > sg or ( sf == sg and f.reversed() < g.reversed() )) and f or g
|
|
1341
|
+
|
|
1342
|
+
def greater_tuple_negdegrevlex(self, f, g):
|
|
1343
|
+
"""
|
|
1344
|
+
Return the greater exponent tuple with respect to the negative
|
|
1345
|
+
degree reverse lexicographical term order.
|
|
1346
|
+
|
|
1347
|
+
INPUT:
|
|
1348
|
+
|
|
1349
|
+
- ``f`` -- exponent tuple
|
|
1350
|
+
|
|
1351
|
+
- ``g`` -- exponent tuple
|
|
1352
|
+
|
|
1353
|
+
EXAMPLES::
|
|
1354
|
+
|
|
1355
|
+
sage: # needs sage.rings.number_field
|
|
1356
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='negdegrevlex')
|
|
1357
|
+
sage: f = x + y; f.lm() # indirect doctest
|
|
1358
|
+
x
|
|
1359
|
+
sage: f = x + x^2; f.lm()
|
|
1360
|
+
x
|
|
1361
|
+
sage: f = x^2*y*z^2 + x*y^3*z; f.lm()
|
|
1362
|
+
x*y^3*z
|
|
1363
|
+
|
|
1364
|
+
This method is called by the lm/lc/lt methods of
|
|
1365
|
+
``MPolynomial_polydict``.
|
|
1366
|
+
"""
|
|
1367
|
+
sf = sum(f.nonzero_values(sort=False))
|
|
1368
|
+
sg = sum(g.nonzero_values(sort=False))
|
|
1369
|
+
return ( sf < sg or ( sf == sg and f.reversed() < g.reversed() )) and f or g
|
|
1370
|
+
|
|
1371
|
+
def greater_tuple_negdeglex(self, f, g):
|
|
1372
|
+
"""
|
|
1373
|
+
Return the greater exponent tuple with respect to the negative
|
|
1374
|
+
degree lexicographical term order.
|
|
1375
|
+
|
|
1376
|
+
INPUT:
|
|
1377
|
+
|
|
1378
|
+
- ``f`` -- exponent tuple
|
|
1379
|
+
|
|
1380
|
+
- ``g`` -- exponent tuple
|
|
1381
|
+
|
|
1382
|
+
EXAMPLES::
|
|
1383
|
+
|
|
1384
|
+
sage: # needs sage.rings.number_field
|
|
1385
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='negdeglex')
|
|
1386
|
+
sage: f = x + y; f.lm() # indirect doctest
|
|
1387
|
+
x
|
|
1388
|
+
sage: f = x + x^2; f.lm()
|
|
1389
|
+
x
|
|
1390
|
+
sage: f = x^2*y*z^2 + x*y^3*z; f.lm()
|
|
1391
|
+
x^2*y*z^2
|
|
1392
|
+
|
|
1393
|
+
This method is called by the lm/lc/lt methods of
|
|
1394
|
+
``MPolynomial_polydict``.
|
|
1395
|
+
"""
|
|
1396
|
+
sf = sum(f.nonzero_values(sort=False))
|
|
1397
|
+
sg = sum(g.nonzero_values(sort=False))
|
|
1398
|
+
return ( sf < sg or ( sf == sg and f > g )) and f or g
|
|
1399
|
+
|
|
1400
|
+
def greater_tuple_degneglex(self, f, g):
|
|
1401
|
+
"""
|
|
1402
|
+
Return the greater exponent tuple with respect to the degree negative
|
|
1403
|
+
lexicographical term order.
|
|
1404
|
+
|
|
1405
|
+
INPUT:
|
|
1406
|
+
|
|
1407
|
+
- ``f`` -- exponent tuple
|
|
1408
|
+
|
|
1409
|
+
- ``g`` -- exponent tuple
|
|
1410
|
+
|
|
1411
|
+
EXAMPLES::
|
|
1412
|
+
|
|
1413
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='degneglex') # needs sage.rings.number_field
|
|
1414
|
+
sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1415
|
+
y
|
|
1416
|
+
sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field
|
|
1417
|
+
y^2*z
|
|
1418
|
+
|
|
1419
|
+
This method is called by the lm/lc/lt methods of
|
|
1420
|
+
``MPolynomial_polydict``.
|
|
1421
|
+
"""
|
|
1422
|
+
sf = sum(f.nonzero_values(sort=False))
|
|
1423
|
+
sg = sum(g.nonzero_values(sort=False))
|
|
1424
|
+
return ( sf > sg or ( sf == sg and f < g )) and f or g
|
|
1425
|
+
|
|
1426
|
+
def greater_tuple_neglex(self, f, g):
|
|
1427
|
+
"""
|
|
1428
|
+
Return the greater exponent tuple with respect to the negative
|
|
1429
|
+
lexicographical term order.
|
|
1430
|
+
|
|
1431
|
+
This method is called by the lm/lc/lt methods of
|
|
1432
|
+
``MPolynomial_polydict``.
|
|
1433
|
+
|
|
1434
|
+
INPUT:
|
|
1435
|
+
|
|
1436
|
+
- ``f`` -- exponent tuple
|
|
1437
|
+
|
|
1438
|
+
- ``g`` -- exponent tuple
|
|
1439
|
+
|
|
1440
|
+
EXAMPLES::
|
|
1441
|
+
|
|
1442
|
+
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQbar, 6, # needs sage.rings.number_field
|
|
1443
|
+
....: order='degrevlex(3),degrevlex(3)')
|
|
1444
|
+
sage: f = a + c^4; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1445
|
+
c^4
|
|
1446
|
+
sage: g = a + e^4; g.lm() # needs sage.rings.number_field
|
|
1447
|
+
a
|
|
1448
|
+
"""
|
|
1449
|
+
return (f < g) and f or g
|
|
1450
|
+
|
|
1451
|
+
def greater_tuple_wdeglex(self, f, g):
|
|
1452
|
+
"""
|
|
1453
|
+
Return the greater exponent tuple with respect to the weighted degree
|
|
1454
|
+
lexicographical term order.
|
|
1455
|
+
|
|
1456
|
+
INPUT:
|
|
1457
|
+
|
|
1458
|
+
- ``f`` -- exponent tuple
|
|
1459
|
+
|
|
1460
|
+
- ``g`` -- exponent tuple
|
|
1461
|
+
|
|
1462
|
+
EXAMPLES::
|
|
1463
|
+
|
|
1464
|
+
sage: t = TermOrder('wdeglex',(1,2,3))
|
|
1465
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t) # needs sage.rings.number_field
|
|
1466
|
+
sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1467
|
+
y
|
|
1468
|
+
sage: f = x*y + z; f.lm() # needs sage.rings.number_field
|
|
1469
|
+
x*y
|
|
1470
|
+
|
|
1471
|
+
This method is called by the lm/lc/lt methods of
|
|
1472
|
+
``MPolynomial_polydict``.
|
|
1473
|
+
"""
|
|
1474
|
+
sf = sum(l*r for (l,r) in zip(f,self._weights))
|
|
1475
|
+
sg = sum(l*r for (l,r) in zip(g,self._weights))
|
|
1476
|
+
return (sf > sg or ( sf == sg and f > g )) and f or g
|
|
1477
|
+
|
|
1478
|
+
def greater_tuple_wdegrevlex(self, f, g):
|
|
1479
|
+
"""
|
|
1480
|
+
Return the greater exponent tuple with respect to the weighted degree
|
|
1481
|
+
reverse lexicographical term order.
|
|
1482
|
+
|
|
1483
|
+
INPUT:
|
|
1484
|
+
|
|
1485
|
+
- ``f`` -- exponent tuple
|
|
1486
|
+
|
|
1487
|
+
- ``g`` -- exponent tuple
|
|
1488
|
+
|
|
1489
|
+
EXAMPLES::
|
|
1490
|
+
|
|
1491
|
+
sage: t = TermOrder('wdegrevlex',(1,2,3))
|
|
1492
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t) # needs sage.rings.number_field
|
|
1493
|
+
sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1494
|
+
y
|
|
1495
|
+
sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field
|
|
1496
|
+
y^2*z
|
|
1497
|
+
|
|
1498
|
+
This method is called by the lm/lc/lt methods of
|
|
1499
|
+
``MPolynomial_polydict``.
|
|
1500
|
+
"""
|
|
1501
|
+
sf = sum(l*r for (l,r) in zip(f,self._weights))
|
|
1502
|
+
sg = sum(l*r for (l,r) in zip(g,self._weights))
|
|
1503
|
+
return (sf > sg or ( sf == sg and f.reversed() < g.reversed())) and f or g
|
|
1504
|
+
|
|
1505
|
+
def greater_tuple_negwdeglex(self, f, g):
|
|
1506
|
+
"""
|
|
1507
|
+
Return the greater exponent tuple with respect to the negative
|
|
1508
|
+
weighted degree lexicographical term order.
|
|
1509
|
+
|
|
1510
|
+
INPUT:
|
|
1511
|
+
|
|
1512
|
+
- ``f`` -- exponent tuple
|
|
1513
|
+
|
|
1514
|
+
- ``g`` -- exponent tuple
|
|
1515
|
+
|
|
1516
|
+
EXAMPLES::
|
|
1517
|
+
|
|
1518
|
+
sage: # needs sage.rings.number_field
|
|
1519
|
+
sage: t = TermOrder('negwdeglex',(1,2,3))
|
|
1520
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t)
|
|
1521
|
+
sage: f = x + y; f.lm() # indirect doctest
|
|
1522
|
+
x
|
|
1523
|
+
sage: f = x + x^2; f.lm()
|
|
1524
|
+
x
|
|
1525
|
+
sage: f = x^3 + z; f.lm()
|
|
1526
|
+
x^3
|
|
1527
|
+
|
|
1528
|
+
This method is called by the lm/lc/lt methods of
|
|
1529
|
+
``MPolynomial_polydict``.
|
|
1530
|
+
"""
|
|
1531
|
+
sf = sum(l*r for (l,r) in zip(f,self._weights))
|
|
1532
|
+
sg = sum(l*r for (l,r) in zip(g,self._weights))
|
|
1533
|
+
return (sf < sg or ( sf == sg and f > g )) and f or g
|
|
1534
|
+
|
|
1535
|
+
def greater_tuple_negwdegrevlex(self, f, g):
|
|
1536
|
+
"""
|
|
1537
|
+
Return the greater exponent tuple with respect to the negative
|
|
1538
|
+
weighted degree reverse lexicographical term order.
|
|
1539
|
+
|
|
1540
|
+
INPUT:
|
|
1541
|
+
|
|
1542
|
+
- ``f`` -- exponent tuple
|
|
1543
|
+
|
|
1544
|
+
- ``g`` -- exponent tuple
|
|
1545
|
+
|
|
1546
|
+
EXAMPLES::
|
|
1547
|
+
|
|
1548
|
+
sage: # needs sage.rings.number_field
|
|
1549
|
+
sage: t = TermOrder('negwdegrevlex',(1,2,3))
|
|
1550
|
+
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t)
|
|
1551
|
+
sage: f = x + y; f.lm() # indirect doctest
|
|
1552
|
+
x
|
|
1553
|
+
sage: f = x + x^2; f.lm()
|
|
1554
|
+
x
|
|
1555
|
+
sage: f = x^3 + z; f.lm()
|
|
1556
|
+
x^3
|
|
1557
|
+
|
|
1558
|
+
This method is called by the lm/lc/lt methods of
|
|
1559
|
+
``MPolynomial_polydict``.
|
|
1560
|
+
"""
|
|
1561
|
+
sf = sum(l*r for (l,r) in zip(f,self._weights))
|
|
1562
|
+
sg = sum(l*r for (l,r) in zip(g,self._weights))
|
|
1563
|
+
return (sf < sg or ( sf == sg and f.reversed() < g.reversed() )) and f or g
|
|
1564
|
+
|
|
1565
|
+
def greater_tuple_block(self, f, g):
|
|
1566
|
+
"""
|
|
1567
|
+
Return the greater exponent tuple with respect to the block
|
|
1568
|
+
order as specified when constructing this element.
|
|
1569
|
+
|
|
1570
|
+
This method is called by the lm/lc/lt methods of
|
|
1571
|
+
``MPolynomial_polydict``.
|
|
1572
|
+
|
|
1573
|
+
INPUT:
|
|
1574
|
+
|
|
1575
|
+
- ``f`` -- exponent tuple
|
|
1576
|
+
|
|
1577
|
+
- ``g`` -- exponent tuple
|
|
1578
|
+
|
|
1579
|
+
EXAMPLES::
|
|
1580
|
+
|
|
1581
|
+
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQbar, 6, # needs sage.rings.number_field
|
|
1582
|
+
....: order='degrevlex(3),degrevlex(3)')
|
|
1583
|
+
sage: f = a + c^4; f.lm() # indirect doctest # needs sage.rings.number_field
|
|
1584
|
+
c^4
|
|
1585
|
+
sage: g = a + e^4; g.lm() # needs sage.rings.number_field
|
|
1586
|
+
a
|
|
1587
|
+
"""
|
|
1588
|
+
n = 0
|
|
1589
|
+
for block in self:
|
|
1590
|
+
keyfn = getattr(block, "sortkey_" + block.name())
|
|
1591
|
+
f_key = keyfn(f[n:n + len(block)])
|
|
1592
|
+
g_key = keyfn(g[n:n + len(block)])
|
|
1593
|
+
if f_key != g_key:
|
|
1594
|
+
if f_key < g_key:
|
|
1595
|
+
return g
|
|
1596
|
+
else:
|
|
1597
|
+
return f
|
|
1598
|
+
n += len(block)
|
|
1599
|
+
return f
|
|
1600
|
+
|
|
1601
|
+
def tuple_weight(self, f):
|
|
1602
|
+
"""
|
|
1603
|
+
Return the weight of tuple f.
|
|
1604
|
+
|
|
1605
|
+
INPUT:
|
|
1606
|
+
|
|
1607
|
+
- ``f`` -- exponent tuple
|
|
1608
|
+
|
|
1609
|
+
EXAMPLES::
|
|
1610
|
+
|
|
1611
|
+
sage: t = TermOrder('wdeglex',(1,2,3))
|
|
1612
|
+
sage: P.<a,b,c> = PolynomialRing(QQbar, order=t) # needs sage.rings.number_field
|
|
1613
|
+
sage: P.term_order().tuple_weight([3,2,1]) # needs sage.rings.number_field
|
|
1614
|
+
10
|
|
1615
|
+
"""
|
|
1616
|
+
return sum(l*r for (l,r) in zip(f,self._weights))
|
|
1617
|
+
|
|
1618
|
+
def name(self):
|
|
1619
|
+
"""
|
|
1620
|
+
EXAMPLES::
|
|
1621
|
+
|
|
1622
|
+
sage: TermOrder('lex').name()
|
|
1623
|
+
'lex'
|
|
1624
|
+
"""
|
|
1625
|
+
return self._name
|
|
1626
|
+
|
|
1627
|
+
def _repr_(self):
|
|
1628
|
+
"""
|
|
1629
|
+
EXAMPLES::
|
|
1630
|
+
|
|
1631
|
+
sage: TermOrder('lex') # indirect doctest
|
|
1632
|
+
Lexicographic term order
|
|
1633
|
+
"""
|
|
1634
|
+
if self._name == 'matrix':
|
|
1635
|
+
return 'Matrix term order with matrix\n%s' % (self._matrix,)
|
|
1636
|
+
elif self._name == 'block':
|
|
1637
|
+
s = []
|
|
1638
|
+
for t in self._blocks:
|
|
1639
|
+
if not t.is_weighted_degree_order():
|
|
1640
|
+
s.append('%s of length %d' % (t,len(t)))
|
|
1641
|
+
else: # includes matrix order
|
|
1642
|
+
s.append('%s' % (t,))
|
|
1643
|
+
return 'Block term order with blocks:\n(%s)' % (',\n '.join(s),)
|
|
1644
|
+
else:
|
|
1645
|
+
s = print_name_mapping.get(self._name,self._name) + ' term order'
|
|
1646
|
+
if self.is_weighted_degree_order():
|
|
1647
|
+
s = s + ' with weights %s' % (self._weights,)
|
|
1648
|
+
return s
|
|
1649
|
+
|
|
1650
|
+
def singular_str(self):
|
|
1651
|
+
"""
|
|
1652
|
+
Return a SINGULAR representation of ``self``.
|
|
1653
|
+
|
|
1654
|
+
Used to convert polynomial rings to their SINGULAR representation.
|
|
1655
|
+
|
|
1656
|
+
EXAMPLES::
|
|
1657
|
+
|
|
1658
|
+
sage: P = PolynomialRing(GF(127), 10, names='x',
|
|
1659
|
+
....: order='lex(3),deglex(5),lex(2)')
|
|
1660
|
+
sage: T = P.term_order()
|
|
1661
|
+
sage: T.singular_str()
|
|
1662
|
+
'(lp(3),Dp(5),lp(2))'
|
|
1663
|
+
sage: P._singular_() # needs sage.libs.singular
|
|
1664
|
+
polynomial ring, over a field, global ordering
|
|
1665
|
+
// coefficients: ZZ/127...
|
|
1666
|
+
// number of vars : 10
|
|
1667
|
+
// block 1 : ordering lp
|
|
1668
|
+
// : names x0 x1 x2
|
|
1669
|
+
// block 2 : ordering Dp
|
|
1670
|
+
// : names x3 x4 x5 x6 x7
|
|
1671
|
+
// block 3 : ordering lp
|
|
1672
|
+
// : names x8 x9
|
|
1673
|
+
// block 4 : ordering C
|
|
1674
|
+
|
|
1675
|
+
The ``degneglex`` ordering is somehow special, it looks like a block
|
|
1676
|
+
ordering in SINGULAR::
|
|
1677
|
+
|
|
1678
|
+
sage: T = TermOrder("degneglex", 2)
|
|
1679
|
+
sage: P = PolynomialRing(QQ,2, names='x', order=T)
|
|
1680
|
+
sage: T = P.term_order()
|
|
1681
|
+
sage: T.singular_str()
|
|
1682
|
+
'(a(1:2),ls(2))'
|
|
1683
|
+
|
|
1684
|
+
sage: T = TermOrder("degneglex", 2) + TermOrder("degneglex", 2)
|
|
1685
|
+
sage: P = PolynomialRing(QQ,4, names='x', order=T)
|
|
1686
|
+
sage: T = P.term_order()
|
|
1687
|
+
sage: T.singular_str()
|
|
1688
|
+
'(a(1:2),ls(2),a(1:2),ls(2))'
|
|
1689
|
+
sage: P._singular_() # needs sage.libs.singular
|
|
1690
|
+
polynomial ring, over a field, global ordering
|
|
1691
|
+
// coefficients: QQ...
|
|
1692
|
+
// number of vars : 4
|
|
1693
|
+
// block 1 : ordering a
|
|
1694
|
+
// : names x0 x1
|
|
1695
|
+
// : weights 1 1
|
|
1696
|
+
// block 2 : ordering ls
|
|
1697
|
+
// : names x0 x1
|
|
1698
|
+
// block 3 : ordering a
|
|
1699
|
+
// : names x2 x3
|
|
1700
|
+
// : weights 1 1
|
|
1701
|
+
// block 4 : ordering ls
|
|
1702
|
+
// : names x2 x3
|
|
1703
|
+
// block 5 : ordering C
|
|
1704
|
+
|
|
1705
|
+
The position of the ``ordering C`` block can be controlled by setting
|
|
1706
|
+
``_singular_ringorder_column`` attribute to an integer::
|
|
1707
|
+
|
|
1708
|
+
sage: T = TermOrder("degneglex", 2) + TermOrder("degneglex", 2)
|
|
1709
|
+
sage: T._singular_ringorder_column = 0
|
|
1710
|
+
sage: P = PolynomialRing(QQ, 4, names='x', order=T)
|
|
1711
|
+
sage: P._singular_() # needs sage.libs.singular
|
|
1712
|
+
polynomial ring, over a field, global ordering
|
|
1713
|
+
// coefficients: QQ...
|
|
1714
|
+
// number of vars : 4
|
|
1715
|
+
// block 1 : ordering C
|
|
1716
|
+
// block 2 : ordering a
|
|
1717
|
+
// : names x0 x1
|
|
1718
|
+
// : weights 1 1
|
|
1719
|
+
// block 3 : ordering ls
|
|
1720
|
+
// : names x0 x1
|
|
1721
|
+
// block 4 : ordering a
|
|
1722
|
+
// : names x2 x3
|
|
1723
|
+
// : weights 1 1
|
|
1724
|
+
// block 5 : ordering ls
|
|
1725
|
+
// : names x2 x3
|
|
1726
|
+
|
|
1727
|
+
sage: T._singular_ringorder_column = 1
|
|
1728
|
+
sage: P = PolynomialRing(QQ, 4, names='y', order=T)
|
|
1729
|
+
sage: P._singular_() # needs sage.libs.singular
|
|
1730
|
+
polynomial ring, over a field, global ordering
|
|
1731
|
+
// coefficients: QQ...
|
|
1732
|
+
// number of vars : 4
|
|
1733
|
+
// block 1 : ordering c
|
|
1734
|
+
// block 2 : ordering a
|
|
1735
|
+
// : names y0 y1
|
|
1736
|
+
// : weights 1 1
|
|
1737
|
+
// block 3 : ordering ls
|
|
1738
|
+
// : names y0 y1
|
|
1739
|
+
// block 4 : ordering a
|
|
1740
|
+
// : names y2 y3
|
|
1741
|
+
// : weights 1 1
|
|
1742
|
+
// block 5 : ordering ls
|
|
1743
|
+
// : names y2 y3
|
|
1744
|
+
|
|
1745
|
+
sage: T._singular_ringorder_column = 2
|
|
1746
|
+
sage: P = PolynomialRing(QQ, 4, names='z', order=T)
|
|
1747
|
+
sage: P._singular_() # needs sage.libs.singular
|
|
1748
|
+
polynomial ring, over a field, global ordering
|
|
1749
|
+
// coefficients: QQ...
|
|
1750
|
+
// number of vars : 4
|
|
1751
|
+
// block 1 : ordering a
|
|
1752
|
+
// : names z0 z1
|
|
1753
|
+
// : weights 1 1
|
|
1754
|
+
// block 2 : ordering C
|
|
1755
|
+
// block 3 : ordering ls
|
|
1756
|
+
// : names z0 z1
|
|
1757
|
+
// block 4 : ordering a
|
|
1758
|
+
// : names z2 z3
|
|
1759
|
+
// : weights 1 1
|
|
1760
|
+
// block 5 : ordering ls
|
|
1761
|
+
// : names z2 z3
|
|
1762
|
+
"""
|
|
1763
|
+
if self._singular_ringorder_column is not None:
|
|
1764
|
+
singular_str = self._singular_str
|
|
1765
|
+
if singular_str.startswith('('):
|
|
1766
|
+
singular_str = singular_str[1:-1] # remove parenthesis
|
|
1767
|
+
split_pattern = r"([^(),]+(?:\([^()]*\)[^(),]*)*)" # regex to split by outermost commas
|
|
1768
|
+
singular_str_blocks = re.findall(split_pattern, singular_str)
|
|
1769
|
+
if (self._singular_ringorder_column < 0 or
|
|
1770
|
+
self._singular_ringorder_column >= 2*len(singular_str_blocks)+2):
|
|
1771
|
+
singular_str_blocks.append("C")
|
|
1772
|
+
else:
|
|
1773
|
+
singular_str_blocks.insert(self._singular_ringorder_column // 2,
|
|
1774
|
+
"C" if self._singular_ringorder_column % 2 == 0 else "c")
|
|
1775
|
+
return "(" + ",".join(singular_str_blocks) + ")"
|
|
1776
|
+
else:
|
|
1777
|
+
return self._singular_str
|
|
1778
|
+
|
|
1779
|
+
def singular_moreblocks(self):
|
|
1780
|
+
"""
|
|
1781
|
+
Return a the number of additional blocks SINGULAR needs to allocate
|
|
1782
|
+
for handling non-native orderings like ``degneglex``.
|
|
1783
|
+
|
|
1784
|
+
EXAMPLES::
|
|
1785
|
+
|
|
1786
|
+
sage: P = PolynomialRing(GF(127), 10, names='x',
|
|
1787
|
+
....: order='lex(3),deglex(5),lex(2)')
|
|
1788
|
+
sage: T = P.term_order()
|
|
1789
|
+
sage: T.singular_moreblocks()
|
|
1790
|
+
0
|
|
1791
|
+
sage: P = PolynomialRing(GF(127), 10, names='x',
|
|
1792
|
+
....: order='lex(3),degneglex(5),lex(2)')
|
|
1793
|
+
sage: T = P.term_order()
|
|
1794
|
+
sage: T.singular_moreblocks()
|
|
1795
|
+
1
|
|
1796
|
+
sage: P = PolynomialRing(GF(127), 10, names='x',
|
|
1797
|
+
....: order='degneglex(5),degneglex(5)')
|
|
1798
|
+
sage: T = P.term_order()
|
|
1799
|
+
sage: T.singular_moreblocks()
|
|
1800
|
+
2
|
|
1801
|
+
|
|
1802
|
+
TESTS:
|
|
1803
|
+
|
|
1804
|
+
The 'degneglex' ordering is somehow special: SINGULAR handles it
|
|
1805
|
+
using an extra weight vector block. ::
|
|
1806
|
+
|
|
1807
|
+
sage: T = TermOrder("degneglex", 2)
|
|
1808
|
+
sage: P = PolynomialRing(QQ,2, names='x', order=T)
|
|
1809
|
+
sage: T = P.term_order()
|
|
1810
|
+
sage: T.singular_moreblocks()
|
|
1811
|
+
1
|
|
1812
|
+
sage: T = TermOrder("degneglex", 2) + TermOrder("degneglex", 2)
|
|
1813
|
+
sage: P = PolynomialRing(QQ,4, names='x', order=T)
|
|
1814
|
+
sage: T = P.term_order()
|
|
1815
|
+
sage: T.singular_moreblocks()
|
|
1816
|
+
2
|
|
1817
|
+
"""
|
|
1818
|
+
return self._singular_moreblocks
|
|
1819
|
+
|
|
1820
|
+
def macaulay2_str(self):
|
|
1821
|
+
"""
|
|
1822
|
+
Return a Macaulay2 representation of ``self``.
|
|
1823
|
+
|
|
1824
|
+
Used to convert polynomial rings to their Macaulay2
|
|
1825
|
+
representation.
|
|
1826
|
+
|
|
1827
|
+
EXAMPLES::
|
|
1828
|
+
|
|
1829
|
+
sage: P = PolynomialRing(GF(127), 8, names='x', order='degrevlex(3),lex(5)')
|
|
1830
|
+
sage: T = P.term_order()
|
|
1831
|
+
sage: T.macaulay2_str()
|
|
1832
|
+
'{GRevLex => 3,Lex => 5}'
|
|
1833
|
+
sage: P._macaulay2_().options()['MonomialOrder'] # optional - macaulay2
|
|
1834
|
+
{MonomialSize => 16 }
|
|
1835
|
+
{GRevLex => {1, 1, 1}}
|
|
1836
|
+
{Lex => 5 }
|
|
1837
|
+
{Position => Up }
|
|
1838
|
+
"""
|
|
1839
|
+
return self._macaulay2_str
|
|
1840
|
+
|
|
1841
|
+
def magma_str(self):
|
|
1842
|
+
"""
|
|
1843
|
+
Return a MAGMA representation of ``self``.
|
|
1844
|
+
|
|
1845
|
+
Used to convert polynomial rings to their MAGMA representation.
|
|
1846
|
+
|
|
1847
|
+
EXAMPLES::
|
|
1848
|
+
|
|
1849
|
+
sage: P = PolynomialRing(GF(127), 10, names='x', order='degrevlex')
|
|
1850
|
+
sage: magma(P) # optional - magma
|
|
1851
|
+
Polynomial ring of rank 10 over GF(127)
|
|
1852
|
+
Order: Graded Reverse Lexicographical
|
|
1853
|
+
Variables: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9
|
|
1854
|
+
|
|
1855
|
+
::
|
|
1856
|
+
|
|
1857
|
+
sage: T = P.term_order()
|
|
1858
|
+
sage: T.magma_str()
|
|
1859
|
+
'"grevlex"'
|
|
1860
|
+
"""
|
|
1861
|
+
return self._magma_str
|
|
1862
|
+
|
|
1863
|
+
def blocks(self):
|
|
1864
|
+
"""
|
|
1865
|
+
Return the term order blocks of ``self``.
|
|
1866
|
+
|
|
1867
|
+
NOTE:
|
|
1868
|
+
|
|
1869
|
+
This method has been added in :issue:`11316`. There used
|
|
1870
|
+
to be an *attribute* of the same name and the same content.
|
|
1871
|
+
So, it is a backward incompatible syntax change.
|
|
1872
|
+
|
|
1873
|
+
EXAMPLES::
|
|
1874
|
+
|
|
1875
|
+
sage: t = TermOrder('deglex',2) + TermOrder('lex',2)
|
|
1876
|
+
sage: t.blocks()
|
|
1877
|
+
(Degree lexicographic term order, Lexicographic term order)
|
|
1878
|
+
"""
|
|
1879
|
+
if self._blocks: # self is a block order
|
|
1880
|
+
return self._blocks
|
|
1881
|
+
else:
|
|
1882
|
+
return [self]
|
|
1883
|
+
|
|
1884
|
+
def matrix(self):
|
|
1885
|
+
"""
|
|
1886
|
+
Return the matrix defining matrix term order.
|
|
1887
|
+
|
|
1888
|
+
EXAMPLES::
|
|
1889
|
+
|
|
1890
|
+
sage: t = TermOrder("M(1,2,0,1)") # needs sage.modules
|
|
1891
|
+
sage: t.matrix() # needs sage.modules
|
|
1892
|
+
[1 2]
|
|
1893
|
+
[0 1]
|
|
1894
|
+
"""
|
|
1895
|
+
return self._matrix
|
|
1896
|
+
|
|
1897
|
+
def weights(self):
|
|
1898
|
+
"""
|
|
1899
|
+
Return the weights for weighted term orders.
|
|
1900
|
+
|
|
1901
|
+
EXAMPLES::
|
|
1902
|
+
|
|
1903
|
+
sage: t = TermOrder('wdeglex',(2,3))
|
|
1904
|
+
sage: t.weights()
|
|
1905
|
+
(2, 3)
|
|
1906
|
+
"""
|
|
1907
|
+
return self._weights
|
|
1908
|
+
|
|
1909
|
+
def __eq__(self, other):
|
|
1910
|
+
"""
|
|
1911
|
+
Return ``True`` if ``self`` and ``other`` are equal.
|
|
1912
|
+
|
|
1913
|
+
EXAMPLES::
|
|
1914
|
+
|
|
1915
|
+
sage: TermOrder('lex') == TermOrder('lex',3)
|
|
1916
|
+
True
|
|
1917
|
+
|
|
1918
|
+
::
|
|
1919
|
+
|
|
1920
|
+
sage: TermOrder('degrevlex') == TermOrder('lex')
|
|
1921
|
+
False
|
|
1922
|
+
|
|
1923
|
+
::
|
|
1924
|
+
|
|
1925
|
+
sage: T1 = TermOrder('lex',2) + TermOrder('lex',3)
|
|
1926
|
+
sage: T2 = TermOrder('lex',3) + TermOrder('lex',2)
|
|
1927
|
+
sage: T1 == T2
|
|
1928
|
+
False
|
|
1929
|
+
|
|
1930
|
+
::
|
|
1931
|
+
|
|
1932
|
+
sage: T1 = TermOrder('lex',2) + TermOrder('neglex',3)
|
|
1933
|
+
sage: T2 = TermOrder('lex',2) + TermOrder('neglex',3)
|
|
1934
|
+
sage: T1 == T2
|
|
1935
|
+
True
|
|
1936
|
+
|
|
1937
|
+
TESTS:
|
|
1938
|
+
|
|
1939
|
+
We assert that comparisons take into account the block size of
|
|
1940
|
+
orderings (cf. :issue:`24981`)::
|
|
1941
|
+
|
|
1942
|
+
sage: R = PolynomialRing(QQ, 6, 'x', order="lex(1),degrevlex(5)")
|
|
1943
|
+
sage: S = R.change_ring(order="lex(2),degrevlex(4)")
|
|
1944
|
+
sage: R == S
|
|
1945
|
+
False
|
|
1946
|
+
sage: S.term_order() == R.term_order()
|
|
1947
|
+
False
|
|
1948
|
+
sage: S.term_order() == TermOrder('lex', 2) + TermOrder('degrevlex', 4)
|
|
1949
|
+
True
|
|
1950
|
+
"""
|
|
1951
|
+
if not isinstance(other, TermOrder):
|
|
1952
|
+
try:
|
|
1953
|
+
other = TermOrder(other, force=True)
|
|
1954
|
+
except Exception:
|
|
1955
|
+
return False
|
|
1956
|
+
|
|
1957
|
+
return (self._name == other._name
|
|
1958
|
+
and self._blocks == other._blocks
|
|
1959
|
+
and (not self.is_block_order()
|
|
1960
|
+
or all(len(t1) == len(t2) for (t1, t2) in zip(self._blocks, other._blocks)))
|
|
1961
|
+
and self._weights == other._weights
|
|
1962
|
+
and self._matrix == other._matrix
|
|
1963
|
+
and self._singular_ringorder_column == other._singular_ringorder_column)
|
|
1964
|
+
|
|
1965
|
+
def __ne__(self, other):
|
|
1966
|
+
"""
|
|
1967
|
+
Return ``True`` if ``self`` and ``other`` are not equal.
|
|
1968
|
+
|
|
1969
|
+
EXAMPLES::
|
|
1970
|
+
|
|
1971
|
+
sage: T1 = TermOrder('lex',2) + TermOrder('lex',3)
|
|
1972
|
+
sage: T2 = TermOrder('lex',3) + TermOrder('lex',2)
|
|
1973
|
+
sage: T1 != T2
|
|
1974
|
+
True
|
|
1975
|
+
"""
|
|
1976
|
+
return not self == other
|
|
1977
|
+
|
|
1978
|
+
def __add__(self, other):
|
|
1979
|
+
"""
|
|
1980
|
+
Construct a block order combining ``self`` and ``other``.
|
|
1981
|
+
|
|
1982
|
+
INPUT:
|
|
1983
|
+
|
|
1984
|
+
- ``other`` -- a term order
|
|
1985
|
+
|
|
1986
|
+
OUTPUT: a block order
|
|
1987
|
+
|
|
1988
|
+
EXAMPLES::
|
|
1989
|
+
|
|
1990
|
+
sage: from sage.rings.polynomial.term_order import TermOrder
|
|
1991
|
+
sage: TermOrder('deglex',2) + TermOrder('degrevlex(3),neglex(3)')
|
|
1992
|
+
Block term order with blocks:
|
|
1993
|
+
(Degree lexicographic term order of length 2,
|
|
1994
|
+
Degree reverse lexicographic term order of length 3,
|
|
1995
|
+
Negative lexicographic term order of length 3)
|
|
1996
|
+
"""
|
|
1997
|
+
if isinstance(other, TermOrder):
|
|
1998
|
+
return TermOrder('block',[self,other])
|
|
1999
|
+
else:
|
|
2000
|
+
return self
|
|
2001
|
+
|
|
2002
|
+
def __len__(self):
|
|
2003
|
+
"""
|
|
2004
|
+
Return the length of this term order, i.e. the number of
|
|
2005
|
+
variables it covers. This may be zero for indefinitely many
|
|
2006
|
+
variables.
|
|
2007
|
+
|
|
2008
|
+
EXAMPLES::
|
|
2009
|
+
|
|
2010
|
+
sage: T = TermOrder('lex')
|
|
2011
|
+
sage: len(T)
|
|
2012
|
+
0
|
|
2013
|
+
sage: T = TermOrder('lex', 2) + TermOrder('degrevlex', 3)
|
|
2014
|
+
sage: len(T)
|
|
2015
|
+
5
|
|
2016
|
+
"""
|
|
2017
|
+
return self._length
|
|
2018
|
+
|
|
2019
|
+
def __getitem__(self, i):
|
|
2020
|
+
r"""
|
|
2021
|
+
Return the `i`-th block of this term order.
|
|
2022
|
+
|
|
2023
|
+
INPUT:
|
|
2024
|
+
|
|
2025
|
+
- ``i`` -- index
|
|
2026
|
+
|
|
2027
|
+
EXAMPLES::
|
|
2028
|
+
|
|
2029
|
+
sage: T = TermOrder('lex')
|
|
2030
|
+
sage: T[0]
|
|
2031
|
+
Lexicographic term order
|
|
2032
|
+
|
|
2033
|
+
::
|
|
2034
|
+
|
|
2035
|
+
sage: T = TermOrder('lex', 2) + TermOrder('degrevlex', 3)
|
|
2036
|
+
sage: T[1]
|
|
2037
|
+
Degree reverse lexicographic term order
|
|
2038
|
+
|
|
2039
|
+
Note that ``len(self)`` does not count blocks but
|
|
2040
|
+
variables.
|
|
2041
|
+
|
|
2042
|
+
::
|
|
2043
|
+
|
|
2044
|
+
sage: T = TermOrder('lex', 2) + TermOrder('degrevlex', 3)
|
|
2045
|
+
sage: T[len(T)-1]
|
|
2046
|
+
Traceback (most recent call last):
|
|
2047
|
+
\dots
|
|
2048
|
+
IndexError: tuple index out of range
|
|
2049
|
+
"""
|
|
2050
|
+
return self.blocks()[i]
|
|
2051
|
+
|
|
2052
|
+
def __iter__(self):
|
|
2053
|
+
r"""
|
|
2054
|
+
Iterate over the blocks of this term order.
|
|
2055
|
+
|
|
2056
|
+
EXAMPLES::
|
|
2057
|
+
|
|
2058
|
+
sage: T = TermOrder('lex')
|
|
2059
|
+
sage: list(T) # indirect doctest
|
|
2060
|
+
[Lexicographic term order]
|
|
2061
|
+
|
|
2062
|
+
::
|
|
2063
|
+
|
|
2064
|
+
sage: T = TermOrder('lex', 2) + TermOrder('degrevlex', 3)
|
|
2065
|
+
sage: list(T)
|
|
2066
|
+
[Lexicographic term order, Degree reverse lexicographic term order]
|
|
2067
|
+
|
|
2068
|
+
Note that ``len(self)`` and
|
|
2069
|
+
``len(list(self))`` are not the same. The former counts
|
|
2070
|
+
the number of variables in ``self`` while the latter
|
|
2071
|
+
counts the number of blocks.
|
|
2072
|
+
"""
|
|
2073
|
+
return iter(self.blocks())
|
|
2074
|
+
|
|
2075
|
+
def is_global(self):
|
|
2076
|
+
r"""
|
|
2077
|
+
Return ``True`` if this term order is definitely
|
|
2078
|
+
global. Return false otherwise, which includes
|
|
2079
|
+
unknown term orders.
|
|
2080
|
+
|
|
2081
|
+
EXAMPLES::
|
|
2082
|
+
|
|
2083
|
+
sage: T = TermOrder('lex')
|
|
2084
|
+
sage: T.is_global()
|
|
2085
|
+
True
|
|
2086
|
+
sage: T = TermOrder('degrevlex', 3) + TermOrder('degrevlex', 3)
|
|
2087
|
+
sage: T.is_global()
|
|
2088
|
+
True
|
|
2089
|
+
sage: T = TermOrder('degrevlex', 3) + TermOrder('negdegrevlex', 3)
|
|
2090
|
+
sage: T.is_global()
|
|
2091
|
+
False
|
|
2092
|
+
sage: T = TermOrder('degneglex', 3)
|
|
2093
|
+
sage: T.is_global()
|
|
2094
|
+
True
|
|
2095
|
+
sage: T = TermOrder('invlex', 3)
|
|
2096
|
+
sage: T.is_global()
|
|
2097
|
+
True
|
|
2098
|
+
"""
|
|
2099
|
+
if self.name() in ('lex', 'degrevlex', 'deglex', 'degneglex',
|
|
2100
|
+
'wdegrevlex', 'wdeglex', 'invlex'):
|
|
2101
|
+
return True
|
|
2102
|
+
elif self.name() == 'block':
|
|
2103
|
+
return all(t.is_global() for t in self.blocks())
|
|
2104
|
+
else:
|
|
2105
|
+
return False
|
|
2106
|
+
|
|
2107
|
+
def is_local(self):
|
|
2108
|
+
r"""
|
|
2109
|
+
Return ``True`` if this term order is definitely
|
|
2110
|
+
local. Return false otherwise, which includes
|
|
2111
|
+
unknown term orders.
|
|
2112
|
+
|
|
2113
|
+
EXAMPLES::
|
|
2114
|
+
|
|
2115
|
+
sage: T = TermOrder('lex')
|
|
2116
|
+
sage: T.is_local()
|
|
2117
|
+
False
|
|
2118
|
+
sage: T = TermOrder('negdeglex', 3) + TermOrder('negdegrevlex', 3)
|
|
2119
|
+
sage: T.is_local()
|
|
2120
|
+
True
|
|
2121
|
+
sage: T = TermOrder('degrevlex', 3) + TermOrder('negdegrevlex', 3)
|
|
2122
|
+
sage: T.is_local()
|
|
2123
|
+
False
|
|
2124
|
+
"""
|
|
2125
|
+
if (self.name() in ('neglex', 'negdegrevlex', 'negdeglex',
|
|
2126
|
+
'negwdegrevlex', 'negwdeglex') or
|
|
2127
|
+
self.singular_str() in ('ls', 'ds', 'Ds', 'ws', 'Ws')):
|
|
2128
|
+
return True
|
|
2129
|
+
elif self.name() == 'block':
|
|
2130
|
+
return all(t.is_local() for t in self.blocks())
|
|
2131
|
+
else:
|
|
2132
|
+
return False
|
|
2133
|
+
|
|
2134
|
+
def is_block_order(self):
|
|
2135
|
+
"""
|
|
2136
|
+
Return ``True`` if ``self`` is a block term order.
|
|
2137
|
+
|
|
2138
|
+
EXAMPLES::
|
|
2139
|
+
|
|
2140
|
+
sage: t = TermOrder('deglex',2) + TermOrder('lex',2)
|
|
2141
|
+
sage: t.is_block_order()
|
|
2142
|
+
True
|
|
2143
|
+
"""
|
|
2144
|
+
return self._name == 'block'
|
|
2145
|
+
|
|
2146
|
+
def is_weighted_degree_order(self):
|
|
2147
|
+
"""
|
|
2148
|
+
Return ``True`` if ``self`` is a weighted degree term order.
|
|
2149
|
+
|
|
2150
|
+
EXAMPLES::
|
|
2151
|
+
|
|
2152
|
+
sage: t = TermOrder('wdeglex',(2,3))
|
|
2153
|
+
sage: t.is_weighted_degree_order()
|
|
2154
|
+
True
|
|
2155
|
+
"""
|
|
2156
|
+
return self._weights is not None
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
def termorder_from_singular(S):
|
|
2160
|
+
"""
|
|
2161
|
+
Return the Sage term order of the basering in the given Singular interface.
|
|
2162
|
+
|
|
2163
|
+
INPUT:
|
|
2164
|
+
|
|
2165
|
+
An instance of the Singular interface.
|
|
2166
|
+
|
|
2167
|
+
EXAMPLES::
|
|
2168
|
+
|
|
2169
|
+
sage: from sage.rings.polynomial.term_order import termorder_from_singular
|
|
2170
|
+
sage: singular.eval('ring r1 = (9,x),(a,b,c,d,e,f),(M((1,2,3,0)),wp(2,3),lp)') # needs sage.libs.singular
|
|
2171
|
+
''
|
|
2172
|
+
sage: termorder_from_singular(singular) # needs sage.libs.singular
|
|
2173
|
+
Block term order with blocks:
|
|
2174
|
+
(Matrix term order with matrix
|
|
2175
|
+
[1 2]
|
|
2176
|
+
[3 0],
|
|
2177
|
+
Weighted degree reverse lexicographic term order with weights (2, 3),
|
|
2178
|
+
Lexicographic term order of length 2)
|
|
2179
|
+
|
|
2180
|
+
A term order in Singular also involves information on orders for modules.
|
|
2181
|
+
This information is reflected in ``_singular_ringorder_column`` attribute of
|
|
2182
|
+
the term order. ::
|
|
2183
|
+
|
|
2184
|
+
sage: # needs sage.libs.singular
|
|
2185
|
+
sage: singular.ring(0, '(x,y,z,w)', '(C,dp(2),lp(2))')
|
|
2186
|
+
polynomial ring, over a field, global ordering
|
|
2187
|
+
// coefficients: QQ...
|
|
2188
|
+
// number of vars : 4
|
|
2189
|
+
// block 1 : ordering C
|
|
2190
|
+
// block 2 : ordering dp
|
|
2191
|
+
// : names x y
|
|
2192
|
+
// block 3 : ordering lp
|
|
2193
|
+
// : names z w
|
|
2194
|
+
sage: T = termorder_from_singular(singular)
|
|
2195
|
+
sage: T
|
|
2196
|
+
Block term order with blocks:
|
|
2197
|
+
(Degree reverse lexicographic term order of length 2,
|
|
2198
|
+
Lexicographic term order of length 2)
|
|
2199
|
+
sage: T._singular_ringorder_column
|
|
2200
|
+
0
|
|
2201
|
+
|
|
2202
|
+
sage: # needs sage.libs.singular
|
|
2203
|
+
sage: singular.ring(0, '(x,y,z,w)', '(c,dp(2),lp(2))')
|
|
2204
|
+
polynomial ring, over a field, global ordering
|
|
2205
|
+
// coefficients: QQ...
|
|
2206
|
+
// number of vars : 4
|
|
2207
|
+
// block 1 : ordering c
|
|
2208
|
+
// block 2 : ordering dp
|
|
2209
|
+
// : names x y
|
|
2210
|
+
// block 3 : ordering lp
|
|
2211
|
+
// : names z w
|
|
2212
|
+
sage: T = termorder_from_singular(singular)
|
|
2213
|
+
sage: T
|
|
2214
|
+
Block term order with blocks:
|
|
2215
|
+
(Degree reverse lexicographic term order of length 2,
|
|
2216
|
+
Lexicographic term order of length 2)
|
|
2217
|
+
sage: T._singular_ringorder_column
|
|
2218
|
+
1
|
|
2219
|
+
|
|
2220
|
+
TESTS:
|
|
2221
|
+
|
|
2222
|
+
Check that ``degneglex`` term orders are converted correctly
|
|
2223
|
+
(:issue:`29635`)::
|
|
2224
|
+
|
|
2225
|
+
sage: # needs sage.libs.singular
|
|
2226
|
+
sage: _ = singular.ring(0, '(x,y,z,w)', '(a(1:4),ls(4))')
|
|
2227
|
+
sage: termorder_from_singular(singular).singular_str()
|
|
2228
|
+
'(a(1:4),ls(4))'
|
|
2229
|
+
sage: _ = singular.ring(0, '(x,y,z,w)', '(a(1:2),ls(2),a(1:2),ls(2))')
|
|
2230
|
+
sage: termorder_from_singular(singular).singular_str()
|
|
2231
|
+
'(a(1:2),ls(2),a(1:2),ls(2))'
|
|
2232
|
+
sage: _ = singular.ring(0, '(x,y,z,w)', '(a(1:2),ls(2),C,a(1:2),ls(2))')
|
|
2233
|
+
sage: termorder_from_singular(singular).singular_str()
|
|
2234
|
+
'(a(1:2),ls(2),C,a(1:2),ls(2))'
|
|
2235
|
+
sage: PolynomialRing(QQ, 'x,y', order='degneglex')('x^2')._singular_().sage()
|
|
2236
|
+
x^2
|
|
2237
|
+
"""
|
|
2238
|
+
from sage.rings.integer_ring import ZZ
|
|
2239
|
+
singular = S
|
|
2240
|
+
T = singular('ringlist(basering)[3]')
|
|
2241
|
+
order = []
|
|
2242
|
+
ringorder_column = None
|
|
2243
|
+
weights_one_block = False
|
|
2244
|
+
for idx, block in enumerate(T):
|
|
2245
|
+
blocktype = singular.eval('%s[1]' % block.name())
|
|
2246
|
+
if blocktype in ['a']:
|
|
2247
|
+
weights = list(block[2].sage())
|
|
2248
|
+
weights_one_block = all(w == 1 for w in weights)
|
|
2249
|
+
continue
|
|
2250
|
+
elif blocktype == 'c':
|
|
2251
|
+
ringorder_column = 2*idx + 1
|
|
2252
|
+
elif blocktype == 'C':
|
|
2253
|
+
if idx < len(T) - 1: # skip Singular default
|
|
2254
|
+
ringorder_column = 2*idx
|
|
2255
|
+
elif blocktype == 'M':
|
|
2256
|
+
from sage.matrix.constructor import matrix
|
|
2257
|
+
coefs = list(block[2].sage())
|
|
2258
|
+
n = ZZ(len(coefs)).sqrt()
|
|
2259
|
+
order.append(TermOrder(matrix(n,coefs)))
|
|
2260
|
+
elif weights_one_block and blocktype == 'ls':
|
|
2261
|
+
# 'degneglex' is encoded as '(a(1:n),ls(n))'
|
|
2262
|
+
n = ZZ(singular.eval("size(%s[2])" % block.name()))
|
|
2263
|
+
order.append(TermOrder('degneglex', n))
|
|
2264
|
+
elif blocktype[0] in ['w','W']:
|
|
2265
|
+
order.append(TermOrder(inv_singular_name_mapping[blocktype], list(block[2].sage())))
|
|
2266
|
+
else:
|
|
2267
|
+
order.append(TermOrder(inv_singular_name_mapping[blocktype], ZZ(singular.eval("size(%s[2])" % block.name()))))
|
|
2268
|
+
weights_one_block = False
|
|
2269
|
+
|
|
2270
|
+
if not order:
|
|
2271
|
+
raise ValueError("invalid term order in Singular")
|
|
2272
|
+
out = order.pop(0)
|
|
2273
|
+
while order:
|
|
2274
|
+
out = out + order.pop(0)
|
|
2275
|
+
|
|
2276
|
+
if ringorder_column is not None:
|
|
2277
|
+
out._singular_ringorder_column = ringorder_column
|
|
2278
|
+
|
|
2279
|
+
return out
|