Skip to content

Commit 4279c4e

Browse files
author
Release Manager
committed
gh-35943: `sage.combinat.designs`: Modularization fixes, update `# needs` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> - Many `# optional` are removed because small prime finite fields no longer need to be marked `# optional/needs sage.rings.finite_rings` since #35847 - Other `# optional` are replaced by codeblock-scoped `# needs` tags - Remaining `# optional` with standard features are replaced by `# needs` - Some import fixes needed for separate testing of **sagemath-graphs** from #35095 <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> This is: - done with the help of `sage -fixdoctests` from #35749 - Part of: #29705 - Cherry-picked from: #35095 <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35943 Reported by: Matthias Köppe Reviewer(s): David Coudert, Matthias Köppe
2 parents 4eb3fcb + f132428 commit 4279c4e

17 files changed

+656
-602
lines changed

src/sage/combinat/designs/bibd.py

Lines changed: 62 additions & 58 deletions
Large diffs are not rendered by default.

src/sage/combinat/designs/block_design.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# sage.doctest: optional - sage.rings.finite_rings
1+
# sage.doctest: needs sage.rings.finite_rings
22
r"""
33
Block designs
44
@@ -54,14 +54,17 @@
5454
#*****************************************************************************
5555
from sage.arith.misc import binomial, integer_floor, is_prime_power
5656
from sage.categories.sets_cat import EmptySetError
57-
from sage.modules.free_module import VectorSpace
57+
from sage.misc.lazy_import import lazy_import
58+
from sage.misc.unknown import Unknown
5859
from sage.rings.integer import Integer
5960
from sage.rings.integer_ring import ZZ
61+
6062
from .incidence_structures import IncidenceStructure
61-
from sage.rings.finite_rings.finite_field_constructor import FiniteField
62-
from sage.misc.unknown import Unknown
63-
from sage.matrix.matrix_space import MatrixSpace
64-
from sage.libs.gap.libgap import libgap
63+
64+
lazy_import('sage.libs.gap.libgap', 'libgap')
65+
lazy_import('sage.matrix.matrix_space', 'MatrixSpace')
66+
lazy_import('sage.modules.free_module', 'VectorSpace')
67+
lazy_import('sage.rings.finite_rings.finite_field_constructor', 'FiniteField')
6568

6669

6770
BlockDesign = IncidenceStructure
@@ -214,8 +217,7 @@ def ProjectiveGeometryDesign(n, d, F, algorithm=None, point_coordinates=True, ch
214217
The set of `d`-dimensional subspaces in a `n`-dimensional projective space
215218
forms `2`-designs (or balanced incomplete block designs)::
216219
217-
sage: PG = designs.ProjectiveGeometryDesign(4, 2, GF(2))
218-
sage: PG
220+
sage: PG = designs.ProjectiveGeometryDesign(4, 2, GF(2)); PG
219221
Incidence structure with 31 points and 155 blocks
220222
sage: PG.is_t_design(return_parameters=True)
221223
(True, (2, 31, 7, 7))
@@ -226,8 +228,7 @@ def ProjectiveGeometryDesign(n, d, F, algorithm=None, point_coordinates=True, ch
226228
227229
Check with ``F`` being a prime power::
228230
229-
sage: PG = designs.ProjectiveGeometryDesign(3, 2, 4)
230-
sage: PG
231+
sage: PG = designs.ProjectiveGeometryDesign(3, 2, 4); PG
231232
Incidence structure with 85 points and 85 blocks
232233
233234
Use coordinates::
@@ -900,10 +901,10 @@ def CremonaRichmondConfiguration():
900901
901902
EXAMPLES::
902903
903-
sage: H = designs.CremonaRichmondConfiguration(); H # optional - networkx
904+
sage: H = designs.CremonaRichmondConfiguration(); H # needs networkx
904905
Incidence structure with 15 points and 15 blocks
905-
sage: g = graphs.TutteCoxeterGraph() # optional - networkx
906-
sage: H.incidence_graph().is_isomorphic(g) # optional - networkx
906+
sage: g = graphs.TutteCoxeterGraph() # needs networkx
907+
sage: H.incidence_graph().is_isomorphic(g) # needs networkx
907908
True
908909
"""
909910
from sage.graphs.generators.smallgraphs import TutteCoxeterGraph
@@ -956,16 +957,16 @@ def HadamardDesign(n):
956957
957958
EXAMPLES::
958959
959-
sage: designs.HadamardDesign(7) # optional - sage.modules
960+
sage: designs.HadamardDesign(7) # needs sage.modules
960961
Incidence structure with 7 points and 7 blocks
961-
sage: print(designs.HadamardDesign(7)) # optional - sage.modules
962+
sage: print(designs.HadamardDesign(7)) # needs sage.modules
962963
Incidence structure with 7 points and 7 blocks
963964
964965
For example, the Hadamard 2-design with `n = 11` is a design whose parameters are `2-(11, 5, 2)`.
965966
We verify that `NJ = 5J` for this design. ::
966967
967-
sage: D = designs.HadamardDesign(11); N = D.incidence_matrix() # optional - sage.modules
968-
sage: J = matrix(ZZ, 11, 11, [1]*11*11); N*J # optional - sage.modules
968+
sage: D = designs.HadamardDesign(11); N = D.incidence_matrix() # needs sage.modules
969+
sage: J = matrix(ZZ, 11, 11, [1]*11*11); N*J # needs sage.modules
969970
[5 5 5 5 5 5 5 5 5 5 5]
970971
[5 5 5 5 5 5 5 5 5 5 5]
971972
[5 5 5 5 5 5 5 5 5 5 5]
@@ -1009,7 +1010,7 @@ def Hadamard3Design(n):
10091010
10101011
EXAMPLES::
10111012
1012-
sage: designs.Hadamard3Design(12) # optional - sage.modules
1013+
sage: designs.Hadamard3Design(12) # needs sage.modules
10131014
Incidence structure with 12 points and 22 blocks
10141015
10151016
We verify that any two blocks of the Hadamard `3`-design `3-(8, 4, 1)`
@@ -1019,9 +1020,9 @@ def Hadamard3Design(n):
10191020
10201021
::
10211022
1022-
sage: D = designs.Hadamard3Design(8) # optional - sage.modules
1023-
sage: N = D.incidence_matrix() # optional - sage.modules
1024-
sage: N.transpose()*N # optional - sage.modules
1023+
sage: D = designs.Hadamard3Design(8) # needs sage.modules
1024+
sage: N = D.incidence_matrix() # needs sage.modules
1025+
sage: N.transpose()*N # needs sage.modules
10251026
[4 2 2 2 2 2 2 2 2 2 2 2 2 0]
10261027
[2 4 2 2 2 2 2 2 2 2 2 2 0 2]
10271028
[2 2 4 2 2 2 2 2 2 2 2 0 2 2]

0 commit comments

Comments
 (0)