Skip to content

Commit cb2f3c0

Browse files
author
Release Manager
committed
gh-35581: `sage.{topology,homology}`: Modularization fixes <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description `sage.topology` is closely linked to functionality from `sage.graphs`. Doctests that either use methods or examples that require `sage.graphs` are marked `# optional - sage.graphs`; likewise for `sage.groups` (for multiplicative groups) and (less often) `sage.combinat`. Doctests that use finite fields are marked as `# optional - sage.rings.finite_rings` because implementation classes of GF(...) depend on various libraries. Doctests that compute homology are marked as `# optional - sage.modules` because `sage.homology` needs vector spaces. This functionality is not part of the distribution **sagemath-categories** but a higher up distribution (as of #35095, the distribution **sagemath-polyhedra** contains `sage.modules`, `sage.matrix`, `sage.homology`). Doctests involving free resolutions are marked `# optional - sage.libs.singular`. Some examples are read from data files; the corresponding tests are now marked `# optional - pyparsing`. A sporadic use of a function from `numpy` has been replaced by an equivalent `itertools` function. The correct placement of the `# optional` tags can be (and has been) tested using #35095. While going through the doctests, I also reformatted some so that they can be read in our HTML documentation style (furo) without having to scroll horizontally. <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> Part of: - #29705 <!-- 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. It should be `[x]` not `[x ]`. --> - [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: #35581 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee, Matthias Köppe
2 parents be85e35 + c4c593a commit cb2f3c0

26 files changed

Lines changed: 1494 additions & 1367 deletions

src/sage/categories/simplicial_sets.py

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ def _universal_cover_dict(self):
347347
348348
TESTS::
349349
350-
sage: RP2 = simplicial_sets.RealProjectiveSpace(2)
351-
sage: RP2._universal_cover_dict()
350+
sage: RP2 = simplicial_sets.RealProjectiveSpace(2) # optional - sage.groups
351+
sage: RP2._universal_cover_dict() # optional - sage.groups
352352
(Finitely presented group < e | e^2 >, {f: e})
353-
sage: RP2.nondegenerate_simplices()
353+
sage: RP2.nondegenerate_simplices() # optional - sage.groups
354354
[1, f, f * f]
355355
"""
356356
from sage.groups.free_group import FreeGroup
@@ -393,14 +393,14 @@ def universal_cover_map(self):
393393
394394
EXAMPLES::
395395
396-
sage: RP2 = simplicial_sets.RealProjectiveSpace(2)
397-
sage: phi = RP2.universal_cover_map()
398-
sage: phi
396+
sage: RP2 = simplicial_sets.RealProjectiveSpace(2) # optional - sage.groups
397+
sage: phi = RP2.universal_cover_map(); phi # optional - sage.groups
399398
Simplicial set morphism:
400399
From: Simplicial set with 6 non-degenerate simplices
401400
To: RP^2
402-
Defn: [(1, 1), (1, e), (f, 1), (f, e), (f * f, 1), (f * f, e)] --> [1, 1, f, f, f * f, f * f]
403-
sage: phi.domain().face_data()
401+
Defn: [(1, 1), (1, e), (f, 1), (f, e), (f * f, 1), (f * f, e)]
402+
--> [1, 1, f, f, f * f, f * f]
403+
sage: phi.domain().face_data() # optional - sage.groups
404404
{(1, 1): None,
405405
(1, e): None,
406406
(f, 1): ((1, e), (1, 1)),
@@ -432,18 +432,20 @@ def covering_map(self, character):
432432
EXAMPLES::
433433
434434
sage: S1 = simplicial_sets.Sphere(1)
435-
sage: W = S1.wedge(S1)
436-
sage: G = CyclicPermutationGroup(3)
437-
sage: a, b = W.n_cells(1)
438-
sage: C = W.covering_map({a : G.gen(0), b : G.one()})
439-
sage: C
435+
sage: W = S1.wedge(S1) # optional - sage.graphs
436+
sage: G = CyclicPermutationGroup(3) # optional - sage.groups
437+
sage: a, b = W.n_cells(1) # optional - sage.graphs
438+
sage: C = W.covering_map({a : G.gen(0), b : G.one()}); C # optional - sage.graphs sage.groups
440439
Simplicial set morphism:
441440
From: Simplicial set with 9 non-degenerate simplices
442441
To: Wedge: (S^1 v S^1)
443-
Defn: [(*, ()), (*, (1,2,3)), (*, (1,3,2)), (sigma_1, ()), (sigma_1, ()), (sigma_1, (1,2,3)), (sigma_1, (1,2,3)), (sigma_1, (1,3,2)), (sigma_1, (1,3,2))] --> [*, *, *, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1]
444-
sage: C.domain()
442+
Defn: [(*, ()), (*, (1,2,3)), (*, (1,3,2)), (sigma_1, ()),
443+
(sigma_1, ()), (sigma_1, (1,2,3)), (sigma_1, (1,2,3)),
444+
(sigma_1, (1,3,2)), (sigma_1, (1,3,2))]
445+
--> [*, *, *, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1]
446+
sage: C.domain() # optional - sage.graphs sage.groups
445447
Simplicial set with 9 non-degenerate simplices
446-
sage: C.domain().face_data()
448+
sage: C.domain().face_data() # optional - sage.graphs sage.groups
447449
{(*, ()): None,
448450
(*, (1,2,3)): None,
449451
(*, (1,3,2)): None,
@@ -517,11 +519,11 @@ def cover(self, character):
517519
EXAMPLES::
518520
519521
sage: S1 = simplicial_sets.Sphere(1)
520-
sage: W = S1.wedge(S1)
521-
sage: G = CyclicPermutationGroup(3)
522-
sage: (a, b) = W.n_cells(1)
523-
sage: C = W.cover({a : G.gen(0), b : G.gen(0)^2})
524-
sage: C.face_data()
522+
sage: W = S1.wedge(S1) # optional - sage.graphs
523+
sage: G = CyclicPermutationGroup(3) # optional - sage.groups
524+
sage: (a, b) = W.n_cells(1) # optional - sage.graphs
525+
sage: C = W.cover({a : G.gen(0), b : G.gen(0)^2}) # optional - sage.graphs sage.groups
526+
sage: C.face_data() # optional - sage.graphs sage.groups
525527
{(*, ()): None,
526528
(*, (1,2,3)): None,
527529
(*, (1,3,2)): None,
@@ -531,9 +533,9 @@ def cover(self, character):
531533
(sigma_1, (1,2,3)): ((*, ()), (*, (1,2,3))),
532534
(sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2))),
533535
(sigma_1, (1,3,2)): ((*, (1,2,3)), (*, (1,3,2)))}
534-
sage: C.homology(1)
536+
sage: C.homology(1) # optional - sage.graphs sage.groups sage.modules
535537
Z x Z x Z x Z
536-
sage: C.fundamental_group()
538+
sage: C.fundamental_group() # optional - sage.graphs sage.groups
537539
Finitely presented group < e0, e1, e2, e3 | >
538540
"""
539541
return self.covering_map(character).domain()
@@ -546,11 +548,10 @@ def universal_cover(self):
546548
547549
EXAMPLES::
548550
549-
sage: RP3 = simplicial_sets.RealProjectiveSpace(3)
550-
sage: C = RP3.universal_cover()
551-
sage: C
551+
sage: RP3 = simplicial_sets.RealProjectiveSpace(3) # optional - sage.groups
552+
sage: C = RP3.universal_cover(); C # optional - sage.groups
552553
Simplicial set with 8 non-degenerate simplices
553-
sage: C.face_data()
554+
sage: C.face_data() # optional - sage.groups
554555
{(1, 1): None,
555556
(1, e): None,
556557
(f, 1): ((1, e), (1, 1)),

src/sage/features/standard.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def all_features():
3030
JoinFeature('pplpy', (PythonModule('ppl'),), spkg='pplpy'),
3131
PythonModule('primecountpy', spkg='primecountpy'),
3232
PythonModule('ptyprocess', spkg='ptyprocess'),
33+
PythonModule('pyparsing', spkg='pyparsing'),
3334
PythonModule('requests', spkg='requests'),
3435
PythonModule('scipy', spkg='scipy'),
3536
PythonModule('sympy', spkg='sympy')]

src/sage/homology/algebraic_topological_model.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- coding: utf-8 -*-
1+
# sage.doctest: optional - sage.graphs
22
r"""
33
Algebraic topological model for a cell complex
44
@@ -100,8 +100,8 @@ def algebraic_topological_model(K, base_ring=None):
100100
101101
sage: from sage.homology.algebraic_topological_model import algebraic_topological_model
102102
sage: RP2 = simplicial_complexes.RealProjectivePlane()
103-
sage: phi, M = algebraic_topological_model(RP2, GF(2))
104-
sage: M.homology()
103+
sage: phi, M = algebraic_topological_model(RP2, GF(2)) # optional - sage.rings.finite_rings
104+
sage: M.homology() # optional - sage.rings.finite_rings
105105
{0: Vector space of dimension 1 over Finite Field of size 2,
106106
1: Vector space of dimension 1 over Finite Field of size 2,
107107
2: Vector space of dimension 1 over Finite Field of size 2}
@@ -123,7 +123,8 @@ def algebraic_topological_model(K, base_ring=None):
123123
1
124124
sage: phi.dual()
125125
Chain homotopy between:
126-
Chain complex endomorphism of Chain complex with at most 3 nonzero terms over Rational Field
126+
Chain complex endomorphism of
127+
Chain complex with at most 3 nonzero terms over Rational Field
127128
and Chain complex morphism:
128129
From: Chain complex with at most 3 nonzero terms over Rational Field
129130
To: Chain complex with at most 3 nonzero terms over Rational Field
@@ -369,8 +370,8 @@ def algebraic_topological_model_delta_complex(K, base_ring=None):
369370
370371
sage: from sage.homology.algebraic_topological_model import algebraic_topological_model_delta_complex as AT_model
371372
sage: RP2 = simplicial_complexes.RealProjectivePlane()
372-
sage: phi, M = AT_model(RP2, GF(2))
373-
sage: M.homology()
373+
sage: phi, M = AT_model(RP2, GF(2)) # optional - sage.rings.finite_rings
374+
sage: M.homology() # optional - sage.rings.finite_rings
374375
{0: Vector space of dimension 1 over Finite Field of size 2,
375376
1: Vector space of dimension 1 over Finite Field of size 2,
376377
2: Vector space of dimension 1 over Finite Field of size 2}

0 commit comments

Comments
 (0)