diff --git a/src/sage/algebras/affine_nil_temperley_lieb.py b/src/sage/algebras/affine_nil_temperley_lieb.py index f7901ae314d..5662ee26e47 100644 --- a/src/sage/algebras/affine_nil_temperley_lieb.py +++ b/src/sage/algebras/affine_nil_temperley_lieb.py @@ -9,7 +9,6 @@ # **************************************************************************** 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 from sage.rings.integer_ring import ZZ from sage.combinat.free_module import CombinatorialFreeModule @@ -57,6 +56,7 @@ def __init__(self, n, R=ZZ, prefix='a'): raise TypeError("argument R must be a ring") self._cartan_type = CartanType(['A', n - 1, 1]) self._n = n + from sage.combinat.root_system.weyl_group import WeylGroup W = WeylGroup(self._cartan_type) self._prefix = prefix self._index_set = W.index_set() diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 0b6696af043..2a65134a618 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -36,7 +36,6 @@ from sage.rings.integer_ring import ZZ from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing 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 @@ -445,6 +444,7 @@ def __classcall_private__(cls, W, q1, q2=-1, base_ring=None): True """ if W not in CoxeterGroups(): + from sage.combinat.root_system.coxeter_group import CoxeterGroup W = CoxeterGroup(W) if base_ring is None: base_ring = q1.parent() @@ -2018,6 +2018,7 @@ def __init__(self, IHAlgebra, prefix=None): if isinstance(IHAlgebra._W, Coxeter3Group): self._W_Coxeter3 = IHAlgebra._W else: + from sage.combinat.root_system.coxeter_group import CoxeterGroup self._W_Coxeter3 = CoxeterGroup(IHAlgebra._W.coxeter_type(), implementation='coxeter3') def hash_involution_on_basis(self, w): @@ -2751,6 +2752,7 @@ def __classcall_private__(cls, W): True """ if W not in CoxeterGroups(): + from sage.combinat.root_system.coxeter_group import CoxeterGroup W = CoxeterGroup(W) return super().__classcall__(cls, W) diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 2206ea2873a..18152b77c5d 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -95,7 +95,7 @@ # Permutations from .permutation import Permutation, Permutations, Arrangements, CyclicPermutations, CyclicPermutationsOfPartition -from .affine_permutation import AffinePermutationGroup +lazy_import('sage.combinat.affine_permutation', 'AffinePermutationGroup') lazy_import('sage.combinat.colored_permutations', ['ColoredPermutations', 'SignedPermutation', 'SignedPermutations']) @@ -203,10 +203,10 @@ ['ParkingFunctions', 'ParkingFunction']) # Trees and Tamari interval posets -from .ordered_tree import (OrderedTree, OrderedTrees, - LabelledOrderedTree, LabelledOrderedTrees) -from .binary_tree import (BinaryTree, BinaryTrees, - LabelledBinaryTree, LabelledBinaryTrees) +lazy_import('sage.combinat.ordered_tree', ['OrderedTree', 'OrderedTrees', + 'LabelledOrderedTree', 'LabelledOrderedTrees']) +lazy_import('sage.combinat.binary_tree', ['BinaryTree', 'BinaryTrees', + 'LabelledBinaryTree', 'LabelledBinaryTrees']) lazy_import('sage.combinat.interval_posets', ['TamariIntervalPoset', 'TamariIntervalPosets']) lazy_import('sage.combinat.rooted_tree', ('RootedTree', 'RootedTrees', 'LabelledRootedTree', 'LabelledRootedTrees')) diff --git a/src/sage/combinat/k_tableau.py b/src/sage/combinat/k_tableau.py index 5fb1d56b82c..ecd5583dcd7 100644 --- a/src/sage/combinat/k_tableau.py +++ b/src/sage/combinat/k_tableau.py @@ -37,7 +37,6 @@ from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.combinat.skew_tableau import SkewTableau, SemistandardSkewTableaux from sage.combinat.partition import Partition, Partitions -from sage.combinat.root_system.weyl_group import WeylGroup from sage.combinat.core import Core from sage.rings.integer_ring import ZZ from sage.functions.generalized import sgn @@ -1826,6 +1825,7 @@ def straighten_input(t, k): ... ValueError: inconsistent number of rows: should be 4 but got 5 """ + from sage.combinat.root_system.weyl_group import WeylGroup W = WeylGroup(['A', k, 1], prefix='s') if len(t) > 0: if isinstance(t[0], (list, tuple)): @@ -1864,6 +1864,7 @@ def __classcall_private__(cls, t, k, inner_shape = []): """ if isinstance(t, cls): return t + from sage.combinat.root_system.weyl_group import WeylGroup W = WeylGroup(['A', k, 1], prefix='s') w = cls.straighten_input(t, k) weight = tuple(w[i].length() for i in range(len(w) - 1, -1, -1)) diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 4dac3bf8bf3..f4020617a4f 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -320,7 +320,6 @@ from sage.combinat.integer_lists.invlex import IntegerListsBackend_invlex from sage.combinat.integer_vector_weighted import iterator_fast as weighted_iterator_fast from sage.combinat.combinat_cython import conjugate -from sage.combinat.root_system.weyl_group import WeylGroup from sage.combinat.combinatorial_map import combinatorial_map from sage.groups.perm_gps.permgroup import PermutationGroup from sage.graphs.dot2tex_utils import have_dot2tex @@ -4633,6 +4632,7 @@ def from_kbounded_to_grassmannian(self, k): [0 1 0] [0 0 1] """ + from sage.combinat.root_system.weyl_group import WeylGroup return WeylGroup(['A', k,1 ]).from_reduced_word(self.from_kbounded_to_reduced_word(k)) def to_list(self): diff --git a/src/sage/combinat/root_system/all.py b/src/sage/combinat/root_system/all.py index 263a4d916d2..51080207cf8 100644 --- a/src/sage/combinat/root_system/all.py +++ b/src/sage/combinat/root_system/all.py @@ -121,12 +121,13 @@ from sage.misc.lazy_import import lazy_import -from .cartan_type import CartanType -from .dynkin_diagram import DynkinDiagram -from .cartan_matrix import CartanMatrix -from .coxeter_matrix import CoxeterMatrix -from .coxeter_type import CoxeterType -from .root_system import RootSystem, WeylDim +lazy_import('sage.combinat.root_system.cartan_type', 'CartanType') +lazy_import('sage.combinat.root_system.dynkin_diagram', 'DynkinDiagram') +lazy_import('sage.combinat.root_system.cartan_matrix', 'CartanMatrix') +lazy_import('sage.combinat.root_system.coxeter_matrix', 'CoxeterMatrix') +lazy_import('sage.combinat.root_system.coxeter_type', 'CoxeterType') +lazy_import('sage.combinat.root_system.root_system', 'RootSystem') +lazy_import('sage.combinat.root_system.root_system', 'WeylDim') lazy_import('sage.combinat.root_system.weyl_group', ['WeylGroup', 'WeylGroupElement']) lazy_import('sage.combinat.root_system.reflection_group_real', diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index fe0bce4e4ea..e552b0f9cd4 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -150,7 +150,8 @@ from sage.groups.perm_gps.constructor import PermutationGroupElement as PermutationConstructor, standardize_generator from sage.groups.abelian_gps.abelian_group import AbelianGroup from sage.misc.cachefunc import cached_method -from sage.groups.class_function import ClassFunction_libgap +from sage.misc.lazy_import import lazy_import +lazy_import('sage.groups.class_function', 'ClassFunction_libgap') from sage.sets.finite_enumerated_set import FiniteEnumeratedSet from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.groups.conjugacy_classes import ConjugacyClassGAP diff --git a/src/sage/modular/arithgroup/congroup_gamma.py b/src/sage/modular/arithgroup/congroup_gamma.py index bc1cbb6afd6..18d2bae9abd 100644 --- a/src/sage/modular/arithgroup/congroup_gamma.py +++ b/src/sage/modular/arithgroup/congroup_gamma.py @@ -298,6 +298,7 @@ def image_mod_n(self): [0 1] ) """ + from sage.groups.matrix_gps.finitely_generated import MatrixGroup return MatrixGroup([matrix(Zmod(self.level()), 2, 2, 1)]) diff --git a/src/sage/modular/arithgroup/congroup_gammaH.py b/src/sage/modular/arithgroup/congroup_gammaH.py index cfe2da14117..4b1b5a5f7dc 100644 --- a/src/sage/modular/arithgroup/congroup_gammaH.py +++ b/src/sage/modular/arithgroup/congroup_gammaH.py @@ -28,7 +28,6 @@ from sage.misc.cachefunc import cached_method from sage.rings.integer_ring import ZZ from sage.rings.finite_rings.integer_mod_ring import Zmod -from sage.groups.matrix_gps.finitely_generated import MatrixGroup from sage.matrix.constructor import matrix from sage.structure.richcmp import richcmp_method, richcmp @@ -1289,6 +1288,7 @@ def image_mod_n(self): raise NotImplementedError("matrix groups over ring of integers modulo 1 not implemented") gens = [matrix(Zmod(N), 2, 2, [x, 0, 0, Zmod(N).one() / x]) for x in self._generators_for_H()] gens += [matrix(Zmod(N), 2, 2, [1, 1, 0, 1])] + from sage.groups.matrix_gps.finitely_generated import MatrixGroup return MatrixGroup(gens) def atkin_lehner_matrix(self, Q): diff --git a/src/sage/modular/hecke/ambient_module.py b/src/sage/modular/hecke/ambient_module.py index 3e4ae52f00f..94ebde142fe 100644 --- a/src/sage/modular/hecke/ambient_module.py +++ b/src/sage/modular/hecke/ambient_module.py @@ -30,8 +30,6 @@ import sage.matrix.matrix_space as matrix_space from sage.matrix.constructor import matrix -from sage.modular.arithgroup.all import Gamma0 # for Sturm bound - def is_AmbientHeckeModule(x) -> bool: r""" @@ -488,6 +486,7 @@ def free_module(self): sage: ModularForms(59, 2).free_module() Vector space of dimension 6 over Rational Field """ + from sage.modular.arithgroup.all import Gamma0 try: return self.__free_module except AttributeError: @@ -518,6 +517,8 @@ def hecke_bound(self): 15 """ from sage.misc.verbose import verbose + from sage.modular.arithgroup.all import Gamma0 + try: if self.is_cuspidal(): return Gamma0(self.level()).sturm_bound(self.weight())