@@ -85,7 +85,7 @@ def _latex_module(R, m):
85
85
'\\ Bold{Z}^{3}'
86
86
sage: _latex_module(ZZ, 0)
87
87
'0'
88
- sage: _latex_module(GF(3), 1) # optional - sage.rings.finite_rings
88
+ sage: _latex_module(GF(3), 1)
89
89
'\\ Bold{F}_{3}^{1}'
90
90
"""
91
91
if m == 0 :
@@ -188,11 +188,11 @@ def ChainComplex(data=None, base_ring=None, grading_group=None,
188
188
Chain complex with at most 2 nonzero terms over Integer Ring
189
189
190
190
sage: m = matrix(ZZ, 2, 2, [0, 1, 0, 0])
191
- sage: D = ChainComplex([m, m], base_ring=GF(2)); D # optional - sage.rings.finite_rings
191
+ sage: D = ChainComplex([m, m], base_ring=GF(2)); D
192
192
Chain complex with at most 3 nonzero terms over Finite Field of size 2
193
- sage: D == loads(dumps(D)) # optional - sage.rings.finite_rings
193
+ sage: D == loads(dumps(D))
194
194
True
195
- sage: D.differential(0)==m, m.is_immutable(), D.differential(0).is_immutable() # optional - sage.rings.finite_rings
195
+ sage: D.differential(0)==m, m.is_immutable(), D.differential(0).is_immutable()
196
196
(True, False, True)
197
197
198
198
Note that when a chain complex is defined in Sage, new
@@ -214,12 +214,12 @@ def ChainComplex(data=None, base_ring=None, grading_group=None,
214
214
215
215
sage: ChainComplex([matrix(QQ, 3, 1), matrix(ZZ, 4, 3)])
216
216
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
218
218
Chain complex with at most 3 nonzero terms over Finite Field in a of size 5^3
219
219
220
220
If the matrices are defined over incompatible rings, an error results::
221
221
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
223
223
Traceback (most recent call last):
224
224
...
225
225
TypeError: no common canonical parent for objects with parents:
@@ -228,7 +228,7 @@ def ChainComplex(data=None, base_ring=None, grading_group=None,
228
228
If the base ring is given explicitly but is not compatible with
229
229
the matrices, an error results::
230
230
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
232
232
Traceback (most recent call last):
233
233
...
234
234
TypeError: unable to convert 0 to a rational
@@ -336,9 +336,9 @@ def __init__(self, parent, vectors, check=True):
336
336
337
337
EXAMPLES::
338
338
339
- sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])}, # optional - sage.rings.finite_rings
339
+ sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])},
340
340
....: base_ring=GF(7))
341
- sage: C.category() # optional - sage.rings.finite_rings
341
+ sage: C.category()
342
342
Category of chain complexes over Finite Field of size 7
343
343
344
344
TESTS::
@@ -771,7 +771,7 @@ def rank(self, degree, ring=None):
771
771
[2]
772
772
sage: C.rank(0)
773
773
1
774
- sage: C.rank(0, ring=GF(2)) # optional - sage.rings.finite_rings
774
+ sage: C.rank(0, ring=GF(2))
775
775
0
776
776
"""
777
777
degree = self .grading_group ()(degree )
@@ -1079,12 +1079,12 @@ def __eq__(self, other):
1079
1079
1080
1080
EXAMPLES::
1081
1081
1082
- sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])}, # optional - sage.rings.finite_rings
1082
+ sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])},
1083
1083
....: base_ring=GF(2))
1084
- sage: D = ChainComplex({0: matrix(GF(2), 2, 3, [1, 0, 0, 0, 0, 0]), # optional - sage.rings.finite_rings
1084
+ sage: D = ChainComplex({0: matrix(GF(2), 2, 3, [1, 0, 0, 0, 0, 0]),
1085
1085
....: 1: matrix(ZZ, 0, 2),
1086
1086
....: 3: matrix(ZZ, 0, 0)}) # base_ring determined from the matrices
1087
- sage: C == D # optional - sage.rings.finite_rings
1087
+ sage: C == D
1088
1088
True
1089
1089
"""
1090
1090
if not isinstance (other , ChainComplex_class ) or self .base_ring () != other .base_ring ():
@@ -1108,16 +1108,16 @@ def __ne__(self, other):
1108
1108
1109
1109
EXAMPLES::
1110
1110
1111
- sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])}, # optional - sage.rings.finite_rings
1111
+ sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])},
1112
1112
....: base_ring=GF(2))
1113
- sage: D = ChainComplex({0: matrix(GF(2), 2, 3, [1, 0, 0, 0, 0, 0]), # optional - sage.rings.finite_rings
1113
+ sage: D = ChainComplex({0: matrix(GF(2), 2, 3, [1, 0, 0, 0, 0, 0]),
1114
1114
....: 1: matrix(ZZ, 0, 2),
1115
1115
....: 3: matrix(ZZ, 0, 0)}) # base_ring determined from the matrices
1116
- sage: C != D # optional - sage.rings.finite_rings
1116
+ sage: C != D
1117
1117
False
1118
1118
sage: E = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])},
1119
1119
....: base_ring=ZZ)
1120
- sage: C != E # optional - sage.rings.finite_rings
1120
+ sage: C != E
1121
1121
True
1122
1122
"""
1123
1123
return not self == other
@@ -1143,15 +1143,15 @@ def _homology_chomp(self, deg, base_ring, verbose, generators):
1143
1143
1144
1144
EXAMPLES::
1145
1145
1146
- sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])}, base_ring=GF(2)) # optional - sage.rings.finite_rings
1147
- sage: C._homology_chomp(None, GF(2), False, False) # optional - CHomP # optional - sage.rings.finite_rings
1146
+ 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, needs sage.rings.finite_rings
1148
1148
doctest:...: DeprecationWarning: the CHomP interface is deprecated; hence so is this function
1149
1149
See https://github.com/sagemath/sage/issues/33777 for details.
1150
1150
{0: Vector space of dimension 2 over Finite Field of size 2, 1: Vector space of dimension 1 over Finite Field of size 2}
1151
1151
1152
1152
sage: D = ChainComplex({0: matrix(ZZ,1,0,[]), 1: matrix(ZZ,1,1,[0]),
1153
1153
....: 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
1155
1155
{1: Vector space of dimension 1 over Finite Field of size 2,
1156
1156
2: Vector space of dimension 1 over Finite Field of size 2}
1157
1157
"""
@@ -1253,7 +1253,7 @@ def homology(self, deg=None, base_ring=None, generators=False,
1253
1253
sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])})
1254
1254
sage: C.homology()
1255
1255
{0: Z x Z, 1: Z x C3}
1256
- sage: C.homology(deg=1, base_ring=GF(3)) # optional - sage.rings.finite_rings
1256
+ sage: C.homology(deg=1, base_ring=GF(3))
1257
1257
Vector space of dimension 2 over Finite Field of size 3
1258
1258
sage: D = ChainComplex({0: identity_matrix(ZZ, 4), 4: identity_matrix(ZZ, 30)})
1259
1259
sage: D.homology()
@@ -1280,9 +1280,9 @@ def homology(self, deg=None, base_ring=None, generators=False,
1280
1280
1281
1281
From a torus using a field::
1282
1282
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
1286
1286
{0: [(Vector space of dimension 1 over Rational Field,
1287
1287
Chain(0:(0, 0, 0, 0, 0, 0, 1)))],
1288
1288
1: [(Vector space of dimension 1 over Rational Field,
@@ -1461,8 +1461,8 @@ def betti(self, deg=None, base_ring=None):
1461
1461
sage: C.betti()
1462
1462
{0: 2, 1: 1}
1463
1463
1464
- sage: D = ChainComplex({0: matrix(GF(5), [[3, 1],[1, 2]])}) # optional - sage.rings.finite_rings
1465
- sage: D.betti() # optional - sage.rings.finite_rings
1464
+ sage: D = ChainComplex({0: matrix(GF(5), [[3, 1],[1, 2]])})
1465
+ sage: D.betti()
1466
1466
{0: 1, 1: 1}
1467
1467
"""
1468
1468
if base_ring is None :
@@ -1513,14 +1513,14 @@ def torsion_list(self, max_prime, min_prime=2):
1513
1513
sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])})
1514
1514
sage: C.homology()
1515
1515
{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
1517
1517
[(3, [1])]
1518
1518
sage: C = ChainComplex([matrix(ZZ, 1, 1, [2]), matrix(ZZ, 1, 1), matrix(1, 1, [3])])
1519
1519
sage: C.homology(1)
1520
1520
C2
1521
1521
sage: C.homology(3)
1522
1522
C3
1523
- sage: C.torsion_list(5) # optional - sage.rings.finite_rings
1523
+ sage: C.torsion_list(5) # needs sage.rings.finite_rings
1524
1524
[(2, [1]), (3, [3])]
1525
1525
"""
1526
1526
if self .base_ring () != ZZ :
@@ -1563,11 +1563,12 @@ def _Hom_(self, other, category=None):
1563
1563
1564
1564
EXAMPLES::
1565
1565
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
1571
1572
Set of Morphisms from Chain complex with at most 4 nonzero terms over
1572
1573
Integer Ring to Chain complex with at most 4 nonzero terms over Integer
1573
1574
Ring in Category of chain complexes over Integer Ring
@@ -1629,33 +1630,35 @@ def shift(self, n=1):
1629
1630
1630
1631
EXAMPLES::
1631
1632
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)
1634
1636
True
1635
- sage: S1.shift(2).differential(3) == S1.differential(1) # optional - sage.graphs
1637
+ sage: S1.shift(2).differential(3) == S1.differential(1)
1636
1638
True
1637
- sage: S1.shift(3).homology(4) # optional - sage.graphs
1639
+ sage: S1.shift(3).homology(4)
1638
1640
Z
1639
1641
1640
1642
For cochain complexes, shifting goes in the other
1641
1643
direction. Topologically, this makes sense if we grade the
1642
1644
cochain complex for a space negatively::
1643
1645
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()
1647
1650
{-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()
1649
1652
1
1650
- sage: co_T.shift(2).homology() # optional - sage.graphs
1653
+ sage: co_T.shift(2).homology()
1651
1654
{-4: Z, -3: Z x Z, -2: Z}
1652
1655
1653
1656
You can achieve the same result by tensoring (on the left, to
1654
1657
get the signs right) with a rank one free module in degree
1655
1658
``-n * deg``, if ``deg`` is the degree of the differential::
1656
1659
1657
1660
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
1659
1662
{-4: Z, -3: Z x Z, -2: Z}
1660
1663
"""
1661
1664
deg = self .degree_of_differential ()
0 commit comments