Skip to content

Commit c76fd1c

Browse files
author
Matthias Koeppe
committed
sage.topology: Use file-level '# needs sage.graphs'; sage.{hom,top}ology: run 'sage -fixdoctests --only-tags'
1 parent b04cc0d commit c76fd1c

26 files changed

+1286
-1199
lines changed

src/sage/homology/algebraic_topological_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def algebraic_topological_model(K, base_ring=None):
101101
102102
sage: from sage.homology.algebraic_topological_model import algebraic_topological_model
103103
sage: RP2 = simplicial_complexes.RealProjectivePlane()
104-
sage: phi, M = algebraic_topological_model(RP2, GF(2)) # optional - sage.rings.finite_rings
105-
sage: M.homology() # optional - sage.rings.finite_rings
104+
sage: phi, M = algebraic_topological_model(RP2, GF(2)) # needs sage.rings.finite_rings
105+
sage: M.homology() # needs sage.rings.finite_rings
106106
{0: Vector space of dimension 1 over Finite Field of size 2,
107107
1: Vector space of dimension 1 over Finite Field of size 2,
108108
2: Vector space of dimension 1 over Finite Field of size 2}
@@ -372,8 +372,8 @@ def algebraic_topological_model_delta_complex(K, base_ring=None):
372372
373373
sage: from sage.homology.algebraic_topological_model import algebraic_topological_model_delta_complex as AT_model
374374
sage: RP2 = simplicial_complexes.RealProjectivePlane()
375-
sage: phi, M = AT_model(RP2, GF(2)) # optional - sage.rings.finite_rings
376-
sage: M.homology() # optional - sage.rings.finite_rings
375+
sage: phi, M = AT_model(RP2, GF(2)) # needs sage.rings.finite_rings
376+
sage: M.homology() # needs sage.rings.finite_rings
377377
{0: Vector space of dimension 1 over Finite Field of size 2,
378378
1: Vector space of dimension 1 over Finite Field of size 2,
379379
2: Vector space of dimension 1 over Finite Field of size 2}

src/sage/homology/chain_complex.py

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ def ChainComplex(data=None, base_ring=None, grading_group=None,
214214
215215
sage: ChainComplex([matrix(QQ, 3, 1), matrix(ZZ, 4, 3)])
216216
Chain complex with at most 3 nonzero terms over Rational Field
217-
sage: ChainComplex([matrix(GF(125, 'a'), 3, 1), matrix(ZZ, 4, 3)]) # optional - sage.rings.finite_rings
217+
sage: ChainComplex([matrix(GF(125, 'a'), 3, 1), matrix(ZZ, 4, 3)]) # needs sage.rings.finite_rings
218218
Chain complex with at most 3 nonzero terms over Finite Field in a of size 5^3
219219
220220
If the matrices are defined over incompatible rings, an error results::
221221
222-
sage: ChainComplex([matrix(GF(125, 'a'), 3, 1), matrix(QQ, 4, 3)]) # optional - sage.rings.finite_rings
222+
sage: ChainComplex([matrix(GF(125, 'a'), 3, 1), matrix(QQ, 4, 3)]) # needs sage.rings.finite_rings
223223
Traceback (most recent call last):
224224
...
225225
TypeError: no common canonical parent for objects with parents:
@@ -228,7 +228,7 @@ def ChainComplex(data=None, base_ring=None, grading_group=None,
228228
If the base ring is given explicitly but is not compatible with
229229
the matrices, an error results::
230230
231-
sage: ChainComplex([matrix(GF(125, 'a'), 3, 1)], base_ring=QQ) # optional - sage.rings.finite_rings
231+
sage: ChainComplex([matrix(GF(125, 'a'), 3, 1)], base_ring=QQ) # needs sage.rings.finite_rings
232232
Traceback (most recent call last):
233233
...
234234
TypeError: unable to convert 0 to a rational
@@ -1144,14 +1144,14 @@ def _homology_chomp(self, deg, base_ring, verbose, generators):
11441144
EXAMPLES::
11451145
11461146
sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])}, base_ring=GF(2))
1147-
sage: C._homology_chomp(None, GF(2), False, False) # optional - CHomP # optional - sage.rings.finite_rings
1147+
sage: C._homology_chomp(None, GF(2), False, False) # optional - chomp, needs sage.rings.finite_rings
11481148
doctest:...: DeprecationWarning: the CHomP interface is deprecated; hence so is this function
11491149
See https://github.com/sagemath/sage/issues/33777 for details.
11501150
{0: Vector space of dimension 2 over Finite Field of size 2, 1: Vector space of dimension 1 over Finite Field of size 2}
11511151
11521152
sage: D = ChainComplex({0: matrix(ZZ,1,0,[]), 1: matrix(ZZ,1,1,[0]),
11531153
....: 2: matrix(ZZ,0,1,[])})
1154-
sage: D._homology_chomp(None, GF(2), False, False) # optional - CHomP # optional - sage.rings.finite_rings
1154+
sage: D._homology_chomp(None, GF(2), False, False) # optional - chomp, needs sage.rings.finite_rings
11551155
{1: Vector space of dimension 1 over Finite Field of size 2,
11561156
2: Vector space of dimension 1 over Finite Field of size 2}
11571157
"""
@@ -1280,9 +1280,9 @@ def homology(self, deg=None, base_ring=None, generators=False,
12801280
12811281
From a torus using a field::
12821282
1283-
sage: T = simplicial_complexes.Torus() # optional - sage.graphs
1284-
sage: C_t = T.chain_complex() # optional - sage.graphs
1285-
sage: C_t.homology(base_ring=QQ, generators=True) # optional - sage.graphs
1283+
sage: T = simplicial_complexes.Torus() # needs sage.graphs
1284+
sage: C_t = T.chain_complex() # needs sage.graphs
1285+
sage: C_t.homology(base_ring=QQ, generators=True) # needs sage.graphs
12861286
{0: [(Vector space of dimension 1 over Rational Field,
12871287
Chain(0:(0, 0, 0, 0, 0, 0, 1)))],
12881288
1: [(Vector space of dimension 1 over Rational Field,
@@ -1513,14 +1513,14 @@ def torsion_list(self, max_prime, min_prime=2):
15131513
sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])})
15141514
sage: C.homology()
15151515
{0: Z x Z, 1: Z x C3}
1516-
sage: C.torsion_list(11) # optional - sage.rings.finite_rings
1516+
sage: C.torsion_list(11) # needs sage.rings.finite_rings
15171517
[(3, [1])]
15181518
sage: C = ChainComplex([matrix(ZZ, 1, 1, [2]), matrix(ZZ, 1, 1), matrix(1, 1, [3])])
15191519
sage: C.homology(1)
15201520
C2
15211521
sage: C.homology(3)
15221522
C3
1523-
sage: C.torsion_list(5) # optional - sage.rings.finite_rings
1523+
sage: C.torsion_list(5) # needs sage.rings.finite_rings
15241524
[(2, [1]), (3, [3])]
15251525
"""
15261526
if self.base_ring() != ZZ:
@@ -1563,11 +1563,12 @@ def _Hom_(self, other, category=None):
15631563
15641564
EXAMPLES::
15651565
1566-
sage: S = simplicial_complexes.Sphere(2) # optional - sage.graphs
1567-
sage: T = simplicial_complexes.Torus() # optional - sage.graphs
1568-
sage: C = S.chain_complex(augmented=True, cochain=True) # optional - sage.graphs
1569-
sage: D = T.chain_complex(augmented=True, cochain=True) # optional - sage.graphs
1570-
sage: Hom(C, D) # indirect doctest # optional - sage.graphs
1566+
sage: # needs sage.graphs
1567+
sage: S = simplicial_complexes.Sphere(2)
1568+
sage: T = simplicial_complexes.Torus()
1569+
sage: C = S.chain_complex(augmented=True, cochain=True)
1570+
sage: D = T.chain_complex(augmented=True, cochain=True)
1571+
sage: Hom(C, D) # indirect doctest
15711572
Set of Morphisms from Chain complex with at most 4 nonzero terms over
15721573
Integer Ring to Chain complex with at most 4 nonzero terms over Integer
15731574
Ring in Category of chain complexes over Integer Ring
@@ -1629,33 +1630,35 @@ def shift(self, n=1):
16291630
16301631
EXAMPLES::
16311632
1632-
sage: S1 = simplicial_complexes.Sphere(1).chain_complex() # optional - sage.graphs
1633-
sage: S1.shift(1).differential(2) == -S1.differential(1) # optional - sage.graphs
1633+
sage: # needs sage.graphs
1634+
sage: S1 = simplicial_complexes.Sphere(1).chain_complex()
1635+
sage: S1.shift(1).differential(2) == -S1.differential(1)
16341636
True
1635-
sage: S1.shift(2).differential(3) == S1.differential(1) # optional - sage.graphs
1637+
sage: S1.shift(2).differential(3) == S1.differential(1)
16361638
True
1637-
sage: S1.shift(3).homology(4) # optional - sage.graphs
1639+
sage: S1.shift(3).homology(4)
16381640
Z
16391641
16401642
For cochain complexes, shifting goes in the other
16411643
direction. Topologically, this makes sense if we grade the
16421644
cochain complex for a space negatively::
16431645
1644-
sage: T = simplicial_complexes.Torus() # optional - sage.graphs
1645-
sage: co_T = T.chain_complex()._flip_() # optional - sage.graphs
1646-
sage: co_T.homology() # optional - sage.graphs
1646+
sage: # needs sage.graphs
1647+
sage: T = simplicial_complexes.Torus()
1648+
sage: co_T = T.chain_complex()._flip_()
1649+
sage: co_T.homology()
16471650
{-2: Z, -1: Z x Z, 0: Z}
1648-
sage: co_T.degree_of_differential() # optional - sage.graphs
1651+
sage: co_T.degree_of_differential()
16491652
1
1650-
sage: co_T.shift(2).homology() # optional - sage.graphs
1653+
sage: co_T.shift(2).homology()
16511654
{-4: Z, -3: Z x Z, -2: Z}
16521655
16531656
You can achieve the same result by tensoring (on the left, to
16541657
get the signs right) with a rank one free module in degree
16551658
``-n * deg``, if ``deg`` is the degree of the differential::
16561659
16571660
sage: C = ChainComplex({-2: matrix(ZZ, 0, 1)})
1658-
sage: C.tensor(co_T).homology() # optional - sage.graphs
1661+
sage: C.tensor(co_T).homology() # needs sage.graphs
16591662
{-4: Z, -3: Z x Z, -2: Z}
16601663
"""
16611664
deg = self.degree_of_differential()

0 commit comments

Comments
 (0)