From bdf2f331e31f0583a247409ef4b47beeb2b4cef7 Mon Sep 17 00:00:00 2001 From: Alex Chandler Date: Sun, 29 Jan 2023 10:46:39 -0800 Subject: [PATCH 1/7] sage -fiximports src/sage/algebras src/sage/combinat src/sage/matroids --- .../algebras/affine_nil_temperley_lieb.py | 2 +- src/sage/algebras/cluster_algebra.py | 2 +- src/sage/algebras/free_algebra.py | 4 +- src/sage/algebras/free_algebra_quotient.py | 2 +- src/sage/algebras/group_algebra.py | 4 +- .../hecke_algebras/ariki_koike_algebra.py | 2 +- src/sage/algebras/iwahori_hecke_algebra.py | 6 +- src/sage/algebras/lie_algebras/bch.py | 2 +- .../algebras/lie_algebras/free_lie_algebra.py | 2 +- .../lie_conformal_algebra_element.py | 2 +- ..._conformal_algebra_with_structure_coefs.py | 2 +- .../algebras/quatalg/quaternion_algebra.py | 11 +- src/sage/algebras/schur_algebra.py | 2 +- src/sage/algebras/shuffle_algebra.py | 2 +- .../algebras/steenrod/steenrod_algebra.py | 6 +- .../steenrod/steenrod_algebra_mult.py | 5 +- src/sage/combinat/affine_permutation.py | 2 +- src/sage/combinat/alternating_sign_matrix.py | 2 +- src/sage/combinat/baxter_permutations.py | 2 +- .../combinat/binary_recurrence_sequences.py | 6 +- src/sage/combinat/blob_algebra.py | 2 +- .../cluster_algebra_quiver/cluster_seed.py | 8 +- .../combinat/cluster_algebra_quiver/quiver.py | 4 +- .../quiver_mutation_type.py | 3 +- src/sage/combinat/combinat.py | 3 +- src/sage/combinat/combination.py | 2 +- src/sage/combinat/composition_signed.py | 2 +- src/sage/combinat/crystals/alcove_path.py | 2 +- .../combinat/cyclic_sieving_phenomenon.py | 2 +- src/sage/combinat/decorated_permutation.py | 2 +- src/sage/combinat/descent_algebra.py | 2 +- src/sage/combinat/designs/bibd.py | 3 +- src/sage/combinat/designs/block_design.py | 4 +- src/sage/combinat/designs/covering_design.py | 2 +- .../combinat/designs/difference_family.py | 152 +++++++++--------- .../combinat/designs/difference_matrices.py | 3 +- .../designs/group_divisible_designs.py | 2 +- .../combinat/designs/incidence_structures.py | 2 +- .../orthogonal_arrays_build_recursive.py | 8 +- .../orthogonal_arrays_find_recursive.pyx | 2 +- src/sage/combinat/designs/resolvable_bibd.py | 2 +- src/sage/combinat/dyck_word.py | 6 +- src/sage/combinat/free_module.py | 5 +- src/sage/combinat/fully_packed_loop.py | 2 +- src/sage/combinat/integer_vector.py | 2 +- src/sage/combinat/integer_vector_weighted.py | 3 +- src/sage/combinat/interval_posets.py | 4 +- src/sage/combinat/matrices/hadamard_matrix.py | 26 +-- src/sage/combinat/matrices/latin.py | 2 +- .../multiset_partition_into_sets_ordered.py | 2 +- .../combinat/ncsf_qsym/generic_basis_code.py | 2 +- src/sage/combinat/ncsf_qsym/ncsf.py | 4 +- src/sage/combinat/ncsf_qsym/qsym.py | 2 +- src/sage/combinat/ncsym/bases.py | 4 +- src/sage/combinat/necklace.py | 5 +- src/sage/combinat/partition.py | 5 +- src/sage/combinat/partition_algebra.py | 3 +- src/sage/combinat/path_tableaux/frieze.py | 2 +- src/sage/combinat/permutation.py | 3 +- src/sage/combinat/posets/hasse_diagram.py | 2 +- src/sage/combinat/posets/posets.py | 2 +- .../rigged_configurations/kleber_tree.py | 2 +- .../combinat/root_system/cartan_matrix.py | 2 +- src/sage/combinat/root_system/coxeter_type.py | 2 +- .../root_system/reflection_group_complex.py | 5 +- .../root_system/reflection_group_element.pyx | 3 +- .../combinat/root_system/weyl_characters.py | 3 +- src/sage/combinat/root_system/weyl_group.py | 4 +- src/sage/combinat/schubert_polynomial.py | 2 +- src/sage/combinat/set_partition_ordered.py | 3 +- src/sage/combinat/sf/character.py | 4 +- src/sage/combinat/sf/elementary.py | 3 +- src/sage/combinat/sf/homogeneous.py | 3 +- src/sage/combinat/sf/jack.py | 3 +- src/sage/combinat/sf/k_dual.py | 2 +- src/sage/combinat/sf/macdonald.py | 2 +- src/sage/combinat/sf/powersum.py | 2 +- src/sage/combinat/sf/sfa.py | 8 +- src/sage/combinat/sf/witt.py | 4 +- src/sage/combinat/similarity_class_type.py | 3 +- src/sage/combinat/skew_tableau.py | 4 +- src/sage/combinat/species/cycle_species.py | 3 +- .../combinat/species/generating_series.py | 2 +- src/sage/combinat/subset.py | 4 +- src/sage/combinat/symmetric_group_algebra.py | 2 +- src/sage/combinat/t_sequences.py | 116 ++++++------- src/sage/combinat/tableau.py | 3 +- src/sage/combinat/tableau_tuple.py | 2 +- src/sage/combinat/tamari_lattices.py | 2 +- src/sage/combinat/words/lyndon_word.py | 5 +- src/sage/combinat/words/morphism.py | 2 +- src/sage/combinat/words/paths.py | 2 +- src/sage/combinat/words/shuffle_product.py | 2 +- src/sage/combinat/words/word_generators.py | 2 +- src/sage/matroids/basis_matroid.pyx | 2 +- src/sage/matroids/constructor.py | 3 +- src/sage/matroids/extension.pyx | 2 +- src/sage/matroids/lean_matrix.pyx | 5 +- src/sage/matroids/linear_matroid.pyx | 5 +- 99 files changed, 328 insertions(+), 266 deletions(-) diff --git a/src/sage/algebras/affine_nil_temperley_lieb.py b/src/sage/algebras/affine_nil_temperley_lieb.py index 8aff4321abb..f7901ae314d 100644 --- a/src/sage/algebras/affine_nil_temperley_lieb.py +++ b/src/sage/algebras/affine_nil_temperley_lieb.py @@ -7,7 +7,7 @@ # Distributed under the terms of the GNU General Public License (GPL) # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.categories.all import AlgebrasWithBasis +from sage.categories.algebras_with_basis import AlgebrasWithBasis from sage.combinat.root_system.cartan_type import CartanType from sage.combinat.root_system.weyl_group import WeylGroup from sage.rings.ring import Ring diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index 81615828b56..f3e88d96298 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -354,7 +354,7 @@ from copy import copy -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.categories.homset import Hom from sage.categories.morphism import SetMorphism from sage.categories.rings import Rings diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 7286f62ce27..3004878a378 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -149,7 +149,7 @@ from sage.structure.factory import UniqueFactory from sage.misc.cachefunc import cached_method -from sage.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.ring import Algebra from sage.categories.algebras_with_basis import AlgebrasWithBasis from sage.combinat.free_module import CombinatorialFreeModule @@ -282,7 +282,7 @@ def create_key(self, base_ring, arg1=None, arg2=None, PolRing = PolynomialRing(base_ring, *args, **kwds) if degrees is None: return (PolRing,) - from sage.all import TermOrder + from sage.rings.polynomial.term_order import TermOrder T = TermOrder(PolRing.term_order(), PolRing.ngens() + 1) varnames = list(PolRing.variable_names()) newname = 'x' diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index 583eb5f9ae8..b3090baa029 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -357,7 +357,7 @@ def hamilton_quatalg(R): """ n = 3 from sage.algebras.free_algebra import FreeAlgebra - from sage.matrix.all import MatrixSpace + from sage.matrix.matrix_space import MatrixSpace A = FreeAlgebra(R, n, 'i') F = A.monoid() i, j, k = F.gens() diff --git a/src/sage/algebras/group_algebra.py b/src/sage/algebras/group_algebra.py index 6821a64f68f..c639106b239 100644 --- a/src/sage/algebras/group_algebra.py +++ b/src/sage/algebras/group_algebra.py @@ -35,8 +35,8 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.rings.all import IntegerRing -from sage.categories.all import Rings +from sage.rings.integer_ring import IntegerRing +from sage.categories.rings import Rings from sage.categories.magmas import Magmas from sage.categories.additive_magmas import AdditiveMagmas from sage.categories.sets_cat import Sets diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index c1596761c99..5f21e1049b0 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -540,7 +540,7 @@ def dimension(self): sage: LT.dimension() 29160 """ - from sage.arith.all import factorial + from sage.arith.misc import factorial return self._r**self._n * factorial(self._n) def some_elements(self): diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 900039c7909..a9935dd36e2 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -30,10 +30,12 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.categories.realizations import Realizations, Category_realization_of_parent -from sage.categories.all import AlgebrasWithBasis, FiniteDimensionalAlgebrasWithBasis, CoxeterGroups +from sage.categories.algebras_with_basis import AlgebrasWithBasis +from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis +from sage.categories.coxeter_groups import CoxeterGroups from sage.rings.integer_ring import ZZ from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing -from sage.arith.all import is_square +from sage.arith.misc import is_square from sage.combinat.root_system.coxeter_group import CoxeterGroup from sage.sets.family import Family from sage.combinat.free_module import CombinatorialFreeModule diff --git a/src/sage/algebras/lie_algebras/bch.py b/src/sage/algebras/lie_algebras/bch.py index 1cb3f0442cb..657b8c194a1 100644 --- a/src/sage/algebras/lie_algebras/bch.py +++ b/src/sage/algebras/lie_algebras/bch.py @@ -20,7 +20,7 @@ from sage.arith.misc import bernoulli from sage.categories.lie_algebras import LieAlgebras from sage.combinat.integer_vector import IntegerListsLex -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.rings.rational_field import QQ from sage.structure.element import canonical_coercion diff --git a/src/sage/algebras/lie_algebras/free_lie_algebra.py b/src/sage/algebras/lie_algebras/free_lie_algebra.py index 8a02e5265c6..79df5a5d90b 100644 --- a/src/sage/algebras/lie_algebras/free_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/free_lie_algebra.py @@ -265,7 +265,7 @@ def graded_dimension(self, k): """ if k == 0: return 0 - from sage.arith.all import moebius + from sage.arith.misc import moebius s = len(self.lie_algebra_generators()) k = ZZ(k) # Make sure we have something that is in ZZ return sum(moebius(d) * s**(k // d) for d in k.divisors()) // k diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py index c40e654e157..d10426501f2 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py @@ -14,7 +14,7 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.misc.misc_c import prod from sage.misc.repr import repr_lincomb from sage.misc.latex import latex diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py index b2cf3582793..46119ad45f1 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py @@ -17,7 +17,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.sets.family import Family from .lie_conformal_algebra_element import LCAStructureCoefficientsElement from sage.categories.lie_conformal_algebras import LieConformalAlgebras diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 45a4d512c0a..0e4b1e979a8 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -35,9 +35,14 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.all import (hilbert_conductor_inverse, hilbert_conductor, - factor, gcd, kronecker_symbol, valuation) -from sage.rings.all import RR, Integer +from sage.arith.misc import hilbert_conductor_inverse +from sage.arith.misc import hilbert_conductor +from sage.arith.misc import factor +from sage.arith.misc import GCD as gcd +from sage.arith.misc import kronecker as kronecker_symbol +from sage.arith.misc import valuation +from sage.rings.real_mpfr import RR +from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.rational import Rational from sage.rings.finite_rings.finite_field_constructor import GF diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index b716db0ce94..ff960e56dd9 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -41,7 +41,7 @@ from sage.combinat.sf.sf import SymmetricFunctions from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra from sage.combinat.tableau import SemistandardTableaux -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.matrix.constructor import Matrix from sage.misc.cachefunc import cached_method from sage.misc.flatten import flatten diff --git a/src/sage/algebras/shuffle_algebra.py b/src/sage/algebras/shuffle_algebra.py index 26c8a40f485..5d383f8dfab 100644 --- a/src/sage/algebras/shuffle_algebra.py +++ b/src/sage/algebras/shuffle_algebra.py @@ -972,7 +972,7 @@ def expansion_on_basis(self, w): sage: S.expansion_on_basis(Word('abab')) 2*B[aabb] + B[abab] """ - from sage.arith.all import factorial + from sage.arith.misc import factorial if not w: return self._alg.one() if len(w) == 1: diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index 49b281d9a49..978a3557a9d 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -455,7 +455,9 @@ from sage.combinat.free_module import CombinatorialFreeModule from sage.misc.lazy_attribute import lazy_attribute from sage.misc.cachefunc import cached_method -from sage.categories.all import ModulesWithBasis, tensor, Hom +from sage.categories.modules_with_basis import ModulesWithBasis +from sage.categories.tensor import tensor +from sage.categories.homset import Hom ###################################################### # the main class @@ -584,7 +586,7 @@ def __init__(self, p=2, basis='milnor', **kwds): sage: A1 == SteenrodAlgebra(2, profile=[2,1], basis='pst') False """ - from sage.arith.all import is_prime + from sage.arith.misc import is_prime from sage.categories.super_hopf_algebras_with_basis import SuperHopfAlgebrasWithBasis from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets diff --git a/src/sage/algebras/steenrod/steenrod_algebra_mult.py b/src/sage/algebras/steenrod/steenrod_algebra_mult.py index ec92c86fcc5..1fb52aba028 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_mult.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_mult.py @@ -611,8 +611,9 @@ def multinomial_odd(list,p): sage: multinomial_odd([1,2,4], 107) 105 """ - from sage.rings.all import GF, Integer - from sage.arith.all import binomial + from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF + from sage.rings.integer import Integer + from sage.arith.misc import binomial n = sum(list) answer = 1 F = GF(p) diff --git a/src/sage/combinat/affine_permutation.py b/src/sage/combinat/affine_permutation.py index 9ee4e166abe..22bb6a4e421 100644 --- a/src/sage/combinat/affine_permutation.py +++ b/src/sage/combinat/affine_permutation.py @@ -23,7 +23,7 @@ from sage.rings.integer_ring import ZZ from sage.groups.perm_gps.permgroup_named import SymmetricGroup -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.combinat.root_system.cartan_type import CartanType from sage.combinat.root_system.weyl_group import WeylGroup from sage.combinat.composition import Composition diff --git a/src/sage/combinat/alternating_sign_matrix.py b/src/sage/combinat/alternating_sign_matrix.py index c7c7317811c..e9eb810cd6d 100644 --- a/src/sage/combinat/alternating_sign_matrix.py +++ b/src/sage/combinat/alternating_sign_matrix.py @@ -46,7 +46,7 @@ from sage.modules.free_module_element import zero_vector from sage.misc.cachefunc import cached_method from sage.rings.integer_ring import ZZ -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.rings.integer import Integer from sage.combinat.posets.lattices import LatticePoset from sage.combinat.gelfand_tsetlin_patterns import GelfandTsetlinPatternsTopRow diff --git a/src/sage/combinat/baxter_permutations.py b/src/sage/combinat/baxter_permutations.py index 382e4abcdab..ddf46c37457 100644 --- a/src/sage/combinat/baxter_permutations.py +++ b/src/sage/combinat/baxter_permutations.py @@ -231,7 +231,7 @@ def cardinality(self): """ if self._n == 0: return 1 - from sage.arith.all import binomial + from sage.arith.misc import binomial return sum((binomial(self._n + 1, k) * binomial(self._n + 1, k + 1) * binomial(self._n + 1, k + 2)) // diff --git a/src/sage/combinat/binary_recurrence_sequences.py b/src/sage/combinat/binary_recurrence_sequences.py index 4dd28d897fe..ecfcc2ccd4e 100644 --- a/src/sage/combinat/binary_recurrence_sequences.py +++ b/src/sage/combinat/binary_recurrence_sequences.py @@ -65,7 +65,11 @@ from sage.rings.finite_rings.integer_mod_ring import Integers from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.integer import Integer -from sage.arith.all import lcm, next_prime, is_prime, next_prime_power, legendre_symbol +from sage.arith.functions import lcm +from sage.arith.misc import next_prime +from sage.arith.misc import is_prime +from sage.arith.misc import next_prime_power +from sage.arith.misc import legendre_symbol from sage.functions.log import log from sage.misc.functional import sqrt diff --git a/src/sage/combinat/blob_algebra.py b/src/sage/combinat/blob_algebra.py index 5da88de497f..992cb461b63 100644 --- a/src/sage/combinat/blob_algebra.py +++ b/src/sage/combinat/blob_algebra.py @@ -24,7 +24,7 @@ #from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.misc.cachefunc import cached_method from sage.misc.misc import powerset -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.algebras import Algebras from sage.combinat.diagram_algebras import (TemperleyLiebDiagrams, diagram_latex, diff --git a/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py b/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py index d7c4d849e0c..246768ef1d7 100644 --- a/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py +++ b/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py @@ -43,13 +43,13 @@ from sage.rings.fraction_field import FractionField from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.fraction_field_element import FractionFieldElement -from sage.sets.all import Set +from sage.sets.set import Set from sage.graphs.digraph import DiGraph from sage.combinat.cluster_algebra_quiver.quiver_mutation_type import QuiverMutationType_Irreducible, QuiverMutationType_Reducible from sage.combinat.cluster_algebra_quiver.mutation_type import is_mutation_finite from random import randint from sage.misc.misc_c import prod -from sage.matrix.all import identity_matrix +from sage.matrix.special import identity_matrix from sage.matrix.constructor import matrix from sage.combinat.cluster_algebra_quiver.quiver import ClusterQuiver from sage.rings.integer import Integer @@ -3110,7 +3110,7 @@ def principal_extension(self): sage: T2 == T True """ - from sage.matrix.all import identity_matrix + from sage.matrix.special import identity_matrix if self._m != 0: raise ValueError("the b-matrix is not square") M = self._M.stack(identity_matrix(self._n)) @@ -4600,7 +4600,7 @@ def _bino(n, k): 0 """ if n >= 0: - from sage.arith.all import binomial + from sage.arith.misc import binomial return binomial(n, k) else: return 0 diff --git a/src/sage/combinat/cluster_algebra_quiver/quiver.py b/src/sage/combinat/cluster_algebra_quiver/quiver.py index 8808c9f2053..52156babeb2 100644 --- a/src/sage/combinat/cluster_algebra_quiver/quiver.py +++ b/src/sage/combinat/cluster_algebra_quiver/quiver.py @@ -558,7 +558,9 @@ def plot(self, circular=True, center=(0, 0), directed=True, mark=None, """ from sage.plot.colors import rainbow from sage.graphs.graph_generators import GraphGenerators - from sage.all import e, pi, I + from sage.symbolic.constants import e + from sage.symbolic.constants import pi + from sage.rings.imaginary_unit import I graphs = GraphGenerators() # returns positions for graph vertices on two concentric cycles with radius 1 and 2 diff --git a/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py b/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py index 80e66662a2e..59ebbfc9c07 100644 --- a/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +++ b/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py @@ -27,7 +27,8 @@ from sage.rings.infinity import infinity from sage.graphs.digraph import DiGraph from sage.graphs.graph import Graph -from sage.arith.all import binomial, euler_phi +from sage.arith.misc import binomial +from sage.arith.misc import euler_phi from sage.misc.misc_c import prod from sage.matrix.constructor import matrix diff --git a/src/sage/combinat/combinat.py b/src/sage/combinat/combinat.py index e5ad98ea4ab..fb125cf49aa 100644 --- a/src/sage/combinat/combinat.py +++ b/src/sage/combinat/combinat.py @@ -171,7 +171,8 @@ from sage.rings.rational_field import QQ from sage.rings.integer import Integer from sage.rings.infinity import infinity -from sage.arith.all import bernoulli, factorial +from sage.arith.misc import bernoulli +from sage.arith.misc import factorial from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.libs.pari.all import pari diff --git a/src/sage/combinat/combination.py b/src/sage/combinat/combination.py index 810e55308ec..42e727c6877 100644 --- a/src/sage/combinat/combination.py +++ b/src/sage/combinat/combination.py @@ -28,7 +28,7 @@ from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ -from sage.arith.all import binomial +from sage.arith.misc import binomial from .integer_vector import IntegerVectors from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.structure.parent import Parent diff --git a/src/sage/combinat/composition_signed.py b/src/sage/combinat/composition_signed.py index 8d8b78bcd59..17e26066e95 100644 --- a/src/sage/combinat/composition_signed.py +++ b/src/sage/combinat/composition_signed.py @@ -20,7 +20,7 @@ from sage.rings.integer_ring import ZZ from .composition import Compositions_n, Composition from sage.rings.integer import Integer -from sage.arith.all import binomial +from sage.arith.misc import binomial class SignedCompositions(Compositions_n): diff --git a/src/sage/combinat/crystals/alcove_path.py b/src/sage/combinat/crystals/alcove_path.py index fdc06a06d25..2bbe8592cd4 100644 --- a/src/sage/combinat/crystals/alcove_path.py +++ b/src/sage/combinat/crystals/alcove_path.py @@ -31,7 +31,7 @@ from sage.graphs.digraph import DiGraph from sage.combinat.root_system.cartan_type import CartanType from sage.combinat.root_system.root_system import RootSystem -from sage.all import vector +from sage.modules.free_module_element import free_module_element as vector from sage.rings.integer import Integer from sage.combinat.root_system.weyl_group import WeylGroup from sage.misc.misc_c import prod diff --git a/src/sage/combinat/cyclic_sieving_phenomenon.py b/src/sage/combinat/cyclic_sieving_phenomenon.py index e654a8fc94a..d09168791cb 100644 --- a/src/sage/combinat/cyclic_sieving_phenomenon.py +++ b/src/sage/combinat/cyclic_sieving_phenomenon.py @@ -26,7 +26,7 @@ # **************************************************************************** from __future__ import annotations from sage.rings.integer_ring import ZZ -from sage.arith.all import lcm +from sage.arith.functions import lcm from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing diff --git a/src/sage/combinat/decorated_permutation.py b/src/sage/combinat/decorated_permutation.py index 44ebba094b4..7845749177c 100644 --- a/src/sage/combinat/decorated_permutation.py +++ b/src/sage/combinat/decorated_permutation.py @@ -24,7 +24,7 @@ from sage.structure.unique_representation import UniqueRepresentation from sage.structure.parent import Parent from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.rings.integer import Integer from sage.combinat.permutation import Permutations from sage.combinat.subset import Subsets diff --git a/src/sage/combinat/descent_algebra.py b/src/sage/combinat/descent_algebra.py index 3707a258e47..d40fb7ea25e 100644 --- a/src/sage/combinat/descent_algebra.py +++ b/src/sage/combinat/descent_algebra.py @@ -19,7 +19,7 @@ from sage.structure.unique_representation import UniqueRepresentation from sage.categories.algebras import Algebras from sage.categories.realizations import Realizations, Category_realization_of_parent -from sage.categories.all import FiniteDimensionalAlgebrasWithBasis +from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.arith.misc import factorial diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index 72be454ec63..996ab02a584 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -53,7 +53,8 @@ from sage.categories.sets_cat import EmptySetError from sage.misc.unknown import Unknown from .design_catalog import transversal_design # type:ignore -from sage.arith.all import binomial, is_prime_power +from sage.arith.misc import binomial +from sage.arith.misc import is_prime_power from .group_divisible_designs import GroupDivisibleDesign from .designs_pyx import is_pairwise_balanced_design diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index abdaca1e17b..884cafd003e 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -55,7 +55,9 @@ from sage.modules.free_module import VectorSpace from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ -from sage.arith.all import binomial, integer_floor, is_prime_power +from sage.arith.misc import binomial +from sage.arith.misc import integer_floor +from sage.arith.misc import is_prime_power from .incidence_structures import IncidenceStructure from sage.rings.finite_rings.finite_field_constructor import FiniteField from sage.categories.sets_cat import EmptySetError diff --git a/src/sage/combinat/designs/covering_design.py b/src/sage/combinat/designs/covering_design.py index 1c0dfa47628..d87ddc6dfbd 100644 --- a/src/sage/combinat/designs/covering_design.py +++ b/src/sage/combinat/designs/covering_design.py @@ -51,7 +51,7 @@ from sage.misc.sage_eval import sage_eval from sage.structure.sage_object import SageObject from sage.rings.rational import Rational -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.combinat.combination import Combinations from sage.combinat.designs.incidence_structures import IncidenceStructure from sage.cpython.string import bytes_to_str diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index 8846dcd06bc..ed9bb493616 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -1268,8 +1268,8 @@ def turyn_1965_3x3xK(k=4): def _is_periodic_sequence(seq, period): r"""Check if the sequence is periodic with correct period. - - The sequence should have length at least twice the period, so that + + The sequence should have length at least twice the period, so that periodicity can be checked. INPUT: @@ -1280,7 +1280,7 @@ def _is_periodic_sequence(seq, period): EXAMPLES:: - sage: from sage.combinat.designs.difference_family import _is_periodic_sequence + sage: from sage.combinat.designs.difference_family import _is_periodic_sequence sage: _is_periodic_sequence([0, 1, 2, 3, 0, 1, 2, 3], 4) True sage: _is_periodic_sequence([0, 1, 0, 1, 0, 1, 0, 1], 4) @@ -1304,18 +1304,18 @@ def _is_periodic_sequence(seq, period): return True def _create_m_sequence(q, n, check=True): - r"""Create an m-sequence over GF(q) with period `q^n-1`. - + r"""Create an m-sequence over GF(q) with period `q^n-1`. + Given a prime power `q`, the m-sequence is created as described by [Zie1959]_ from a primitive function over the finite field `GF(q)`. - Given a primitive function `f=c_0+c_1x+...+c_nx^n` over `K=GF(q)` of degree `n`, + Given a primitive function `f=c_0+c_1x+...+c_nx^n` over `K=GF(q)` of degree `n`, the recurrence is given by: `a_i = -c_0^{-1}(c_1a_{i-1}+...+c_na{i-n})`. The first `n` elements will be `0,0,...,0,1` and these will give a maximal length recurrence sequence as shown in [Mit2008]_. INPUT: - + - ``q`` -- a prime power. - ``n`` -- a nonnegative number. @@ -1344,18 +1344,18 @@ def _create_m_sequence(q, n, check=True): raise ValueError('n cannot be negative') K = GF(q, 'a') - + T = PolynomialRing(K, 'x') primitive = T.irreducible_element(n, algorithm='random') while not primitive.is_primitive(): primitive = T.irreducible_element(n, algorithm='random') coeffs = primitive.coefficients() exps = primitive.exponents() - + period = q**n - 1 seq_len = period*2 if check else period seq = [1]+[0]*(n-1) - + while len(seq) < seq_len: nxt = 0 for i, coeff in zip(exps[1:], coeffs[1:]): @@ -1368,14 +1368,14 @@ def _create_m_sequence(q, n, check=True): def _get_submodule_of_order(G, order): r"""Construct a submodule of the given order from group `G`. - + This method tries to construct submodules from various elements of `G` until - a submodule of the correct order is found. - + a submodule of the correct order is found. + INPUT: - + - ``G`` -- an additive abelian group. - + - ``order`` -- integer, the order of the desired syubmodule. TESTS: @@ -1396,9 +1396,9 @@ def _get_submodule_of_order(G, order): def relative_difference_set_from_m_sequence(q, N, check=True): r"""Construct `R((q^N-1)/(q-1), q-1, q^{N-1}, q^{N-2})` where `q` is a prime power and `N\ge 2`. - + The relative difference set is constructed over the set of additive integers modulo `q^N-1`, - as described in Theorem 5.1 of [EB1966]_. Given an m-sequence `(a_i)` of period `q^N-1`, the + as described in Theorem 5.1 of [EB1966]_. Given an m-sequence `(a_i)` of period `q^N-1`, the set is: `R=\{i | 0 \le i \le q^{N-1}, a_i=1\}`. INPUT: @@ -1412,7 +1412,7 @@ def relative_difference_set_from_m_sequence(q, N, check=True): EXAMPLES:: - sage: from sage.combinat.designs.difference_family import relative_difference_set_from_m_sequence + sage: from sage.combinat.designs.difference_family import relative_difference_set_from_m_sequence sage: relative_difference_set_from_m_sequence(2, 4) #random [(0), (4), (5), (6), (7), (9), (11), (12)] sage: relative_difference_set_from_m_sequence(8, 2, check=False) #random @@ -1446,7 +1446,7 @@ def relative_difference_set_from_m_sequence(q, N, check=True): m_seq = _create_m_sequence(q, N, check=False) period = q**N-1 G = AdditiveAbelianGroup([period]) - + set1 = [i for i in G if m_seq[i[0]] == 1] if check: @@ -1524,9 +1524,9 @@ def relative_difference_set_from_homomorphism(q, N, d, check=True): def is_relative_difference_set(R, G, H, params, verbose =False): r"""Check if `R` is a difference set of `G` relative to `H`, with the given parameters. - This function checks that `G`, `H` and `R` have the orders specified in the parameters, and + This function checks that `G`, `H` and `R` have the orders specified in the parameters, and that `R` satisfies the definition of relative difference set (from [EB1966]_): the collection of - differences `r-s`, `r,s \in R`, `r \neq s` contains only elements of `G` which are not in `H`, and contains + differences `r-s`, `r,s \in R`, `r \neq s` contains only elements of `G` which are not in `H`, and contains every such element exactly `d` times. INPUT: @@ -1562,33 +1562,33 @@ def is_relative_difference_set(R, G, H, params, verbose =False): """ m, n, k, d = params if G.order() != m*n: - if verbose: + if verbose: print('Incorrect order of G:', G.order()) return False if H.order() != n: - if verbose: + if verbose: print('Incorect order of H:', H.order()) if len(R) != k: - if verbose: + if verbose: print('Length of R not correct:', len(R)) return False - + diff_set = {} for el1 in R: for el2 in R: if el1 != el2: idx = el1-el2 - if idx not in diff_set: + if idx not in diff_set: diff_set[idx] = 0 diff_set[idx] += 1 values = [diff_set[x] for x in diff_set] if max(values) != d or min(values) != d: - if verbose: + if verbose: print('There is a value in the difference set which is not repeated d times') return False - + for el in G: if el in H and el in diff_set: if verbose: @@ -1603,8 +1603,8 @@ def is_relative_difference_set(R, G, H, params, verbose =False): def is_supplementary_difference_set(Ks, v, lmbda): r"""Check that the sets in ``Ks`` are `n-\{v; k_1,...,k_n; \lambda \}` supplementary difference sets. - - From the definition in [Spe1975]_: let `S_1, S_2, ..., S_n` be `n` subsets of an additive abelian group `G` of order `v` + + From the definition in [Spe1975]_: let `S_1, S_2, ..., S_n` be `n` subsets of an additive abelian group `G` of order `v` such that `|S_i|= k_i`. If, for each `g\in G`, `g \neq 0`, the total number of solutions of `a_i-a'_i = g`, with `a_i,a'_i \in S_i` is `\lambda`, then `S_1, S_2, ..., S_n` are `n-\{v; k_1,...,k_n;\lambda\}` supplementary difference sets. @@ -1617,7 +1617,7 @@ def is_supplementary_difference_set(Ks, v, lmbda): - ``lmbda`` -- integer, the parameter `\lambda` of the supplementary difference sets. EXAMPLES:: - + sage: from sage.combinat.designs.difference_family import supplementary_difference_set, is_supplementary_difference_set sage: S1, S2, S3, S4 = supplementary_difference_set(17) sage: is_supplementary_difference_set([S1, S2, S3, S4], 16, 16) @@ -1639,7 +1639,7 @@ def is_supplementary_difference_set(Ks, v, lmbda): for el1 in K: for el2 in K: diff = G[el1]-G[el2] - + if diff not in differences_counter: differences_counter[diff] = 0 differences_counter[diff] += 1 @@ -1655,12 +1655,12 @@ def is_supplementary_difference_set(Ks, v, lmbda): def supplementary_difference_set(q, existence=False, check=True): r"""Construct `4-\{2v; v, v+1, v, v; 2v\}` supplementary difference sets where `q=2v+1`. - The sets are created from relative difference sets as detailed in Theorem 3.3 of [Spe1975]_. this construction + The sets are created from relative difference sets as detailed in Theorem 3.3 of [Spe1975]_. this construction requires that `q` is an odd prime power and that there exists `s \ge 0` such that `(q-(2^{s+1}+1))/2^{s+1}` is an odd prime power. - Note that the construction from [Spe1975]_ states that the resulting sets are `4-\{2v; v+1, v, v, v; 2v\}` - supplementary difference sets. However, the implementation of that construction returns + Note that the construction from [Spe1975]_ states that the resulting sets are `4-\{2v; v+1, v, v, v; 2v\}` + supplementary difference sets. However, the implementation of that construction returns `4-\{2v; v, v+1, v, v; 2v\}` supplementary difference sets. This is not important, since the supplementary difference sets are not ordered. @@ -1671,14 +1671,14 @@ def supplementary_difference_set(q, existence=False, check=True): - ``existence`` -- boolean (dafault False). If true, only check whether the supplementary difference sets can be constructed. - - ``check`` -- boolean (default True). If true, check that the sets are supplementary difference sets + - ``check`` -- boolean (default True). If true, check that the sets are supplementary difference sets before returning them. OUTPUT: - If ``existence`` is false, the function returns the 4 sets (containing integers), or raises an + If ``existence`` is false, the function returns the 4 sets (containing integers), or raises an error if ``q`` does not satify the constraints. - If ``existence`` is true, the function returns a boolean representing whether supplementary difference + If ``existence`` is true, the function returns a boolean representing whether supplementary difference sets can be constructed. EXAMPLES:: @@ -1691,7 +1691,7 @@ def supplementary_difference_set(q, existence=False, check=True): [0, 2, 6, 9, 11, 12, 13, 15]) If existence is ``True``, the function returns a boolean:: - + sage: supplementary_difference_set(7, existence=True) False sage: supplementary_difference_set(17, existence=True) @@ -1732,8 +1732,8 @@ def supplementary_difference_set(q, existence=False, check=True): if is_prime_power(prime_pow) and prime_pow % 2 == 1: m = (q - (2**(s+1) + 1)) // 2**(s+1) + 1 break - s += 1 - + s += 1 + if existence: return is_prime_power(q) and q % 2 == 1 and m != -1 @@ -1741,12 +1741,12 @@ def supplementary_difference_set(q, existence=False, check=True): raise ValueError('q must be an odd prime power') if m == -1: raise ValueError('There is no s for which m-1 is an odd prime power') - + set1 = relative_difference_set_from_homomorphism(m-1, 2, (m-2)//2, check=False) - + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing P = PolynomialRing(ZZ, 'x') - + #Compute psi3, psi4 hall = 0 for d in set1: @@ -1755,7 +1755,7 @@ def supplementary_difference_set(q, existence=False, check=True): T_2m = 0 for i in range(2*m): T_2m += P.monomial(i) - + modulo = P.monomial(2*m)-1 diff = T_2m - (1+P.monomial(m))*hall @@ -1771,7 +1771,7 @@ def supplementary_difference_set(q, existence=False, check=True): for i in range(s): psi3 = (alfa3(P.monomial(2))+P.monomial(1)*alfa4(P.monomial(2))).mod(P.monomial(4*m)-1) psi4 = (alfa3(P.monomial(2)) + P.monomial(1)*(T_2m(P.monomial(2)) - alfa4(P.monomial(2)))).mod(P.monomial(4*m)-1) - + # Construction of psi1, psi2 set2 = relative_difference_set_from_m_sequence(q, 2, check=False) s3 = _get_fixed_relative_difference_set(set2) @@ -1782,7 +1782,7 @@ def supplementary_difference_set(q, existence=False, check=True): diff = (s3[i]-s3[j]) if diff%(q-1) == 0 and diff%(q**2-1) != 0: phi_exps.append(s3[i]) - + exps1 = [(x+1)//2 for x in phi_exps if x%2 == 1] exps2 = [x//2 for x in phi_exps if x%2 == 0] @@ -1824,14 +1824,14 @@ def _get_fixed_relative_difference_set(rel_diff_set, as_elements=False): of this set fixed by `q` (see Section 3 of [Spe1975]_). We say that a set is fixed by `t` if `\{td | d\in R\}= R`. - In addition, the set returned by this function will contain the element `0`. This is needed in the + In addition, the set returned by this function will contain the element `0`. This is needed in the construction of supplementary difference sets (see :func:`supplementary_difference_set`). INPUT: - + - ``rel_diff_set`` -- the relative difference set. - - ``as_elements`` -- boolean (default False). If true, the list returned will contain elements of the + - ``as_elements`` -- boolean (default False). If true, the list returned will contain elements of the abelian group (this may slow down the computation considerably). OUTPUT: @@ -1842,11 +1842,11 @@ def _get_fixed_relative_difference_set(rel_diff_set, as_elements=False): EXAMPLES:: - sage: from sage.combinat.designs.difference_family import relative_difference_set_from_m_sequence, _get_fixed_relative_difference_set + sage: from sage.combinat.designs.difference_family import relative_difference_set_from_m_sequence, _get_fixed_relative_difference_set sage: s1 = relative_difference_set_from_m_sequence(5, 2) sage: _get_fixed_relative_difference_set(s1) #random - [2, 10, 19, 23, 0] - + [2, 10, 19, 23, 0] + If ``as_elements`` is true, the reuslt will contain elements of the group:: sage: _get_fixed_relative_difference_set(s1, as_elements=True) #random @@ -1871,7 +1871,7 @@ def _get_fixed_relative_difference_set(rel_diff_set, as_elements=False): """ G = rel_diff_set[0].parent() q = len(rel_diff_set) - + s2 = None for el in G: fixed_set = [el+x for x in rel_diff_set] @@ -1894,20 +1894,20 @@ def _get_fixed_relative_difference_set(rel_diff_set, as_elements=False): def _is_fixed_relative_difference_set(R, q): r"""Check if the relative difference set `R` is fixed by `q`. - + A relative difference set `R` is fixed by `q` if `\{qd | d\in R\}= R` (see Section 3 of [Spe1975]_). INPUT: - ``R`` -- the relative difference sets, as a list containing elements of the abelian group. - - ``q`` -- an integer. + - ``q`` -- an integer. EXAMPLES:: sage: from sage.combinat.designs.difference_family import relative_difference_set_from_m_sequence, _get_fixed_relative_difference_set, _is_fixed_relative_difference_set sage: s1 = relative_difference_set_from_m_sequence(7, 2) - sage: s2 = _get_fixed_relative_difference_set(s1, as_elements=True) + sage: s2 = _get_fixed_relative_difference_set(s1, as_elements=True) sage: _is_fixed_relative_difference_set(s2, len(s2)) True sage: G = AdditiveAbelianGroup([15]) @@ -1918,7 +1918,7 @@ def _is_fixed_relative_difference_set(R, q): If the relative difference set does not contain elements of the group, the method returns false:: sage: s1 = relative_difference_set_from_m_sequence(7, 2) - sage: s2 = _get_fixed_relative_difference_set(s1, as_elements=False) + sage: s2 = _get_fixed_relative_difference_set(s1, as_elements=False) sage: _is_fixed_relative_difference_set(s2, len(s2)) False @@ -1927,18 +1927,18 @@ def _is_fixed_relative_difference_set(R, q): for el in R: if q*el not in R: return False - return True + return True def skew_supplementary_difference_set(n, existence=False, check=True): r"""Construct `4-\{n; n_1, n_2, n_3, n_4; \lambda\}` supplementary difference sets where `S_1` is skew and `n_1+n_2+n_3+n_4= n+\lambda`. - These sets are constructed from available data, as described in [Djo1994]_. The set `S_1 \subset G` is + These sets are constructed from available data, as described in [Djo1994]_. The set `S_1 \subset G` is always skew, i.e. `S_1 \cap (-S_1) = \emptyset` and `S_1 \cup (-S_1) = G\setminus\{0\}`. The data for `n = 103, 151` is taken from [Djo1994]_ and the data for `n = 67, 113, 127, 157, 163, 181, 241` is taken from [Djo1992]_. - + INPUT: - ``n`` -- integer, the parameter of the supplementary difference set. @@ -1946,14 +1946,14 @@ def skew_supplementary_difference_set(n, existence=False, check=True): - ``existence`` -- boolean (dafault False). If true, only check whether the supplementary difference sets can be constructed. - - ``check`` -- boolean (default True). If true, check that the sets are supplementary difference sets + - ``check`` -- boolean (default True). If true, check that the sets are supplementary difference sets with `S_1` skew before returning them. Setting this parameter to False may speed up the computation considerably. - + OUTPUT: - If ``existence`` is false, the function returns the 4 sets (containing integers modulo `n`), or raises an + If ``existence`` is false, the function returns the 4 sets (containing integers modulo `n`), or raises an error if data for the given ``n`` is not available. - If ``existence`` is true, the function returns a boolean representing whether skew supplementary difference + If ``existence`` is true, the function returns a boolean representing whether skew supplementary difference sets can be constructed. EXAMPLES:: @@ -1962,7 +1962,7 @@ def skew_supplementary_difference_set(n, existence=False, check=True): sage: S1, S2, S3, S4 = skew_supplementary_difference_set(103) If existence is ``True``, the function returns a boolean :: - + sage: skew_supplementary_difference_set(103, existence=True) True sage: skew_supplementary_difference_set(17, existence=True) @@ -1991,14 +1991,14 @@ def skew_supplementary_difference_set(n, existence=False, check=True): True """ - + indices = { 67: [[0,3,5,6,9,10,13,14,17,18,20], [0,2,4,9,11,12,13,16,19,21], [1,3,6,10,11,13,14,16,20,21], [2,4,6,8,9,11,14,17,19]], - 103: [[1,3,4,6,8,11,12,14,17,18,20,22,25,27,28,30,32], - [2,9,10,12,13,14,15,16,20,21,22,23,24,26,28,29,30], + 103: [[1,3,4,6,8,11,12,14,17,18,20,22,25,27,28,30,32], + [2,9,10,12,13,14,15,16,20,21,22,23,24,26,28,29,30], [0,1,2,3,4,11,12,13,16,17,19,20,21,24,25,26,28,30,31], [0,1,2,3,4,5,6,13,15,18,19,20,23,24,25,26,27,28,29,31]], 113: [[0,3,4,6,8,10,13,14], @@ -2064,13 +2064,13 @@ def generate_set(index_set, cosets): if existence: return n in indices - + if n not in indices: raise ValueError(f'Skew SDS of order {n} not yet implemented.') - + Z = Zmod(n) H = list(map(Z, H_db[n])) - + cosets = [] for el in cosets_gens[n]: even_coset = [] @@ -2080,7 +2080,7 @@ def generate_set(index_set, cosets): odd_coset.append(-x*el) cosets.append(even_coset) cosets.append(odd_coset) - + S1 = generate_set(indices[n][0], cosets) S2 = generate_set(indices[n][1], cosets) S3 = generate_set(indices[n][2], cosets) @@ -2090,16 +2090,16 @@ def generate_set(index_set, cosets): lmbda = len(S1)+len(S2)+len(S3)+len(S4) - n assert is_supplementary_difference_set([S1, S2, S3, S4], n, lmbda) assert _is_skew_set(S1, n) - + return S1, S2, S3, S4 def _is_skew_set(S, n): r"""Check if `S` is a skew set over the set of integers modulo `n`. - From [Djo1994]_, a set `S \subset G` (where `G` is a finite abelian group of order `n`) is of skew + From [Djo1994]_, a set `S \subset G` (where `G` is a finite abelian group of order `n`) is of skew type if `S_1 \cap (-S_1) = \emptyset` and `S_1 \cup (-S_1) = G\setminus \{0\}`. - INPUT: + INPUT: - ``S`` -- the set to be checked, containing integers modulo `n`. diff --git a/src/sage/combinat/designs/difference_matrices.py b/src/sage/combinat/designs/difference_matrices.py index 03aeb966af5..72b935e0f94 100644 --- a/src/sage/combinat/designs/difference_matrices.py +++ b/src/sage/combinat/designs/difference_matrices.py @@ -14,7 +14,8 @@ from sage.misc.cachefunc import cached_function from sage.categories.sets_cat import EmptySetError from sage.rings.finite_rings.finite_field_constructor import FiniteField -from sage.arith.all import is_prime_power, divisors +from sage.arith.misc import is_prime_power +from sage.arith.misc import divisors from .designs_pyx import is_difference_matrix from .database import DM as DM_constructions diff --git a/src/sage/combinat/designs/group_divisible_designs.py b/src/sage/combinat/designs/group_divisible_designs.py index 6bb032a793d..b6898358c45 100644 --- a/src/sage/combinat/designs/group_divisible_designs.py +++ b/src/sage/combinat/designs/group_divisible_designs.py @@ -31,7 +31,7 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.arith.all import is_prime_power +from sage.arith.misc import is_prime_power from sage.misc.unknown import Unknown from .incidence_structures import IncidenceStructure diff --git a/src/sage/combinat/designs/incidence_structures.py b/src/sage/combinat/designs/incidence_structures.py index dfb6c90f652..774885a0363 100644 --- a/src/sage/combinat/designs/incidence_structures.py +++ b/src/sage/combinat/designs/incidence_structures.py @@ -1577,7 +1577,7 @@ def is_t_design(self, t=None, v=None, k=None, l=None, return_parameters=False): sage: I.is_t_design(return_parameters=True) (False, (0, 0, 0, 0)) """ - from sage.arith.all import binomial + from sage.arith.misc import binomial # Missing parameters ? if v is None: diff --git a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py index 526487adb97..9716849b744 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py +++ b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py @@ -365,7 +365,7 @@ def OA_and_oval(q, *, solver=None, integrality_tolerance=1e-3): sage: _ = OA_and_oval """ - from sage.arith.all import is_prime_power + from sage.arith.misc import is_prime_power from sage.combinat.designs.block_design import projective_plane from .orthogonal_arrays import OA_relabel @@ -683,7 +683,7 @@ def thwart_lemma_3_5(k,n,m,a,b,c,d=0,complement=False,explain_construction=False Charles J.Colbourn, Jeffrey H. Dinitz, Mieczyslaw Wojtas. Designs, Codes and Cryptography 5, no. 3 (1995): 189-197. """ - from sage.arith.all import is_prime_power + from sage.arith.misc import is_prime_power from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF if complement: @@ -797,7 +797,7 @@ def thwart_lemma_4_1(k,n,m,explain_construction=False): Canad. Math. Bull vol7 num.4 (1964) """ from sage.rings.finite_rings.finite_field_constructor import FiniteField - from sage.arith.all import is_prime_power + from sage.arith.misc import is_prime_power from .block_design import DesarguesianProjectivePlaneDesign from itertools import chain @@ -1387,7 +1387,7 @@ def brouwer_separable_design(k,t,q,x,check=False,verbose=False,explain_construct from sage.combinat.designs.orthogonal_arrays import OA_from_PBD from .difference_family import difference_family from .orthogonal_arrays import incomplete_orthogonal_array - from sage.arith.all import is_prime_power + from sage.arith.misc import is_prime_power if explain_construction: return ("Brouwer's separable design construction with t={},q={},x={} from:\n"+ diff --git a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx index d1d4eb10828..3fee26e2a22 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +++ b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx @@ -48,7 +48,7 @@ Functions from sage.misc.cachefunc import cached_function from .orthogonal_arrays import orthogonal_array from sage.rings.integer cimport Integer, smallInteger -from sage.arith.all import prime_powers +from sage.arith.misc import prime_powers @cached_function def find_recursive_construction(k, n): diff --git a/src/sage/combinat/designs/resolvable_bibd.py b/src/sage/combinat/designs/resolvable_bibd.py index 7085e2d9ab1..944a1b6d4a7 100644 --- a/src/sage/combinat/designs/resolvable_bibd.py +++ b/src/sage/combinat/designs/resolvable_bibd.py @@ -48,7 +48,7 @@ --------- """ from itertools import repeat -from sage.arith.all import is_prime_power +from sage.arith.misc import is_prime_power from sage.combinat.designs.bibd import BalancedIncompleteBlockDesign from sage.categories.sets_cat import EmptySetError from .bibd import balanced_incomplete_block_design diff --git a/src/sage/combinat/dyck_word.py b/src/sage/combinat/dyck_word.py index 78fc75dda53..db6ef33b337 100644 --- a/src/sage/combinat/dyck_word.py +++ b/src/sage/combinat/dyck_word.py @@ -89,7 +89,7 @@ from sage.structure.unique_representation import UniqueRepresentation from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets -from sage.categories.all import Posets +from sage.categories.posets import Posets from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ @@ -1978,7 +1978,7 @@ def number_of_parking_functions(self) -> int: sage: DyckWord(area_sequence=[0,0,0]).number_of_parking_functions() 6 """ - from sage.arith.all import multinomial + from sage.arith.misc import multinomial return multinomial(self.rise_composition()) def list_parking_functions(self): @@ -3774,7 +3774,7 @@ def cardinality(self) -> int: ....: for p in range(7)) True """ - from sage.arith.all import binomial + from sage.arith.misc import binomial return (self.k1 - self.k2 + 1) * binomial(self.k1 + self.k2, self.k2) // (self.k1 + 1) ################################################################ diff --git a/src/sage/combinat/free_module.py b/src/sage/combinat/free_module.py index d6042d6facc..9d4be0317c7 100644 --- a/src/sage/combinat/free_module.py +++ b/src/sage/combinat/free_module.py @@ -24,7 +24,10 @@ from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute from sage.categories.morphism import SetMorphism -from sage.categories.all import Category, Sets, ModulesWithBasis, GradedAlgebrasWithBasis +from sage.categories.category import Category +from sage.categories.sets_cat import Sets +from sage.categories.modules_with_basis import ModulesWithBasis +from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis from sage.categories.tensor import tensor import sage.data_structures.blas_dict as blas from sage.typeset.ascii_art import AsciiArt, ascii_art diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py index 81eb5131349..4156e10c350 100644 --- a/src/sage/combinat/fully_packed_loop.py +++ b/src/sage/combinat/fully_packed_loop.py @@ -38,7 +38,7 @@ from sage.misc.decorators import options from sage.matrix.constructor import matrix -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.rings.integer import Integer from sage.misc.misc_c import prod diff --git a/src/sage/combinat/integer_vector.py b/src/sage/combinat/integer_vector.py index 2b88a6e3e1e..1a4f015adc4 100644 --- a/src/sage/combinat/integer_vector.py +++ b/src/sage/combinat/integer_vector.py @@ -42,7 +42,7 @@ from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.rings.infinity import PlusInfinity -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.rings.integer_ring import ZZ from sage.rings.semirings.non_negative_integer_semiring import NN from sage.rings.integer import Integer diff --git a/src/sage/combinat/integer_vector_weighted.py b/src/sage/combinat/integer_vector_weighted.py index 1c2c109217c..6cde208ea19 100644 --- a/src/sage/combinat/integer_vector_weighted.py +++ b/src/sage/combinat/integer_vector_weighted.py @@ -281,7 +281,8 @@ def __init__(self, weight): sage: TestSuite(C).run() """ self._weights = weight - from sage.sets.all import Family, NonNegativeIntegers + from sage.sets.family import Family + from sage.sets.non_negative_integers import NonNegativeIntegers # Use "partial" to make the basis function (with the weights # argument specified) pickleable. Otherwise, it seems to # cause problems... diff --git a/src/sage/combinat/interval_posets.py b/src/sage/combinat/interval_posets.py index 7ccede75e8b..6e56d2248fa 100644 --- a/src/sage/combinat/interval_posets.py +++ b/src/sage/combinat/interval_posets.py @@ -36,7 +36,7 @@ from sage.categories.enumerated_sets import EnumeratedSets from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.posets import Posets -from sage.categories.all import Monoids +from sage.categories.monoids import Monoids from sage.combinat.posets.posets import Poset, FinitePoset from sage.categories.finite_posets import FinitePosets from sage.combinat.binary_tree import BinaryTrees @@ -3707,7 +3707,7 @@ def cardinality(self) -> Integer: sage: [TamariIntervalPosets(i).cardinality() for i in range(6)] [1, 1, 3, 13, 68, 399] """ - from sage.arith.all import binomial + from sage.arith.misc import binomial n = self._size if n == 0: return Integer(1) diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index 74cd1a3bb32..4b6ddf75321 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -59,7 +59,9 @@ from sage.rings.integer_ring import ZZ from sage.matrix.constructor import matrix, block_matrix, block_diagonal_matrix, diagonal_matrix -from sage.arith.all import is_square, is_prime_power, divisors +from sage.arith.misc import is_square +from sage.arith.misc import is_prime_power +from sage.arith.misc import divisors from math import sqrt from sage.matrix.constructor import identity_matrix as I from sage.matrix.constructor import ones_matrix as J @@ -1100,8 +1102,8 @@ def turyn_type_hadamard_matrix_smallcases(n, existence=False, check=True): def hadamard_matrix_spence_construction(n, existence=False, check=True): r"""Create an Hadamard matrix of order `n` using Spence construction. - This construction (detailed in [Spe1975]_), uses supplementary difference sets implemented in - :func:`sage.combinat.designs.difference_family.supplementary_difference_set` to create the + This construction (detailed in [Spe1975]_), uses supplementary difference sets implemented in + :func:`sage.combinat.designs.difference_family.supplementary_difference_set` to create the desired matrix. INPUT: @@ -1153,10 +1155,10 @@ def hadamard_matrix_spence_construction(n, existence=False, check=True): assert n%4 == 0 and n > 0 q = n//4 - - if existence: + + if existence: return supplementary_difference_set(q, existence=True) - + if not supplementary_difference_set(q, existence=True): raise ValueError(f'The order {n} is not covered by Spence construction.') @@ -1166,7 +1168,7 @@ def hadamard_matrix_spence_construction(n, existence=False, check=True): A2 = matrix.circulant([1 if j in S4 else -1 for j in range(q-1)]) A3 = matrix.circulant([1 if j in S3 else -1 for j in range(q-1)]) A4 = matrix.circulant([1 if j in S2 else -1 for j in range(q-1)]) - + P = matrix(ZZ, [[1 if (i + j)%(q-1) == 0 else 0 for i in range(1, q)] for j in range(1, q)]) e = matrix([1]*(q-1)) @@ -1928,9 +1930,9 @@ def GS_skew_hadamard_smallcases(n, existence=False, check=True): :func:`sage.combinat.matrices.hadamard_matrix.williamson_goethals_seidel_skew_hadamard_matrix` Matrices for `n=36` and `52` are given in [GS70s]_. Matrices for `n=92` are given in [Wall71]_. - - Additional data is obtained from skew supplementary difference sets contained in - :func:`sage.combinat.designs.difference_family.skew_supplementary_difference_set`, using the + + Additional data is obtained from skew supplementary difference sets contained in + :func:`sage.combinat.designs.difference_family.skew_supplementary_difference_set`, using the construction described in [Djo1992]_. INPUT: @@ -1979,7 +1981,7 @@ def pmtoZ(s): c = [1, 1,-1,-1,-1, 1,-1, 1,-1, 1,-1, 1, 1,-1, 1,-1, 1,-1, 1,-1,-1,-1, 1] d = [1,-1,-1,-1,-1, 1,-1,-1, 1,-1,-1, 1, 1,-1,-1, 1,-1,-1, 1,-1,-1,-1,-1] return WGS(a, b, c, d, check=check) - + if skew_supplementary_difference_set(n//4, existence=True): t = n//4 S1, S2, S3, S4 = skew_supplementary_difference_set(t, check=False) @@ -1988,7 +1990,7 @@ def pmtoZ(s): c = [-1 if i in S3 else 1 for i in range(t)] d = [-1 if i in S4 else 1 for i in range(t)] return WGS(a, b, c, d, check=check) - + return None _skew_had_cache={} diff --git a/src/sage/combinat/matrices/latin.py b/src/sage/combinat/matrices/latin.py index 82e6ff65311..e36edf0fc82 100644 --- a/src/sage/combinat/matrices/latin.py +++ b/src/sage/combinat/matrices/latin.py @@ -139,7 +139,7 @@ from sage.combinat.permutation import Permutation from sage.interfaces.gap import gap from sage.groups.perm_gps.permgroup import PermutationGroup -from sage.arith.all import is_prime +from sage.arith.misc import is_prime from sage.rings.finite_rings.finite_field_constructor import FiniteField from sage.misc.flatten import flatten diff --git a/src/sage/combinat/multiset_partition_into_sets_ordered.py b/src/sage/combinat/multiset_partition_into_sets_ordered.py index 8963ab00f0d..26e4bcb691c 100755 --- a/src/sage/combinat/multiset_partition_into_sets_ordered.py +++ b/src/sage/combinat/multiset_partition_into_sets_ordered.py @@ -81,7 +81,7 @@ from sage.rings.infinity import infinity from sage.rings.integer_ring import ZZ from sage.rings.power_series_ring import PowerSeriesRing -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.combinat.subset import Subsets_sk from sage.combinat.composition import Composition, Compositions, composition_iterator_fast diff --git a/src/sage/combinat/ncsf_qsym/generic_basis_code.py b/src/sage/combinat/ncsf_qsym/generic_basis_code.py index 87364ac04c6..1c0247ad9c9 100644 --- a/src/sage/combinat/ncsf_qsym/generic_basis_code.py +++ b/src/sage/combinat/ncsf_qsym/generic_basis_code.py @@ -34,7 +34,7 @@ from sage.combinat.partition import Partition from sage.combinat.permutation import Permutations from sage.rings.integer import Integer -from sage.categories.all import AlgebrasWithBasis +from sage.categories.algebras_with_basis import AlgebrasWithBasis from sage.misc.lazy_attribute import lazy_attribute from sage.misc.abstract_method import abstract_method from sage.categories.category_types import Category_over_base_ring diff --git a/src/sage/combinat/ncsf_qsym/ncsf.py b/src/sage/combinat/ncsf_qsym/ncsf.py index 7a53a902b94..40cd8b8e44a 100644 --- a/src/sage/combinat/ncsf_qsym/ncsf.py +++ b/src/sage/combinat/ncsf_qsym/ncsf.py @@ -2251,7 +2251,7 @@ def coproduct(self): From: Non-Commutative Symmetric Functions over the Rational Field in the Complete basis To: Non-Commutative Symmetric Functions over the Rational Field in the Complete basis # Non-Commutative Symmetric Functions over the Rational Field in the Complete basis """ - from sage.categories.all import tensor + from sage.categories.tensor import tensor if hasattr(self, "coproduct_on_generators"): return self.algebra_morphism(self.coproduct_on_generators, codomain = tensor([self, self])) else: @@ -2496,7 +2496,7 @@ def coproduct_on_generators(self, i): if i < 1: raise ValueError("Not a positive integer: {}".format(i)) x = self.algebra_generators()[i] - from sage.categories.all import tensor + from sage.categories.tensor import tensor return tensor([self.one(), x]) + tensor([x, self.one()]) class Ribbon(CombinatorialFreeModule, BindableClass): diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index 086b68c6175..9964996c453 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -3683,7 +3683,7 @@ def _precompute_M(self, n): M = self.realization_of().M() if l <= n: from sage.misc.cachefunc import cached_function - from sage.arith.all import gcd + from sage.arith.misc import GCD as gcd @cached_function def monolambda(I): diff --git a/src/sage/combinat/ncsym/bases.py b/src/sage/combinat/ncsym/bases.py index 6d8b1b86185..c1bd340a05c 100644 --- a/src/sage/combinat/ncsym/bases.py +++ b/src/sage/combinat/ncsym/bases.py @@ -18,7 +18,9 @@ from sage.misc.bindable_class import BindableClass from sage.categories.graded_hopf_algebras import GradedHopfAlgebras from sage.categories.realizations import Category_realization_of_parent -from sage.categories.all import ModulesWithBasis, tensor, Hom +from sage.categories.modules_with_basis import ModulesWithBasis +from sage.categories.tensor import tensor +from sage.categories.homset import Hom from sage.combinat.set_partition import SetPartition, SetPartitions from sage.combinat.free_module import CombinatorialFreeModule diff --git a/src/sage/combinat/necklace.py b/src/sage/combinat/necklace.py index a065cabdd2c..ef38833b29e 100644 --- a/src/sage/combinat/necklace.py +++ b/src/sage/combinat/necklace.py @@ -26,7 +26,10 @@ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from sage.arith.all import euler_phi, factorial, divisors, gcd +from sage.arith.misc import euler_phi +from sage.arith.misc import factorial +from sage.arith.misc import divisors +from sage.arith.misc import GCD as gcd from sage.rings.integer_ring import ZZ from sage.rings.integer import Integer from sage.misc.misc_c import prod diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 423ea6a3730..367299a4e60 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -308,7 +308,8 @@ from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.semirings.non_negative_integer_semiring import NN -from sage.arith.all import factorial, gcd +from sage.arith.misc import factorial +from sage.arith.misc import GCD as gcd from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.integer import Integer from sage.rings.infinity import infinity @@ -326,7 +327,7 @@ from sage.combinat.combinatorial_map import combinatorial_map from sage.groups.perm_gps.permgroup import PermutationGroup from sage.graphs.dot2tex_utils import have_dot2tex -from sage.arith.all import binomial +from sage.arith.misc import binomial class Partition(CombinatorialElement): diff --git a/src/sage/combinat/partition_algebra.py b/src/sage/combinat/partition_algebra.py index 740482395b4..789a214f365 100644 --- a/src/sage/combinat/partition_algebra.py +++ b/src/sage/combinat/partition_algebra.py @@ -21,7 +21,8 @@ from sage.combinat.set_partition import SetPartition, SetPartitions, SetPartitions_set from sage.sets.set import Set, Set_generic from sage.graphs.graph import Graph -from sage.arith.all import factorial, binomial +from sage.arith.misc import factorial +from sage.arith.misc import binomial from .permutation import Permutations from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ diff --git a/src/sage/combinat/path_tableaux/frieze.py b/src/sage/combinat/path_tableaux/frieze.py index da1d4205b00..ff034a12ea7 100644 --- a/src/sage/combinat/path_tableaux/frieze.py +++ b/src/sage/combinat/path_tableaux/frieze.py @@ -327,7 +327,7 @@ def triangulation(self): from sage.plot.line import line from sage.plot.text import text from sage.functions.trig import sin, cos - from sage.all import pi + from sage.symbolic.constants import pi G = Graphics() G.set_aspect_ratio(1.0) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 424ea7dd68b..38a8270d1ca 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -253,7 +253,8 @@ from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.arith.all import factorial, multinomial +from sage.arith.misc import factorial +from sage.arith.misc import multinomial from sage.matrix.matrix_space import MatrixSpace from sage.combinat.tools import transitive_ideal from sage.combinat.composition import Composition diff --git a/src/sage/combinat/posets/hasse_diagram.py b/src/sage/combinat/posets/hasse_diagram.py index d857092f9c7..da265a33271 100644 --- a/src/sage/combinat/posets/hasse_diagram.py +++ b/src/sage/combinat/posets/hasse_diagram.py @@ -23,7 +23,7 @@ from sage.rings.finite_rings.finite_field_constructor import GF from sage.misc.lazy_attribute import lazy_attribute from sage.misc.cachefunc import cached_method -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.misc.rest_index_of_methods import gen_rest_table_index from sage.combinat.posets.hasse_cython import (moebius_matrix_fast, coxeter_matrix_fast, diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 2836d59d960..fc0aa8b2b56 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -292,7 +292,7 @@ from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute from sage.misc.misc_c import prod -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.categories.category import Category from sage.categories.sets_cat import Sets from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets diff --git a/src/sage/combinat/rigged_configurations/kleber_tree.py b/src/sage/combinat/rigged_configurations/kleber_tree.py index df5db0f5fe8..983b8826b95 100644 --- a/src/sage/combinat/rigged_configurations/kleber_tree.py +++ b/src/sage/combinat/rigged_configurations/kleber_tree.py @@ -71,7 +71,7 @@ from sage.misc.cachefunc import cached_method from sage.misc.latex import latex from sage.misc.misc_c import prod -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.features import FeatureNotPresentError from sage.rings.integer import Integer diff --git a/src/sage/combinat/root_system/cartan_matrix.py b/src/sage/combinat/root_system/cartan_matrix.py index a4d66256bf5..c747f95b8a8 100644 --- a/src/sage/combinat/root_system/cartan_matrix.py +++ b/src/sage/combinat/root_system/cartan_matrix.py @@ -489,7 +489,7 @@ def symmetrizer(self): iset = self.index_set() # The result from is_symmetrizable needs to be scaled # to integer coefficients - from sage.arith.all import LCM + from sage.arith.functions import lcm as LCM from sage.rings.rational_field import QQ scalar = LCM([QQ(x).denominator() for x in sym]) return Family( {iset[i]: ZZ(val*scalar) for i, val in enumerate(sym)} ) diff --git a/src/sage/combinat/root_system/coxeter_type.py b/src/sage/combinat/root_system/coxeter_type.py index 9c10c3c04db..39fa6ca0d01 100644 --- a/src/sage/combinat/root_system/coxeter_type.py +++ b/src/sage/combinat/root_system/coxeter_type.py @@ -23,7 +23,7 @@ from sage.combinat.root_system.cartan_type import CartanType import sage.rings.abc from sage.matrix.args import SparseEntry -from sage.matrix.all import Matrix +from sage.matrix.constructor import Matrix from sage.symbolic.ring import SR from sage.structure.unique_representation import UniqueRepresentation from sage.structure.sage_object import SageObject diff --git a/src/sage/combinat/root_system/reflection_group_complex.py b/src/sage/combinat/root_system/reflection_group_complex.py index bebb3dc9f04..9687152e09a 100644 --- a/src/sage/combinat/root_system/reflection_group_complex.py +++ b/src/sage/combinat/root_system/reflection_group_complex.py @@ -207,7 +207,8 @@ from sage.groups.perm_gps.permgroup import PermutationGroup_generic from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.matrix.all import Matrix, identity_matrix +from sage.matrix.constructor import Matrix +from sage.matrix.special import identity_matrix from sage.structure.element import is_Matrix from sage.interfaces.gap3 import gap3 from sage.rings.universal_cyclotomic_field import E @@ -1548,7 +1549,7 @@ def cartan_matrix(self): if self.is_crystallographic(): from sage.combinat.root_system.cartan_matrix import CartanMatrix as CartanMat else: - from sage.matrix.all import Matrix as CartanMat + from sage.matrix.constructor import Matrix as CartanMat return CartanMat(self._gap_group.CartanMat().sage()) def invariant_form(self, brute_force=False): diff --git a/src/sage/combinat/root_system/reflection_group_element.pyx b/src/sage/combinat/root_system/reflection_group_element.pyx index b724132637b..4a537aa9d68 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pyx +++ b/src/sage/combinat/root_system/reflection_group_element.pyx @@ -33,7 +33,8 @@ from sage.interfaces.gap3 import gap3 from sage.combinat.root_system.cartan_matrix import CartanMatrix from sage.misc.sage_eval import sage_eval from sage.combinat.root_system.reflection_group_c import reduced_word_c, reduce_in_coset -from sage.matrix.all import Matrix, identity_matrix +from sage.matrix.constructor import Matrix +from sage.matrix.special import identity_matrix cdef class ComplexReflectionGroupElement(PermutationGroupElement): diff --git a/src/sage/combinat/root_system/weyl_characters.py b/src/sage/combinat/root_system/weyl_characters.py index 17c84dfb8ce..32356dd6d24 100644 --- a/src/sage/combinat/root_system/weyl_characters.py +++ b/src/sage/combinat/root_system/weyl_characters.py @@ -10,7 +10,8 @@ # **************************************************************************** import sage.combinat.root_system.branching_rules -from sage.categories.all import Algebras, AlgebrasWithBasis +from sage.categories.algebras import Algebras +from sage.categories.algebras_with_basis import AlgebrasWithBasis from sage.combinat.free_module import CombinatorialFreeModule from sage.combinat.root_system.cartan_type import CartanType from sage.combinat.root_system.root_system import RootSystem diff --git a/src/sage/combinat/root_system/weyl_group.py b/src/sage/combinat/root_system/weyl_group.py index a8c13419c4b..3cad709aebb 100644 --- a/src/sage/combinat/root_system/weyl_group.py +++ b/src/sage/combinat/root_system/weyl_group.py @@ -53,7 +53,9 @@ from sage.combinat.root_system.root_lattice_realizations import RootLatticeRealizations from sage.structure.unique_representation import UniqueRepresentation from sage.structure.richcmp import richcmp, richcmp_not_equal -from sage.categories.all import WeylGroups, FiniteWeylGroups, AffineWeylGroups +from sage.categories.weyl_groups import WeylGroups +from sage.categories.finite_weyl_groups import FiniteWeylGroups +from sage.categories.affine_weyl_groups import AffineWeylGroups from sage.categories.permutation_groups import PermutationGroups from sage.sets.family import Family from sage.matrix.constructor import Matrix diff --git a/src/sage/combinat/schubert_polynomial.py b/src/sage/combinat/schubert_polynomial.py index 07d679ac65d..a6efb83a561 100644 --- a/src/sage/combinat/schubert_polynomial.py +++ b/src/sage/combinat/schubert_polynomial.py @@ -74,7 +74,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** from sage.combinat.free_module import CombinatorialFreeModule -from sage.categories.all import GradedAlgebrasWithBasis +from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing diff --git a/src/sage/combinat/set_partition_ordered.py b/src/sage/combinat/set_partition_ordered.py index 62f59de06b4..3c6dcbb383c 100644 --- a/src/sage/combinat/set_partition_ordered.py +++ b/src/sage/combinat/set_partition_ordered.py @@ -24,7 +24,8 @@ # # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.all import factorial, multinomial +from sage.arith.misc import factorial +from sage.arith.misc import multinomial from sage.categories.cartesian_product import cartesian_product from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets diff --git a/src/sage/combinat/sf/character.py b/src/sage/combinat/sf/character.py index e5752c307eb..b57874ad832 100644 --- a/src/sage/combinat/sf/character.py +++ b/src/sage/combinat/sf/character.py @@ -31,7 +31,9 @@ from sage.misc.cachefunc import cached_method from sage.categories.homset import Hom from sage.categories.morphism import SetMorphism -from sage.arith.all import divisors, moebius, binomial +from sage.arith.misc import divisors +from sage.arith.misc import moebius +from sage.arith.misc import binomial from sage.rings.integer import Integer diff --git a/src/sage/combinat/sf/elementary.py b/src/sage/combinat/sf/elementary.py index 446acbf23a3..3ed3db345d5 100644 --- a/src/sage/combinat/sf/elementary.py +++ b/src/sage/combinat/sf/elementary.py @@ -20,7 +20,8 @@ from . import multiplicative, classical from sage.combinat.partition import Partition from sage.misc.misc_c import prod -from sage.arith.all import factorial, binomial +from sage.arith.misc import factorial +from sage.arith.misc import binomial from sage.rings.infinity import infinity ################################### diff --git a/src/sage/combinat/sf/homogeneous.py b/src/sage/combinat/sf/homogeneous.py index 3157a9bf0eb..42c6aeb55ad 100644 --- a/src/sage/combinat/sf/homogeneous.py +++ b/src/sage/combinat/sf/homogeneous.py @@ -29,7 +29,8 @@ from sage.combinat.partition import Partition from sage.rings.infinity import infinity from sage.misc.misc_c import prod -from sage.arith.all import factorial, binomial +from sage.arith.misc import factorial +from sage.arith.misc import binomial class SymmetricFunctionAlgebra_homogeneous(multiplicative.SymmetricFunctionAlgebra_multiplicative): diff --git a/src/sage/combinat/sf/jack.py b/src/sage/combinat/sf/jack.py index c46c78afefe..233471d1b7e 100644 --- a/src/sage/combinat/sf/jack.py +++ b/src/sage/combinat/sf/jack.py @@ -33,7 +33,8 @@ import sage.categories.all from sage.rings.integer import Integer from sage.rings.rational_field import QQ -from sage.arith.all import gcd, lcm +from sage.arith.misc import GCD as gcd +from sage.arith.functions import lcm from sage.rings.fraction_field import is_FractionField from sage.misc.misc_c import prod from sage.categories.morphism import SetMorphism diff --git a/src/sage/combinat/sf/k_dual.py b/src/sage/combinat/sf/k_dual.py index 425af1bc96f..0828cb636d3 100644 --- a/src/sage/combinat/sf/k_dual.py +++ b/src/sage/combinat/sf/k_dual.py @@ -31,7 +31,7 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from sage.categories.all import GradedHopfAlgebras +from sage.categories.graded_hopf_algebras import GradedHopfAlgebras from sage.combinat.partition import Partition, Partitions, Partitions_all_bounded, PartitionsGreatestLE from sage.combinat.free_module import CombinatorialFreeModule from sage.categories.realizations import Realizations, Category_realization_of_parent diff --git a/src/sage/combinat/sf/macdonald.py b/src/sage/combinat/sf/macdonald.py index d30339bc82d..8db4b595dae 100644 --- a/src/sage/combinat/sf/macdonald.py +++ b/src/sage/combinat/sf/macdonald.py @@ -53,7 +53,7 @@ from sage.categories.modules_with_basis import ModulesWithBasis from . import sfa from sage.combinat.partition import Partitions_n, _Partitions -from sage.matrix.all import MatrixSpace +from sage.matrix.matrix_space import MatrixSpace from sage.rings.rational_field import QQ from sage.misc.misc_c import prod from sage.misc.cachefunc import cached_function diff --git a/src/sage/combinat/sf/powersum.py b/src/sage/combinat/sf/powersum.py index f7019407840..4a960369214 100644 --- a/src/sage/combinat/sf/powersum.py +++ b/src/sage/combinat/sf/powersum.py @@ -19,7 +19,7 @@ #***************************************************************************** from . import sfa, multiplicative, classical from sage.combinat.partition import Partition -from sage.arith.all import divisors +from sage.arith.misc import divisors from sage.rings.infinity import infinity from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.misc.misc_c import prod diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 040dd78f4d3..30a6086964d 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -1013,7 +1013,8 @@ def gessel_reutenauer(self, lam): m = lam.to_exp_dict() # == {i: m_i | i occurs in lam} p = self.realization_of().power() h = self.realization_of().complete() - from sage.arith.all import moebius, squarefree_divisors + from sage.arith.misc import moebius + from sage.arith.misc import squarefree_divisors mu = moebius def component(i, g): # == h_g[L_i] @@ -1802,7 +1803,7 @@ def __init__(self, Sym, basis_name=None, prefix=None, graded=True): sage: TestSuite(s).run() """ R = Sym.base_ring() - from sage.categories.all import CommutativeRings + from sage.categories.commutative_rings import CommutativeRings if R not in CommutativeRings(): raise TypeError("argument R must be a commutative ring") try: @@ -4707,7 +4708,8 @@ def arithmetic_product(self, x): parent = self.parent() if parent.has_coerce_map_from(QQ): from sage.combinat.partition import Partition - from sage.arith.all import gcd, lcm + from sage.arith.misc import GCD as gcd + from sage.arith.functions import lcm from itertools import product, repeat, chain p = parent.realization_of().power() diff --git a/src/sage/combinat/sf/witt.py b/src/sage/combinat/sf/witt.py index 2f942af97f3..51c9598d2e5 100644 --- a/src/sage/combinat/sf/witt.py +++ b/src/sage/combinat/sf/witt.py @@ -756,7 +756,7 @@ def _precompute_p(self, n): """ l = len(self._p_transition_matrices) if l <= n: - from sage.arith.all import divisors + from sage.arith.misc import divisors from sage.combinat.partition import Partition from sage.misc.cachefunc import cached_function @@ -1148,7 +1148,7 @@ def wsum(m): # expansion of h_m in w-basis, for m > 0 return result if parent_name == "powersum": - from sage.arith.all import divisors + from sage.arith.misc import divisors from sage.combinat.partition import Partition @cached_function diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index e7c3f972ac3..b2ca90a710b 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -191,7 +191,8 @@ class type, it is also possible to compute the number of classes of that type from itertools import chain, product from sage.misc.misc_c import prod from sage.arith.misc import factorial -from sage.arith.all import moebius, divisors +from sage.arith.misc import moebius +from sage.arith.misc import divisors from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.structure.element import Element, is_Matrix from sage.structure.parent import Parent diff --git a/src/sage/combinat/skew_tableau.py b/src/sage/combinat/skew_tableau.py index 3eeae3d8d56..43b34b2b008 100644 --- a/src/sage/combinat/skew_tableau.py +++ b/src/sage/combinat/skew_tableau.py @@ -36,9 +36,9 @@ from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.rings.infinity import PlusInfinity -from sage.matrix.all import zero_matrix +from sage.matrix.special import zero_matrix from sage.structure.list_clone import ClonableList from sage.combinat.partition import Partition diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index 7878a028265..fe5ee4a9f94 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -15,7 +15,8 @@ from .species import GenericCombinatorialSpecies from .structure import GenericSpeciesStructure from sage.structure.unique_representation import UniqueRepresentation -from sage.arith.all import divisors, euler_phi +from sage.arith.misc import divisors +from sage.arith.misc import euler_phi from sage.combinat.species.misc import accept_size class CycleSpeciesStructure(GenericSpeciesStructure): diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index c6c30f301b6..a893e011171 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -53,7 +53,7 @@ from sage.rings.lazy_series_ring import LazyPowerSeriesRing, LazySymmetricFunctions from sage.rings.integer import Integer from sage.rings.rational_field import QQ -from sage.arith.all import divisors +from sage.arith.misc import divisors from sage.combinat.partition import Partition, Partitions from sage.combinat.sf.sf import SymmetricFunctions from sage.misc.cachefunc import cached_function diff --git a/src/sage/combinat/subset.py b/src/sage/combinat/subset.py index 5f3d481de68..b44051020b9 100644 --- a/src/sage/combinat/subset.py +++ b/src/sage/combinat/subset.py @@ -38,7 +38,7 @@ from sage.structure.element import Element from sage.sets.set import Set, Set_object_enumerated -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.misc.misc import _stable_uniq as uniq from sage.rings.integer_ring import ZZ from sage.rings.integer import Integer @@ -1059,7 +1059,7 @@ def cardinality(self): sage: len(S.list()) 24 """ - from sage.all import prod + from sage.misc.misc_c import prod return Integer(prod(k + 1 for k in self._d.values())) def random_element(self): diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index b8a0bebab44..2b7df01dd0a 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -21,7 +21,7 @@ from sage.categories.weyl_groups import WeylGroups from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import QQ -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector from sage.groups.perm_gps.permgroup_element import PermutationGroupElement diff --git a/src/sage/combinat/t_sequences.py b/src/sage/combinat/t_sequences.py index fb20500ab28..883d55c87bd 100644 --- a/src/sage/combinat/t_sequences.py +++ b/src/sage/combinat/t_sequences.py @@ -1,17 +1,17 @@ r""" T-sequences -T-sequences are tuples of four (-1, 0, 1) sequences of length `t` where -for every `i` exactly one sequence has a nonzero entry at index `i` -and for which the nonperiodic autocorrelation function is equal to zero +T-sequences are tuples of four (-1, 0, 1) sequences of length `t` where +for every `i` exactly one sequence has a nonzero entry at index `i` +and for which the nonperiodic autocorrelation function is equal to zero (i.e. they are complementary). See Definition 7.5 of [Seb2017]_. -These can be constructed from Turyn sequences. In particular, +These can be constructed from Turyn sequences. In particular, if Turyn sequences of length `l` exists, there will be T-sequences of length `4l-1` and `2l-1`. Turyn sequences are tuples of four (-1, +1) sequences `X, U, Y, V` of length -`l`, `l`, `l-1`, `l-1` with nonperiodic autocorrelation equal to zero and +`l`, `l`, `l-1`, `l-1` with nonperiodic autocorrelation equal to zero and the additional constraints that: * the first element of `X` is 1 @@ -55,15 +55,15 @@ def _nonperiodic_autocorrelation(sequences, j): N_X(j) = \sum_{i=1}^{n-j}(a_{1,i}a_{1,i+j} + a_{2,i}a_{2,i+j} + ... + a_{n,i}a_{n,i+j}) INPUT: - + - ``sequences`` -- either a single sequence or a list of sequences for which we want to compute the nonperiodic autocorrelation. - + - ``j`` -- integer, the parameter `j` used when calculating the nonperiodic autocorrelation. """ if not isinstance(sequences[0], list): sequences = [sequences] - + t = len(sequences[0]) result = 0 for i in range(t-j): @@ -75,7 +75,7 @@ def is_skew(seq, verbose=False): r""" Check if the given sequence is skew. - A sequence `X=\{x_1, x_2, ...,x_n\}` is defined skew (according to Definition + A sequence `X=\{x_1, x_2, ...,x_n\}` is defined skew (according to Definition 7.4 of [Seb2017]_) if `n` is even and `x_i = -x_{n-i+1}`. INPUT: @@ -121,11 +121,11 @@ def is_symmetric(seq, verbose=False): r""" Check if the given sequence is symmetric. - A sequence `X=\{x_1, x_2, ...,x_n\}` is defined symmetric (according to Definition + A sequence `X=\{x_1, x_2, ...,x_n\}` is defined symmetric (according to Definition 7.4 of [Seb2017]_) if `n` is odd and `x_i = x_{n-i+1}`. INPUT: - + - ``seq`` -- the sequence that should be checked. - ``verbose`` -- a boolean (default false). If true the function will be verbose @@ -169,14 +169,14 @@ def is_T_sequences_set(sequences, verbose=False): Check if a family of sequences is composed of T-sequences. Given 4 (-1, 0, +1) sequences, they will be T-sequences if - (Definition 7.4 of [Seb2017]_): + (Definition 7.4 of [Seb2017]_): * they have all the same length `t` * for each index `i`, exactly one sequence is nonzero at `i` * the nonperiodic autocorrelation is equal to `0` INPUT: - + - ``sequences`` -- a list of four sequences. - ``verbose`` -- a boolean (default false). If true the function will be verbose @@ -214,10 +214,10 @@ def is_T_sequences_set(sequences, verbose=False): if verbose: print(f"T-Sequence should contain 4 sequences, found {len(sequences)} instead") return False - - + + t = len(sequences[0]) - + for i in range(t): tot = 0 for seq in sequences: @@ -230,11 +230,11 @@ def is_T_sequences_set(sequences, verbose=False): if verbose: print(f"There should be exactly a nonzero element at every index, found {tot} such elemnents at index {i}") return False - + for j in range(1, t): autocorr = _nonperiodic_autocorrelation(sequences, j) if autocorr != 0: - if verbose: + if verbose: print(f"Nonperiodic autocorrelation should always be zero, found {autocorr} for parameter {j}") return False @@ -250,7 +250,7 @@ def turyn_sequences_smallcases(l, existence=False): - ``l`` -- integer, the length of the Turyn sequences. - - ``existence`` -- boolean (default False). If true, only return whether the + - ``existence`` -- boolean (default False). If true, only return whether the Turyn sequences are available for the given length. EXAMPLES: @@ -283,7 +283,7 @@ def turyn_sequences_smallcases(l, existence=False): 6: [[1, 1, 1, -1, -1, -1], [1, 1, -1, 1, -1, 1], [1, 1, -1, 1, 1], [1, 1, -1, 1, 1]], 7: [[1, 1, 1, -1, 1, 1, 1], [1, 1, -1, -1, -1, 1, -1], [1, 1, -1, 1, -1, -1], [1, 1, -1, 1, -1, -1]], 8: [[1, 1, -1, 1, -1, 1, -1, -1], [1, 1, 1, 1, -1, -1, -1, 1], [1, 1, 1, -1, 1, 1, 1], [1, -1, -1, 1, -1, -1, 1]], - 13: [[1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1], [1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1], + 13: [[1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1], [1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1], [1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1], [1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1]], 15: [[1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1], [1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1], [1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1], [1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1]], @@ -358,13 +358,13 @@ def T_sequences_construction_from_base_sequences(base_sequences, check=True): def seq_sum(seq1, seq2): return [(a+b)//2 for (a, b) in zip(seq1, seq2)] - + def seq_subtract(seq1, seq2): return [(a-b)//2 for (a, b) in zip(seq1, seq2)] def zero_seq(n): return [0 for _ in range(n)] - + X1 = Sequence(seq_sum(A, B) + zero_seq(n)) X2 = Sequence(seq_subtract(A, B) + zero_seq(n)) X3 = Sequence(zero_seq(n+p) + seq_sum(C, D)) @@ -451,19 +451,19 @@ def T_sequences_smallcases(t, existence=False, check=True): r""" Construct T-sequences for some small values of `t`. - This method will try to use the constructions defined in - :func:`T_sequences_construction_from_base_sequences` and - :func:`T_sequences_construction_from_turyn_sequences` - together with the Turyn sequences stored in :func:`turyn_sequences_smallcases`, + This method will try to use the constructions defined in + :func:`T_sequences_construction_from_base_sequences` and + :func:`T_sequences_construction_from_turyn_sequences` + together with the Turyn sequences stored in :func:`turyn_sequences_smallcases`, or base sequences created by :func:`base_sequences_smallcases`. - + This function contains also some T-sequences taken directly from [CRSKKY1989]_. INPUT: - ``t`` -- integer, the length of the T-sequences to construct. - - ``existence`` -- boolean (default false). If true, this method only returns whether a T-sequences of + - ``existence`` -- boolean (default false). If true, this method only returns whether a T-sequences of the given size can be constructed. - ``check`` -- boolean, if true (default) check that the sequences are T-sequences before returning them. @@ -471,7 +471,7 @@ def T_sequences_smallcases(t, existence=False, check=True): EXAMPLES: By default, this method returns the four T-sequences :: - + sage: from sage.combinat.t_sequences import T_sequences_smallcases, is_T_sequences_set sage: T_sequences_smallcases(9) [[1, 1, 0, 1, 0, 0, 0, 0, 0], @@ -479,7 +479,7 @@ def T_sequences_smallcases(t, existence=False, check=True): [0, 0, 0, 0, 0, 1, 0, 0, -1], [0, 0, 0, 0, 0, 0, 1, -1, 0]] - If the existence flag is passed, the method returns a boolean :: + If the existence flag is passed, the method returns a boolean :: sage: T_sequences_smallcases(9, existence=True) True @@ -530,7 +530,7 @@ def T_sequences_smallcases(t, existence=False, check=True): return True turyn_seqs = turyn_sequences_smallcases((t+1)//2) return T_sequences_construction_from_base_sequences(turyn_seqs, check=check) - + if (t+1)%4 == 0 and turyn_sequences_smallcases((t+1)//4, existence=True): if existence: return True @@ -552,8 +552,8 @@ def T_sequences_smallcases(t, existence=False, check=True): def base_sequences_construction(turyn_type_seqs, check=True): r"""Construct base sequences of length `2n-1, 2n-1, n, n` from Turyn type sequences of length `n,n,n,n-1`. - - Given Turyn type sequences `X, Y, Z, W` of length `n,n,n,n-1`, Theorem 1 of [KTR2005]_ shows that the + + Given Turyn type sequences `X, Y, Z, W` of length `n,n,n,n-1`, Theorem 1 of [KTR2005]_ shows that the following are base sequences of length `2n-1, 2n-1, n, n`: .. MATH:: @@ -563,13 +563,13 @@ def base_sequences_construction(turyn_type_seqs, check=True): B &= Z; -W \\ C &= X \\ D &= Y - \end{aligned} + \end{aligned} INPUT: - ``turyn_type_seqs`` -- The list of 4 Turyn type sequences that should be used to construct the base sequences. - - ``check`` -- boolean, if True (default) check that the resulting sequences are base sequences + - ``check`` -- boolean, if True (default) check that the resulting sequences are base sequences before returning them. OUTPUT: A list containing the four base sequences. @@ -610,7 +610,7 @@ def base_sequences_construction(turyn_type_seqs, check=True): if check: assert is_base_sequences_tuple([A, B, C, D]) - return [A, B, C, D] + return [A, B, C, D] def is_base_sequences_tuple(base_sequences, verbose=False): @@ -621,7 +621,7 @@ def is_base_sequences_tuple(base_sequences, verbose=False): .. MATH:: - N_A(j)+N_B(j)+N_C(j)+N_D(j) = 0 + N_A(j)+N_B(j)+N_C(j)+N_D(j) = 0 where `N_X(j)` is the nonperiodic autocorrelation (See definition in [KTR2005]_). @@ -633,7 +633,7 @@ def is_base_sequences_tuple(base_sequences, verbose=False): when the sequences do not satisfy the contraints. EXAMPLES:: - + sage: from sage.combinat.t_sequences import is_base_sequences_tuple sage: seqs = [[1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1],[1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1],[1, 1, -1, 1, -1, 1, -1, 1],[1, -1, -1, -1, -1, -1, -1, 1]] sage: is_base_sequences_tuple(seqs) @@ -647,7 +647,7 @@ def is_base_sequences_tuple(base_sequences, verbose=False): False TESTS: - + sage: seqs = [[1, -1], [1], [-1]] sage: is_base_sequences_tuple(seqs) False @@ -663,7 +663,7 @@ def is_base_sequences_tuple(base_sequences, verbose=False): .. SEEALSO:: - :func:`base_sequences_construction` + :func:`base_sequences_construction` """ if len(base_sequences) != 4: if verbose: @@ -676,19 +676,19 @@ def is_base_sequences_tuple(base_sequences, verbose=False): if verbose: print(f'Base sequences should have length n+p, n+p, n, n, found {len(A)}, {len(B)}, {len(C)}, {len(D)}') return False - + for seq in base_sequences: for el in seq: if abs(el) != 1: if verbose: print(f'Base sequences should only contiain -1, +1, found {el}') return False - + for j in range(1, n+p): - autocorr = _nonperiodic_autocorrelation(A, j) + _nonperiodic_autocorrelation(B, j) + _nonperiodic_autocorrelation(C, j) + _nonperiodic_autocorrelation(D, j) + autocorr = _nonperiodic_autocorrelation(A, j) + _nonperiodic_autocorrelation(B, j) + _nonperiodic_autocorrelation(C, j) + _nonperiodic_autocorrelation(D, j) if autocorr != 0: - if verbose: + if verbose: print(f"Nonperiodic autocorrelation should always be zero, found {autocorr} for parameter {j}") return False @@ -704,7 +704,7 @@ def turyn_type_sequences_smallcases(n, existence=False): - ``n`` -- integer, the length of the Turyn type sequences. - - ``existence`` -- boolean (default False). If true, only return whether the + - ``existence`` -- boolean (default False). If true, only return whether the Turyn type sequences are available for the given length. EXAMPLES: @@ -733,10 +733,10 @@ def turyn_type_sequences_smallcases(n, existence=False): The Turyn type sequences are stored in hexadecimal format. Given `n` hexadecimal digits `h_1, h_2,...,h_n`, it is possible to get the Turyn type sequences - by converting each `h_i` (`1 \le i \le n-1`) into a four digits binary number. Then, the j-th binary digit is + by converting each `h_i` (`1 \le i \le n-1`) into a four digits binary number. Then, the j-th binary digit is `0` if the i-th number in the j-th sequence is `1`, and it is `1` if the number in the sequence is -1. - For the n-th digit, it should be converted to a 3 digits binary number, and then the same mapping + For the n-th digit, it should be converted to a 3 digits binary number, and then the same mapping as before can be used (see also [BDKR2013]_). """ def convertLists(hexstring): @@ -755,7 +755,7 @@ def convertLists(hexstring): else: seqs[i].append(-1) return seqs - + db = { 2: '01', 4: '0161', @@ -781,17 +781,17 @@ def convertLists(hexstring): if n not in db: raise ValueError(f"Turyn type sequences of length {n} are not implemented yet.") - + return convertLists(db[n]) def base_sequences_smallcases(n, p, existence=False, check=True): r"""Construct base sequences of length `n+p, n+p, n, n` from available data. The function uses the construction :func:`base_sequences_construction`, together with - Turyn type sequences from :func:`turyn_type_sequences_smallcases` to construct base sequences + Turyn type sequences from :func:`turyn_type_sequences_smallcases` to construct base sequences with `p = n-1`. - Furthermore, this function uses also Turyn sequences (i.e. base sequences with `p=1`) from + Furthermore, this function uses also Turyn sequences (i.e. base sequences with `p=1`) from :func:`turyn_sequences_smallcases`. INPUT: @@ -803,13 +803,13 @@ def base_sequences_smallcases(n, p, existence=False, check=True): - ``existence`` -- boolean (default False). If True, the function will only check whether the base sequences can be constructed. - - ``check`` -- boolean, if True (default) check that the resulting sequences are base sequences + - ``check`` -- boolean, if True (default) check that the resulting sequences are base sequences before returning them. - OUTPUT: - + OUTPUT: + If ``existence`` is ``False``, the function returns a list containing the four base sequences, or raises - an error if the base sequences cannot be constructed. If ``existence`` is ``True``, the function returns a + an error if the base sequences cannot be constructed. If ``existence`` is ``True``, the function returns a boolean, which is ``True`` if the base sequences can be constructed and ``False`` otherwise. EXAMPLES:: @@ -843,9 +843,9 @@ def base_sequences_smallcases(n, p, existence=False, check=True): if existence: return p == n-1 and turyn_type_sequences_smallcases(n, existence=True) - + if p == n-1 and turyn_type_sequences_smallcases(n, existence=True): - if existence: + if existence: return True turyn_type_seqs = turyn_type_sequences_smallcases(n) return base_sequences_construction(turyn_type_seqs, check=check) @@ -853,5 +853,5 @@ def base_sequences_smallcases(n, p, existence=False, check=True): if existence: return True return turyn_sequences_smallcases(n+p) - + raise ValueError(f'Base sequences of order {n+p}, {n+p}, {n}, {n} not yet implemented.') diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index f5652f86733..deb191ea1c8 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -97,7 +97,8 @@ from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.rings.infinity import PlusInfinity -from sage.arith.all import factorial, binomial +from sage.arith.misc import factorial +from sage.arith.misc import binomial from sage.arith.misc import multinomial from sage.rings.integer import Integer from sage.combinat.composition import Composition, Compositions diff --git a/src/sage/combinat/tableau_tuple.py b/src/sage/combinat/tableau_tuple.py index 3deb562bbb6..29f1aae0bd7 100644 --- a/src/sage/combinat/tableau_tuple.py +++ b/src/sage/combinat/tableau_tuple.py @@ -228,7 +228,7 @@ from sage.misc.lazy_attribute import lazy_attribute from sage.misc.misc_c import prod from sage.misc.prandom import randint -from sage.arith.all import factorial +from sage.arith.misc import factorial from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.rings.integer import Integer from sage.rings.semirings.non_negative_integer_semiring import NN diff --git a/src/sage/combinat/tamari_lattices.py b/src/sage/combinat/tamari_lattices.py index c08b1348e44..ba4de2ad8fb 100644 --- a/src/sage/combinat/tamari_lattices.py +++ b/src/sage/combinat/tamari_lattices.py @@ -48,7 +48,7 @@ # **************************************************************************** from __future__ import annotations from sage.combinat.posets.lattices import LatticePoset, MeetSemilattice -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd def paths_in_triangle(i, j, a, b) -> list[tuple[int, ...]]: diff --git a/src/sage/combinat/words/lyndon_word.py b/src/sage/combinat/words/lyndon_word.py index ca271c5a114..3e2987fb811 100644 --- a/src/sage/combinat/words/lyndon_word.py +++ b/src/sage/combinat/words/lyndon_word.py @@ -17,7 +17,10 @@ from sage.combinat.composition import Composition, Compositions from sage.rings.integer import Integer -from sage.arith.all import divisors, gcd, moebius, multinomial +from sage.arith.misc import divisors +from sage.arith.misc import GCD as gcd +from sage.arith.misc import moebius +from sage.arith.misc import multinomial from sage.combinat.necklace import _sfc from sage.combinat.words.words import FiniteWords diff --git a/src/sage/combinat/words/morphism.py b/src/sage/combinat/words/morphism.py index fbeb8cd749a..a9044f3cd44 100644 --- a/src/sage/combinat/words/morphism.py +++ b/src/sage/combinat/words/morphism.py @@ -3003,7 +3003,7 @@ def rauzy_fractal_plot(self, n=None, exchange=False, eig=None, # 1D plots if dim_fractal == 1: - from sage.all import plot + from sage.plot.plot import plot for a in col_dict: # We plot only the points with a color in col_dict and with positive opacity if (a in col_dict) and (opacity[a] > 0): diff --git a/src/sage/combinat/words/paths.py b/src/sage/combinat/words/paths.py index 3d0ee41a4c4..9d35fe149ee 100644 --- a/src/sage/combinat/words/paths.py +++ b/src/sage/combinat/words/paths.py @@ -1226,7 +1226,7 @@ def tikz_trajectory(self): '(0.000, 0.000) -- (1.00, 0.000) -- (1.50, 0.866) -- (1.00, 1.73) -- (0.000, 1.73) -- (-0.500, 0.866)' """ - from sage.all import n + from sage.misc.functional import N as n f = lambda x: n(x,digits=3) l = [str(tuple(map(f, pt))) for pt in self.points()] return ' -- '.join(l) diff --git a/src/sage/combinat/words/shuffle_product.py b/src/sage/combinat/words/shuffle_product.py index 101e7ca695c..7363d642126 100644 --- a/src/sage/combinat/words/shuffle_product.py +++ b/src/sage/combinat/words/shuffle_product.py @@ -22,7 +22,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** from sage.combinat.words.word import Word_class, Word -from sage.arith.all import binomial +from sage.arith.misc import binomial from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.combinat.integer_vector import IntegerVectors from sage.combinat.composition import Composition diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index b485205878f..b08766fda79 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -66,7 +66,7 @@ from sage.combinat.words.finite_word import FiniteWord_class, Factorization from sage.combinat.words.words import FiniteWords, InfiniteWords from sage.combinat.words.morphism import WordMorphism -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from sage.misc.decorators import rename_keyword diff --git a/src/sage/matroids/basis_matroid.pyx b/src/sage/matroids/basis_matroid.pyx index ff70add1ce2..042f529fedc 100644 --- a/src/sage/matroids/basis_matroid.pyx +++ b/src/sage/matroids/basis_matroid.pyx @@ -79,7 +79,7 @@ from .basis_exchange_matroid cimport BasisExchangeMatroid from .set_system cimport SetSystem from cpython.object cimport Py_EQ, Py_NE -from sage.arith.all import binomial +from sage.arith.misc import binomial from itertools import permutations, combinations diff --git a/src/sage/matroids/constructor.py b/src/sage/matroids/constructor.py index 1fb2cd2b93e..ea3bd181f0c 100644 --- a/src/sage/matroids/constructor.py +++ b/src/sage/matroids/constructor.py @@ -107,7 +107,8 @@ from sage.structure.element import is_Matrix from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.categories.all import Fields, Rings +from sage.categories.fields import Fields +from sage.categories.rings import Rings from sage.rings.finite_rings.finite_field_base import FiniteField import sage.matroids.matroid import sage.matroids.basis_exchange_matroid diff --git a/src/sage/matroids/extension.pyx b/src/sage/matroids/extension.pyx index 0408e60f86e..04ccf9ec61f 100644 --- a/src/sage/matroids/extension.pyx +++ b/src/sage/matroids/extension.pyx @@ -31,7 +31,7 @@ Methods from sage.data_structures.bitset_base cimport * from .basis_matroid cimport BasisMatroid -from sage.arith.all import binomial +from sage.arith.misc import binomial cdef class CutNode: diff --git a/src/sage/matroids/lean_matrix.pyx b/src/sage/matroids/lean_matrix.pyx index 6b3cf27bcf2..bb8f1012f19 100644 --- a/src/sage/matroids/lean_matrix.pyx +++ b/src/sage/matroids/lean_matrix.pyx @@ -37,7 +37,10 @@ from cysignals.signals cimport sig_on, sig_off from sage.data_structures.bitset_base cimport * from sage.matrix.matrix2 cimport Matrix -from sage.rings.all import ZZ, FiniteField, GF, QQ +from sage.rings.integer_ring import Z as ZZ +from sage.rings.finite_rings.finite_field_constructor import FiniteField +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.rings.rational_field import Q as QQ from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational from sage.libs.gmp.mpq cimport * diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index 0c9b0a1baff..e6ae08e0e79 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -129,7 +129,10 @@ from sage.matrix.matrix2 cimport Matrix import sage.matrix.constructor from sage.matrix.constructor import matrix from copy import copy, deepcopy -from sage.rings.all import ZZ, QQ, FiniteField, GF +from sage.rings.integer_ring import Z as ZZ +from sage.rings.rational_field import Q as QQ +from sage.rings.finite_rings.finite_field_constructor import FiniteField +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF import itertools from itertools import combinations, product From bd50b49973d38726fee0fb92d99e62ab2ef31978 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 29 Jan 2023 17:48:32 -0800 Subject: [PATCH 2/7] git grep -l -E ' (Q as QQ|Z as ZZ)' | xargs sed -i.bak 's/ Q as QQ/ QQ/;s/ Z as ZZ/ ZZ/;' --- src/sage/matroids/lean_matrix.pyx | 4 ++-- src/sage/matroids/linear_matroid.pyx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/matroids/lean_matrix.pyx b/src/sage/matroids/lean_matrix.pyx index bb8f1012f19..70510e53797 100644 --- a/src/sage/matroids/lean_matrix.pyx +++ b/src/sage/matroids/lean_matrix.pyx @@ -37,10 +37,10 @@ from cysignals.signals cimport sig_on, sig_off from sage.data_structures.bitset_base cimport * from sage.matrix.matrix2 cimport Matrix -from sage.rings.integer_ring import Z as ZZ +from sage.rings.integer_ring import ZZ from sage.rings.finite_rings.finite_field_constructor import FiniteField from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF -from sage.rings.rational_field import Q as QQ +from sage.rings.rational_field import QQ from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational from sage.libs.gmp.mpq cimport * diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index e6ae08e0e79..a0e41b0046c 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -129,8 +129,8 @@ from sage.matrix.matrix2 cimport Matrix import sage.matrix.constructor from sage.matrix.constructor import matrix from copy import copy, deepcopy -from sage.rings.integer_ring import Z as ZZ -from sage.rings.rational_field import Q as QQ +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ from sage.rings.finite_rings.finite_field_constructor import FiniteField from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF import itertools From 8e77597c00f4f9c563f658940e0df422b174e25b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 29 Jan 2023 18:15:43 -0800 Subject: [PATCH 3/7] sage.{algebras,combinat}: Consolidate imports from the same module --- .../algebras/quatalg/quaternion_algebra.py | 12 ++--- .../combinat/binary_recurrence_sequences.py | 5 +- .../combinat/cluster_algebra_quiver/quiver.py | 3 +- .../quiver_mutation_type.py | 3 +- src/sage/combinat/combinat.py | 3 +- src/sage/combinat/designs/bibd.py | 3 +- src/sage/combinat/designs/block_design.py | 6 +-- .../combinat/designs/difference_matrices.py | 3 +- src/sage/combinat/matrices/hadamard_matrix.py | 23 ++++----- src/sage/combinat/necklace.py | 14 ++---- src/sage/combinat/partition.py | 6 +-- src/sage/combinat/partition_algebra.py | 16 +++---- src/sage/combinat/permutation.py | 48 +++++++++---------- src/sage/combinat/set_partition_ordered.py | 3 +- src/sage/combinat/sf/character.py | 8 ++-- src/sage/combinat/sf/elementary.py | 7 +-- src/sage/combinat/sf/homogeneous.py | 8 ++-- src/sage/combinat/sf/sfa.py | 3 +- src/sage/combinat/similarity_class_type.py | 27 ++++++----- src/sage/combinat/species/cycle_species.py | 9 ++-- src/sage/combinat/tableau.py | 23 +++++---- src/sage/combinat/words/lyndon_word.py | 18 +++---- 22 files changed, 114 insertions(+), 137 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 0e4b1e979a8..768779a561c 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -35,12 +35,12 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.misc import hilbert_conductor_inverse -from sage.arith.misc import hilbert_conductor -from sage.arith.misc import factor -from sage.arith.misc import GCD as gcd -from sage.arith.misc import kronecker as kronecker_symbol -from sage.arith.misc import valuation +from sage.arith.misc import (hilbert_conductor_inverse, + hilbert_conductor, + factor, + GCD as gcd, + kronecker as kronecker_symbol, + valuation) from sage.rings.real_mpfr import RR from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ diff --git a/src/sage/combinat/binary_recurrence_sequences.py b/src/sage/combinat/binary_recurrence_sequences.py index ecfcc2ccd4e..b119bc3c193 100644 --- a/src/sage/combinat/binary_recurrence_sequences.py +++ b/src/sage/combinat/binary_recurrence_sequences.py @@ -66,10 +66,7 @@ from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.integer import Integer from sage.arith.functions import lcm -from sage.arith.misc import next_prime -from sage.arith.misc import is_prime -from sage.arith.misc import next_prime_power -from sage.arith.misc import legendre_symbol +from sage.arith.misc import is_prime, next_prime, next_prime_power, legendre_symbol from sage.functions.log import log from sage.misc.functional import sqrt diff --git a/src/sage/combinat/cluster_algebra_quiver/quiver.py b/src/sage/combinat/cluster_algebra_quiver/quiver.py index 52156babeb2..f5a43793612 100644 --- a/src/sage/combinat/cluster_algebra_quiver/quiver.py +++ b/src/sage/combinat/cluster_algebra_quiver/quiver.py @@ -558,8 +558,7 @@ def plot(self, circular=True, center=(0, 0), directed=True, mark=None, """ from sage.plot.colors import rainbow from sage.graphs.graph_generators import GraphGenerators - from sage.symbolic.constants import e - from sage.symbolic.constants import pi + from sage.symbolic.constants import e, pi from sage.rings.imaginary_unit import I graphs = GraphGenerators() # returns positions for graph vertices on two concentric cycles with radius 1 and 2 diff --git a/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py b/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py index 59ebbfc9c07..13349acbb42 100644 --- a/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +++ b/src/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py @@ -27,8 +27,7 @@ from sage.rings.infinity import infinity from sage.graphs.digraph import DiGraph from sage.graphs.graph import Graph -from sage.arith.misc import binomial -from sage.arith.misc import euler_phi +from sage.arith.misc import binomial, euler_phi from sage.misc.misc_c import prod from sage.matrix.constructor import matrix diff --git a/src/sage/combinat/combinat.py b/src/sage/combinat/combinat.py index fb125cf49aa..e94d4533356 100644 --- a/src/sage/combinat/combinat.py +++ b/src/sage/combinat/combinat.py @@ -167,12 +167,11 @@ from __future__ import annotations from typing import Iterator +from sage.arith.misc import bernoulli, factorial from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.integer import Integer from sage.rings.infinity import infinity -from sage.arith.misc import bernoulli -from sage.arith.misc import factorial from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.libs.pari.all import pari diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index 996ab02a584..ad25d270dfc 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -53,8 +53,7 @@ from sage.categories.sets_cat import EmptySetError from sage.misc.unknown import Unknown from .design_catalog import transversal_design # type:ignore -from sage.arith.misc import binomial -from sage.arith.misc import is_prime_power +from sage.arith.misc import binomial, is_prime_power from .group_divisible_designs import GroupDivisibleDesign from .designs_pyx import is_pairwise_balanced_design diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index 884cafd003e..6e1c58f0224 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -52,15 +52,13 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ #***************************************************************************** +from sage.arith.misc import binomial, integer_floor, is_prime_power +from sage.categories.sets_cat import EmptySetError from sage.modules.free_module import VectorSpace from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ -from sage.arith.misc import binomial -from sage.arith.misc import integer_floor -from sage.arith.misc import is_prime_power from .incidence_structures import IncidenceStructure from sage.rings.finite_rings.finite_field_constructor import FiniteField -from sage.categories.sets_cat import EmptySetError from sage.misc.unknown import Unknown from sage.matrix.matrix_space import MatrixSpace from sage.libs.gap.libgap import libgap diff --git a/src/sage/combinat/designs/difference_matrices.py b/src/sage/combinat/designs/difference_matrices.py index 72b935e0f94..9e27b4688c4 100644 --- a/src/sage/combinat/designs/difference_matrices.py +++ b/src/sage/combinat/designs/difference_matrices.py @@ -10,12 +10,11 @@ --------- """ +from sage.arith.misc import divisors, is_prime_power from sage.misc.unknown import Unknown from sage.misc.cachefunc import cached_function from sage.categories.sets_cat import EmptySetError from sage.rings.finite_rings.finite_field_constructor import FiniteField -from sage.arith.misc import is_prime_power -from sage.arith.misc import divisors from .designs_pyx import is_difference_matrix from .database import DM as DM_constructions diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index 4b6ddf75321..d5fb2b29648 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -54,22 +54,23 @@ # https://www.gnu.org/licenses/ #***************************************************************************** +from math import sqrt from urllib.request import urlopen -from sage.combinat.designs.difference_family import skew_supplementary_difference_set +from sage.arith.misc import divisors, is_prime_power, is_square +from sage.combinat.designs.difference_family import skew_supplementary_difference_set +from sage.combinat.t_sequences import T_sequences_smallcases +from sage.cpython.string import bytes_to_str from sage.rings.integer_ring import ZZ -from sage.matrix.constructor import matrix, block_matrix, block_diagonal_matrix, diagonal_matrix -from sage.arith.misc import is_square -from sage.arith.misc import is_prime_power -from sage.arith.misc import divisors -from math import sqrt -from sage.matrix.constructor import identity_matrix as I -from sage.matrix.constructor import ones_matrix as J -from sage.matrix.constructor import zero_matrix +from sage.matrix.constructor import (block_matrix, + block_diagonal_matrix, + diagonal_matrix, + identity_matrix as I, + ones_matrix as J, + matrix, + zero_matrix) from sage.misc.unknown import Unknown -from sage.cpython.string import bytes_to_str from sage.modules.free_module_element import vector -from sage.combinat.t_sequences import T_sequences_smallcases def normalise_hadamard(H): diff --git a/src/sage/combinat/necklace.py b/src/sage/combinat/necklace.py index ef38833b29e..e6c4e6b03ec 100644 --- a/src/sage/combinat/necklace.py +++ b/src/sage/combinat/necklace.py @@ -22,18 +22,14 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.combinat.composition import Composition +from sage.arith.misc import divisors, euler_phi, factorial, GCD as gcd from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets -from sage.structure.parent import Parent -from sage.structure.unique_representation import UniqueRepresentation -from sage.arith.misc import euler_phi -from sage.arith.misc import factorial -from sage.arith.misc import divisors -from sage.arith.misc import GCD as gcd -from sage.rings.integer_ring import ZZ +from sage.combinat.composition import Composition +from sage.combinat.misc import DoublyLinkedList from sage.rings.integer import Integer from sage.misc.misc_c import prod -from sage.combinat.misc import DoublyLinkedList +from sage.structure.parent import Parent +from sage.structure.unique_representation import UniqueRepresentation def Necklaces(content): diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 367299a4e60..ddec0ba38fb 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -283,10 +283,9 @@ from copy import copy from itertools import accumulate +from sage.arith.misc import binomial, factorial, GCD as gcd, multinomial from sage.libs.pari.all import pari from sage.libs.flint.arith import number_of_partitions as flint_number_of_partitions - -from sage.arith.misc import multinomial from sage.structure.global_options import GlobalOptions from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation @@ -308,8 +307,6 @@ from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.semirings.non_negative_integer_semiring import NN -from sage.arith.misc import factorial -from sage.arith.misc import GCD as gcd from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.integer import Integer from sage.rings.infinity import infinity @@ -327,7 +324,6 @@ from sage.combinat.combinatorial_map import combinatorial_map from sage.groups.perm_gps.permgroup import PermutationGroup from sage.graphs.dot2tex_utils import have_dot2tex -from sage.arith.misc import binomial class Partition(CombinatorialElement): diff --git a/src/sage/combinat/partition_algebra.py b/src/sage/combinat/partition_algebra.py index 789a214f365..fe2bcbe7c10 100644 --- a/src/sage/combinat/partition_algebra.py +++ b/src/sage/combinat/partition_algebra.py @@ -15,19 +15,19 @@ # # https://www.gnu.org/licenses/ # **************************************************************************** -from .combinat import catalan_number -from sage.combinat.free_module import CombinatorialFreeModule +from sage.arith.misc import binomial, factorial from sage.categories.algebras_with_basis import AlgebrasWithBasis -from sage.combinat.set_partition import SetPartition, SetPartitions, SetPartitions_set -from sage.sets.set import Set, Set_generic +from sage.functions.all import ceil from sage.graphs.graph import Graph -from sage.arith.misc import factorial -from sage.arith.misc import binomial -from .permutation import Permutations from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ +from sage.sets.set import Set, Set_generic + +from .combinat import catalan_number +from .free_module import CombinatorialFreeModule +from .permutation import Permutations +from .set_partition import SetPartition, SetPartitions, SetPartitions_set from .subset import Subsets -from sage.functions.all import ceil def _int_or_half_int(k): diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 38a8270d1ca..b0f4fc7511c 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -239,38 +239,38 @@ # **************************************************************************** from __future__ import annotations from typing import Iterator +import itertools -from sage.structure.parent import Parent -from sage.structure.unique_representation import UniqueRepresentation -from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets +from sage.arith.misc import factorial, multinomial from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets -from sage.categories.sets_with_grading import SetsWithGrading -from sage.categories.finite_weyl_groups import FiniteWeylGroups from sage.categories.finite_permutation_groups import FinitePermutationGroups -from sage.structure.list_clone import ClonableArray -from sage.structure.global_options import GlobalOptions +from sage.categories.finite_weyl_groups import FiniteWeylGroups +from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets +from sage.categories.sets_with_grading import SetsWithGrading +from sage.graphs.digraph import DiGraph +from sage.groups.perm_gps.permgroup_element import PermutationGroupElement +from sage.groups.perm_gps.permgroup_named import SymmetricGroup from sage.libs.gap.libgap import libgap +from sage.matrix.matrix_space import MatrixSpace +from sage.misc.cachefunc import cached_method +from sage.misc.prandom import sample from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.arith.misc import factorial -from sage.arith.misc import multinomial -from sage.matrix.matrix_space import MatrixSpace -from sage.combinat.tools import transitive_ideal -from sage.combinat.composition import Composition -from sage.groups.perm_gps.permgroup_named import SymmetricGroup -from sage.groups.perm_gps.permgroup_element import PermutationGroupElement -from sage.misc.prandom import sample -from sage.graphs.digraph import DiGraph -import itertools -from .combinat import CombinatorialElement, catalan_number -from sage.misc.cachefunc import cached_method +from sage.structure.global_options import GlobalOptions +from sage.structure.list_clone import ClonableArray +from sage.structure.parent import Parent +from sage.structure.unique_representation import UniqueRepresentation + from .backtrack import GenericBacktracker -from sage.combinat.combinatorial_map import combinatorial_map -from sage.combinat.rsk import RSK, RSK_inverse -from sage.combinat.permutation_cython import (left_action_product, - right_action_product, left_action_same_n, right_action_same_n, - map_to_list, next_perm) +from .combinat import CombinatorialElement, catalan_number +from .combinatorial_map import combinatorial_map +from .composition import Composition +from .permutation_cython import (left_action_product, right_action_product, + left_action_same_n, right_action_same_n, + map_to_list, next_perm) +from .rsk import RSK, RSK_inverse +from .tools import transitive_ideal class Permutation(CombinatorialElement): diff --git a/src/sage/combinat/set_partition_ordered.py b/src/sage/combinat/set_partition_ordered.py index 3c6dcbb383c..8d220d525e6 100644 --- a/src/sage/combinat/set_partition_ordered.py +++ b/src/sage/combinat/set_partition_ordered.py @@ -24,8 +24,7 @@ # # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.misc import factorial -from sage.arith.misc import multinomial +from sage.arith.misc import factorial, multinomial from sage.categories.cartesian_product import cartesian_product from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets diff --git a/src/sage/combinat/sf/character.py b/src/sage/combinat/sf/character.py index b57874ad832..6abf5147c4f 100644 --- a/src/sage/combinat/sf/character.py +++ b/src/sage/combinat/sf/character.py @@ -27,13 +27,11 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.combinat.sf.sfa import SymmetricFunctionAlgebra_generic as SFA_generic -from sage.misc.cachefunc import cached_method +from sage.arith.misc import binomial, divisors, moebius from sage.categories.homset import Hom from sage.categories.morphism import SetMorphism -from sage.arith.misc import divisors -from sage.arith.misc import moebius -from sage.arith.misc import binomial +from sage.combinat.sf.sfa import SymmetricFunctionAlgebra_generic as SFA_generic +from sage.misc.cachefunc import cached_method from sage.rings.integer import Integer diff --git a/src/sage/combinat/sf/elementary.py b/src/sage/combinat/sf/elementary.py index 3ed3db345d5..2e30e1dbe58 100644 --- a/src/sage/combinat/sf/elementary.py +++ b/src/sage/combinat/sf/elementary.py @@ -17,13 +17,14 @@ # # http://www.gnu.org/licenses/ #***************************************************************************** -from . import multiplicative, classical +from sage.arith.misc import binomial, factorial from sage.combinat.partition import Partition from sage.misc.misc_c import prod -from sage.arith.misc import factorial -from sage.arith.misc import binomial from sage.rings.infinity import infinity +from . import multiplicative, classical + + ################################### # # # Elementary Symmetric Functions # diff --git a/src/sage/combinat/sf/homogeneous.py b/src/sage/combinat/sf/homogeneous.py index 42c6aeb55ad..2f92100559f 100644 --- a/src/sage/combinat/sf/homogeneous.py +++ b/src/sage/combinat/sf/homogeneous.py @@ -25,12 +25,12 @@ # Homogeneous Symmetric Functions # # # #################################### -from . import multiplicative, classical +from sage.arith.misc import binomial, factorial from sage.combinat.partition import Partition -from sage.rings.infinity import infinity from sage.misc.misc_c import prod -from sage.arith.misc import factorial -from sage.arith.misc import binomial +from sage.rings.infinity import infinity + +from . import multiplicative, classical class SymmetricFunctionAlgebra_homogeneous(multiplicative.SymmetricFunctionAlgebra_multiplicative): diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 30a6086964d..31eef1bf2ab 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -1013,8 +1013,7 @@ def gessel_reutenauer(self, lam): m = lam.to_exp_dict() # == {i: m_i | i occurs in lam} p = self.realization_of().power() h = self.realization_of().complete() - from sage.arith.misc import moebius - from sage.arith.misc import squarefree_divisors + from sage.arith.misc import moebius, squarefree_divisors mu = moebius def component(i, g): # == h_g[L_i] diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index b2ca90a710b..64e128477df 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -189,23 +189,24 @@ class type, it is also possible to compute the number of classes of that type # **************************************************************************** from itertools import chain, product -from sage.misc.misc_c import prod -from sage.arith.misc import factorial -from sage.arith.misc import moebius -from sage.arith.misc import divisors -from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass -from sage.structure.element import Element, is_Matrix -from sage.structure.parent import Parent -from sage.structure.unique_representation import UniqueRepresentation + +from sage.arith.misc import divisors, factorial, moebius from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets -from sage.combinat.combinat import CombinatorialElement -from sage.combinat.partition import Partitions, Partition +from sage.misc.cachefunc import cached_in_parent_method, cached_function +from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass +from sage.misc.misc_c import prod from sage.rings.fraction_field import FractionField from sage.rings.integer_ring import ZZ -from sage.rings.rational_field import QQ -from sage.misc.cachefunc import cached_in_parent_method, cached_function -from sage.combinat.misc import IterableFunctionCall from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.rational_field import QQ +from sage.structure.element import Element, is_Matrix +from sage.structure.parent import Parent +from sage.structure.unique_representation import UniqueRepresentation + +from .combinat import CombinatorialElement +from .misc import IterableFunctionCall +from .partition import Partitions, Partition + @cached_function def fq(n, q=None): diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index fe5ee4a9f94..d9d18b4ec44 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -12,12 +12,13 @@ # http://www.gnu.org/licenses/ #***************************************************************************** +from sage.arith.misc import divisors, euler_phi +from sage.structure.unique_representation import UniqueRepresentation + +from .misc import accept_size from .species import GenericCombinatorialSpecies from .structure import GenericSpeciesStructure -from sage.structure.unique_representation import UniqueRepresentation -from sage.arith.misc import divisors -from sage.arith.misc import euler_phi -from sage.combinat.species.misc import accept_size + class CycleSpeciesStructure(GenericSpeciesStructure): def __repr__(self): diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index deb191ea1c8..8a3c53765b4 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -85,6 +85,12 @@ # https://www.gnu.org/licenses/ # **************************************************************************** from itertools import repeat + +from sage.arith.misc import binomial, factorial, multinomial +from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets +from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets +from sage.categories.sets_cat import Sets +from sage.groups.perm_gps.permgroup import PermutationGroup from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets from sage.sets.family import Family from sage.sets.non_negative_integers import NonNegativeIntegers @@ -97,24 +103,17 @@ from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.rings.infinity import PlusInfinity -from sage.arith.misc import factorial -from sage.arith.misc import binomial -from sage.arith.misc import multinomial from sage.rings.integer import Integer -from sage.combinat.composition import Composition, Compositions -from sage.combinat.integer_vector import IntegerVectors, integer_vectors_nk_fast_iter import sage.libs.symmetrica.all as symmetrica import sage.misc.prandom as random -from sage.combinat import permutation -from sage.groups.perm_gps.permgroup import PermutationGroup from sage.misc.misc_c import prod from sage.misc.misc import powerset -from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets -from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets -from sage.categories.sets_cat import Sets -from sage.combinat.combinatorial_map import combinatorial_map -from sage.combinat.posets.posets import Poset +from . import permutation +from .combinatorial_map import combinatorial_map +from .composition import Composition, Compositions +from .integer_vector import IntegerVectors, integer_vectors_nk_fast_iter +from .posets.posets import Poset @richcmp_method diff --git a/src/sage/combinat/words/lyndon_word.py b/src/sage/combinat/words/lyndon_word.py index 3e2987fb811..1d5614cd277 100644 --- a/src/sage/combinat/words/lyndon_word.py +++ b/src/sage/combinat/words/lyndon_word.py @@ -12,20 +12,16 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.structure.unique_representation import UniqueRepresentation -from sage.structure.parent import Parent - +from sage.arith.misc import divisors, GCD as gcd, moebius, multinomial +from sage.combinat.combinat_cython import lyndon_word_iterator from sage.combinat.composition import Composition, Compositions +from sage.combinat.necklace import _sfc from sage.rings.integer import Integer -from sage.arith.misc import divisors -from sage.arith.misc import GCD as gcd -from sage.arith.misc import moebius -from sage.arith.misc import multinomial +from sage.structure.parent import Parent +from sage.structure.unique_representation import UniqueRepresentation -from sage.combinat.necklace import _sfc -from sage.combinat.words.words import FiniteWords -from sage.combinat.words.finite_word import FiniteWord_class -from sage.combinat.combinat_cython import lyndon_word_iterator +from .finite_word import FiniteWord_class +from .words import FiniteWords def LyndonWords(e=None, k=None): From ed1ee83286bd370448b27f6386c63db374920807 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 14 Feb 2023 11:23:30 -0800 Subject: [PATCH 4/7] src/sage/combinat/necklace.py: Add missing import --- src/sage/combinat/necklace.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/combinat/necklace.py b/src/sage/combinat/necklace.py index e6c4e6b03ec..97bd24f8250 100644 --- a/src/sage/combinat/necklace.py +++ b/src/sage/combinat/necklace.py @@ -26,8 +26,9 @@ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.combinat.composition import Composition from sage.combinat.misc import DoublyLinkedList -from sage.rings.integer import Integer from sage.misc.misc_c import prod +from sage.rings.integer import Integer +from sage.rings.integer_ring import ZZ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation From 10d2e1cca9684b5306dcc4473f6cb9f3913800f1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 14 Feb 2023 11:29:47 -0800 Subject: [PATCH 5/7] git grep -l 'GCD as gcd' src/sage/{algebras,combinat,matroids} | xargs sed -i.bak 's/GCD as gcd/gcd/' --- src/sage/algebras/quatalg/quaternion_algebra.py | 2 +- src/sage/combinat/ncsf_qsym/qsym.py | 2 +- src/sage/combinat/necklace.py | 2 +- src/sage/combinat/partition.py | 2 +- src/sage/combinat/sf/jack.py | 2 +- src/sage/combinat/sf/sfa.py | 2 +- src/sage/combinat/tamari_lattices.py | 2 +- src/sage/combinat/words/lyndon_word.py | 2 +- src/sage/combinat/words/word_generators.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 768779a561c..185fd3f4baf 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -38,7 +38,7 @@ from sage.arith.misc import (hilbert_conductor_inverse, hilbert_conductor, factor, - GCD as gcd, + gcd, kronecker as kronecker_symbol, valuation) from sage.rings.real_mpfr import RR diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index 04a27e7e0ca..8bdef2fa7dd 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -3688,7 +3688,7 @@ def _precompute_M(self, n): M = self.realization_of().M() if l <= n: from sage.misc.cachefunc import cached_function - from sage.arith.misc import GCD as gcd + from sage.arith.misc import gcd @cached_function def monolambda(I): diff --git a/src/sage/combinat/necklace.py b/src/sage/combinat/necklace.py index 97bd24f8250..bcfb0d45185 100644 --- a/src/sage/combinat/necklace.py +++ b/src/sage/combinat/necklace.py @@ -22,7 +22,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.misc import divisors, euler_phi, factorial, GCD as gcd +from sage.arith.misc import divisors, euler_phi, factorial, gcd from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.combinat.composition import Composition from sage.combinat.misc import DoublyLinkedList diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index c4d45ae16c0..5dcea144623 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -283,7 +283,7 @@ from copy import copy from itertools import accumulate -from sage.arith.misc import binomial, factorial, GCD as gcd, multinomial +from sage.arith.misc import binomial, factorial, gcd, multinomial from sage.libs.pari.all import pari from sage.libs.flint.arith import number_of_partitions as flint_number_of_partitions from sage.structure.global_options import GlobalOptions diff --git a/src/sage/combinat/sf/jack.py b/src/sage/combinat/sf/jack.py index 2884786f4d6..7c067bcdf03 100644 --- a/src/sage/combinat/sf/jack.py +++ b/src/sage/combinat/sf/jack.py @@ -33,7 +33,7 @@ import sage.categories.all from sage.rings.integer import Integer from sage.rings.rational_field import QQ -from sage.arith.misc import GCD as gcd +from sage.arith.misc import gcd from sage.arith.functions import lcm from sage.rings.fraction_field import is_FractionField from sage.misc.misc_c import prod diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 8f6c7807a2e..6a2fc0412d8 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -4711,7 +4711,7 @@ def arithmetic_product(self, x): parent = self.parent() if parent.has_coerce_map_from(QQ): from sage.combinat.partition import Partition - from sage.arith.misc import GCD as gcd + from sage.arith.misc import gcd from sage.arith.functions import lcm from itertools import product, repeat, chain p = parent.realization_of().power() diff --git a/src/sage/combinat/tamari_lattices.py b/src/sage/combinat/tamari_lattices.py index ba4de2ad8fb..6ef7dd06cdc 100644 --- a/src/sage/combinat/tamari_lattices.py +++ b/src/sage/combinat/tamari_lattices.py @@ -48,7 +48,7 @@ # **************************************************************************** from __future__ import annotations from sage.combinat.posets.lattices import LatticePoset, MeetSemilattice -from sage.arith.misc import GCD as gcd +from sage.arith.misc import gcd def paths_in_triangle(i, j, a, b) -> list[tuple[int, ...]]: diff --git a/src/sage/combinat/words/lyndon_word.py b/src/sage/combinat/words/lyndon_word.py index 1d5614cd277..2a28f615a2c 100644 --- a/src/sage/combinat/words/lyndon_word.py +++ b/src/sage/combinat/words/lyndon_word.py @@ -12,7 +12,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.misc import divisors, GCD as gcd, moebius, multinomial +from sage.arith.misc import divisors, gcd, moebius, multinomial from sage.combinat.combinat_cython import lyndon_word_iterator from sage.combinat.composition import Composition, Compositions from sage.combinat.necklace import _sfc diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index b08766fda79..66c5f25eda7 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -66,7 +66,7 @@ from sage.combinat.words.finite_word import FiniteWord_class, Factorization from sage.combinat.words.words import FiniteWords, InfiniteWords from sage.combinat.words.morphism import WordMorphism -from sage.arith.misc import GCD as gcd +from sage.arith.misc import gcd from sage.misc.decorators import rename_keyword From 29ad54e19521db0c0f14283f03dec47dea6d6e03 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 16 Feb 2023 10:16:40 -0800 Subject: [PATCH 6/7] Replace relative imports by absolute imports because pytest --- src/sage/combinat/partition_algebra.py | 11 ++++---- src/sage/combinat/permutation.py | 19 ++++++------- src/sage/combinat/sf/elementary.py | 3 +- src/sage/combinat/sf/homogeneous.py | 3 +- src/sage/combinat/similarity_class_type.py | 8 ++---- src/sage/combinat/species/cycle_species.py | 8 ++---- src/sage/combinat/tableau.py | 32 +++++++++++----------- src/sage/combinat/words/lyndon_word.py | 5 ++-- 8 files changed, 40 insertions(+), 49 deletions(-) diff --git a/src/sage/combinat/partition_algebra.py b/src/sage/combinat/partition_algebra.py index 2b5ab365f6e..9136b682c59 100644 --- a/src/sage/combinat/partition_algebra.py +++ b/src/sage/combinat/partition_algebra.py @@ -17,18 +17,17 @@ # **************************************************************************** from sage.arith.misc import binomial, factorial from sage.categories.algebras_with_basis import AlgebrasWithBasis +from sage.combinat.combinat import catalan_number +from sage.combinat.free_module import CombinatorialFreeModule +from sage.combinat.permutation import Permutations +from sage.combinat.set_partition import SetPartition, SetPartitions, SetPartitions_set +from sage.combinat.subset import Subsets from sage.functions.all import ceil from sage.graphs.graph import Graph from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.sets.set import Set, Set_generic -from .combinat import catalan_number -from .free_module import CombinatorialFreeModule -from .permutation import Permutations -from .set_partition import SetPartition, SetPartitions, SetPartitions_set -from .subset import Subsets - def _int_or_half_int(k): r""" diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index fb780da0e2c..a483d63200f 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -247,6 +247,15 @@ from sage.categories.finite_weyl_groups import FiniteWeylGroups from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets from sage.categories.sets_with_grading import SetsWithGrading +from sage.combinat.backtrack import GenericBacktracker +from sage.combinat.combinat import CombinatorialElement, catalan_number +from sage.combinat.combinatorial_map import combinatorial_map +from sage.combinat.composition import Composition +from sage.combinat.permutation_cython import (left_action_product, right_action_product, + left_action_same_n, right_action_same_n, + map_to_list, next_perm) +from sage.combinat.rsk import RSK, RSK_inverse +from sage.combinat.tools import transitive_ideal from sage.graphs.digraph import DiGraph from sage.groups.perm_gps.permgroup_element import PermutationGroupElement from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -262,16 +271,6 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from .backtrack import GenericBacktracker -from .combinat import CombinatorialElement, catalan_number -from .combinatorial_map import combinatorial_map -from .composition import Composition -from .permutation_cython import (left_action_product, right_action_product, - left_action_same_n, right_action_same_n, - map_to_list, next_perm) -from .rsk import RSK, RSK_inverse -from .tools import transitive_ideal - class Permutation(CombinatorialElement): r""" diff --git a/src/sage/combinat/sf/elementary.py b/src/sage/combinat/sf/elementary.py index b9b7eaee976..8d242f55b84 100644 --- a/src/sage/combinat/sf/elementary.py +++ b/src/sage/combinat/sf/elementary.py @@ -19,11 +19,10 @@ #***************************************************************************** from sage.arith.misc import binomial, factorial from sage.combinat.partition import Partition +from sage.combinat.sf import multiplicative, classical from sage.misc.misc_c import prod from sage.rings.infinity import infinity -from . import multiplicative, classical - ################################### # # diff --git a/src/sage/combinat/sf/homogeneous.py b/src/sage/combinat/sf/homogeneous.py index 26a4df3ee14..b97bfae074c 100644 --- a/src/sage/combinat/sf/homogeneous.py +++ b/src/sage/combinat/sf/homogeneous.py @@ -27,11 +27,10 @@ #################################### from sage.arith.misc import binomial, factorial from sage.combinat.partition import Partition +from sage.combinat.sf import multiplicative, classical from sage.misc.misc_c import prod from sage.rings.infinity import infinity -from . import multiplicative, classical - class SymmetricFunctionAlgebra_homogeneous(multiplicative.SymmetricFunctionAlgebra_multiplicative): def __init__(self, Sym): diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index 23692c87da1..923dc64cb0d 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -192,6 +192,9 @@ class type, it is also possible to compute the number of classes of that type from sage.arith.misc import divisors, factorial, moebius from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets +from sage.combinat.combinat import CombinatorialElement +from sage.combinat.misc import IterableFunctionCall +from sage.combinat.partition import Partitions, Partition from sage.misc.cachefunc import cached_in_parent_method, cached_function from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.misc.misc_c import prod @@ -203,11 +206,6 @@ class type, it is also possible to compute the number of classes of that type from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from .combinat import CombinatorialElement -from .misc import IterableFunctionCall -from .partition import Partitions, Partition - - @cached_function def fq(n, q=None): diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index f4c8b24201d..20d89a770db 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -13,13 +13,11 @@ #***************************************************************************** from sage.arith.misc import divisors, euler_phi +from sage.combinat.species.misc import accept_size +from sage.combinat.species.species import GenericCombinatorialSpecies +from sage.combinat.species.structure import GenericSpeciesStructure from sage.structure.unique_representation import UniqueRepresentation -from .misc import accept_size -from .species import GenericCombinatorialSpecies -from .structure import GenericSpeciesStructure - - class CycleSpeciesStructure(GenericSpeciesStructure): def __repr__(self): diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 7fee9ef3a99..5d0fb107734 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -86,34 +86,34 @@ # **************************************************************************** from itertools import repeat +import sage.libs.symmetrica.all as symmetrica +import sage.misc.prandom as random + from sage.arith.misc import binomial, factorial, multinomial from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets from sage.categories.sets_cat import Sets +from sage.combinat import permutation +from sage.combinat.combinatorial_map import combinatorial_map +from sage.combinat.composition import Composition, Compositions +from sage.combinat.integer_vector import IntegerVectors, integer_vectors_nk_fast_iter +from sage.combinat.posets.posets import Poset from sage.groups.perm_gps.permgroup import PermutationGroup +from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass +from sage.misc.misc import powerset +from sage.misc.misc_c import prod +from sage.misc.persist import register_unpickle_override +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing +from sage.rings.infinity import PlusInfinity +from sage.rings.integer import Integer from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets from sage.sets.family import Family from sage.sets.non_negative_integers import NonNegativeIntegers from sage.structure.global_options import GlobalOptions -from sage.structure.unique_representation import UniqueRepresentation from sage.structure.list_clone import ClonableList from sage.structure.parent import Parent from sage.structure.richcmp import richcmp, richcmp_method -from sage.misc.persist import register_unpickle_override -from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass -from sage.rings.finite_rings.integer_mod_ring import IntegerModRing -from sage.rings.infinity import PlusInfinity -from sage.rings.integer import Integer -import sage.libs.symmetrica.all as symmetrica -import sage.misc.prandom as random -from sage.misc.misc_c import prod -from sage.misc.misc import powerset - -from . import permutation -from .combinatorial_map import combinatorial_map -from .composition import Composition, Compositions -from .integer_vector import IntegerVectors, integer_vectors_nk_fast_iter -from .posets.posets import Poset +from sage.structure.unique_representation import UniqueRepresentation @richcmp_method diff --git a/src/sage/combinat/words/lyndon_word.py b/src/sage/combinat/words/lyndon_word.py index 2a28f615a2c..6adb96421e5 100644 --- a/src/sage/combinat/words/lyndon_word.py +++ b/src/sage/combinat/words/lyndon_word.py @@ -16,13 +16,12 @@ from sage.combinat.combinat_cython import lyndon_word_iterator from sage.combinat.composition import Composition, Compositions from sage.combinat.necklace import _sfc +from sage.combinat.words.finite_word import FiniteWord_class +from sage.combinat.words.words import FiniteWords from sage.rings.integer import Integer from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from .finite_word import FiniteWord_class -from .words import FiniteWords - def LyndonWords(e=None, k=None): """ From 8c2d31500007924e3bb54c4126f6bb7300c78a6f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 18 Feb 2023 11:08:44 -0800 Subject: [PATCH 7/7] src/sage/matroids/linear_matroid.pyx: Remove unused imports, sort imports --- src/sage/matroids/linear_matroid.pyx | 31 +++++++++++++--------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index a0e41b0046c..5c697a696b4 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -111,30 +111,27 @@ Methods # https://www.gnu.org/licenses/ # **************************************************************************** +from copy import copy, deepcopy +from itertools import combinations, product + from cpython.object cimport Py_EQ, Py_NE from sage.data_structures.bitset_base cimport * -from sage.structure.richcmp cimport rich_to_bool -from sage.matroids.matroid cimport Matroid -from sage.matroids.basis_exchange_matroid cimport BasisExchangeMatroid -from .lean_matrix cimport (LeanMatrix, GenericMatrix, BinaryMatrix, - TernaryMatrix, QuaternaryMatrix, PlusMinusOneMatrix, - RationalMatrix, generic_identity) -from .set_system cimport SetSystem -from .utilities import newlabel, spanning_stars, spanning_forest, lift_cross_ratios -from sage.graphs.spanning_tree import kruskal from sage.graphs.graph import Graph - -from sage.matrix.matrix2 cimport Matrix -import sage.matrix.constructor +from sage.graphs.spanning_tree import kruskal from sage.matrix.constructor import matrix -from copy import copy, deepcopy +from sage.matrix.matrix2 cimport Matrix +from sage.matroids.basis_exchange_matroid cimport BasisExchangeMatroid +from sage.matroids.lean_matrix cimport (LeanMatrix, GenericMatrix, BinaryMatrix, + TernaryMatrix, QuaternaryMatrix, PlusMinusOneMatrix, + RationalMatrix, generic_identity) +from sage.matroids.matroid cimport Matroid +from sage.matroids.set_system cimport SetSystem +from sage.matroids.utilities import newlabel, spanning_stars, spanning_forest, lift_cross_ratios +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.rings.finite_rings.finite_field_constructor import FiniteField -from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF -import itertools -from itertools import combinations, product +from sage.structure.richcmp cimport rich_to_bool cdef bint GF2_not_defined = True cdef GF2, GF2_one, GF2_zero