Skip to content

Commit

Permalink
Merge branch 'cohomology-as-module' of https://github.com/jhpalmieri/…
Browse files Browse the repository at this point in the history
…sage into cohomology-as-module
  • Loading branch information
jhpalmieri committed Sep 23, 2023
2 parents d982fc4 + 42618b1 commit 82d33c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
37 changes: 18 additions & 19 deletions src/sage/homology/homology_vector_space_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,13 @@ def _test_duality(self, **options):
sage: simplicial_complexes.RandomComplex(12, 3, .5).homology_with_basis(GF(2))._test_duality() # long time
"""
okay = True
tester = self._tester(**options))
dual = self.dual()
dims = [a[0] for a in self._indices]
for dim in range(max(dims) + 1):
for dim in range(max(max(dims), tester._max_runs) + 1):
n = len(self.basis(dim))
m = matrix(n, n, [a.eval(b) for a in self.basis(dim) for b in dual.basis(dim)])
okay = (m == 1)
if not okay:
print('error in dimension {}'.format(dim))
tester.assertEqual(m, 1,f "error in dimension {dim}")

class Element(CombinatorialFreeModule.Element):
def to_cycle(self):
Expand Down Expand Up @@ -488,10 +486,10 @@ def eval(self, other):
INPUT:
- ``other`` -- an element of the dual space: if ``self``
- ``other`` -- an element of the dual space; if ``self``
is an element of cohomology in dimension `n`, then
``other`` should be an element of homology in dimension
`n`, and vice versa.
`n`, and vice versa
This just calls the :meth:`~sage.homology.chains.Cochains.Element.eval`
method on the representing chains and cochains.
Expand Down Expand Up @@ -523,6 +521,7 @@ def eval(self, other):
else:
return other.to_cycle().eval(self.to_cycle())


class HomologyVectorSpaceWithBasis_mod2(HomologyVectorSpaceWithBasis):
r"""
Homology vector space mod 2.
Expand Down Expand Up @@ -691,11 +690,10 @@ def _acted_upon_(self, a, self_on_left):
if m <= n:
return self.parent().zero()

vec = []
for x in sorted(self.parent().dual().basis(m-n)):
vec.append(self.eval(a * x))
B = list(self.parent().basis(m-n))
return self.parent().linear_combination(zip(B, vec))
P = self.parent()
B = list(P.basis(m-n))
return P._from_dict({b.support()[0]: self.eval(a * x)
for x in sorted(self.parent().dual().basis(m-n))})


class CohomologyRing(HomologyVectorSpaceWithBasis):
Expand Down Expand Up @@ -1019,7 +1017,7 @@ def __init__(self, base_ring, cell_complex):
sage: TestSuite(H).run()
"""
if base_ring != GF(2):
raise ValueError
raise ValueError("the base ring must be GF(2)")
category = Algebras(base_ring).WithBasis().Graded().FiniteDimensional()
category = Category.join((category,
LeftModules(SteenrodAlgebra(2)),
Expand Down Expand Up @@ -1277,12 +1275,11 @@ def steenrod_module_map(self, deg_domain, deg_codomain, side='left'):
- ``deg_codomain`` -- the degree of the codomain in the
cohomology ring
- ``side`` (optional, default ``'left'``) -- are we computing
the action as a left module action or a right module? (This
documentation is written from the point of view of a left
action for brevity. Just switch all of the tensors for the
right action.)
- ``side`` default ``'left'``) -- whether we are computing
the action as a left module action or a right module
We will write this with respect to the left action;
for the right action, just switch all of the the tensors.
Writing `m` for ``deg_domain`` and `n` for ``deg_codomain``, this
returns `A^{n-m} \otimes H^{m} \to H^{n}`, one single
component of the map making `H` into an `A`-module.
Expand All @@ -1296,7 +1293,9 @@ def steenrod_module_map(self, deg_domain, deg_codomain, side='left'):
computations may be slow. There is no implementation for
`\Delta`-complexes.
Algorithm: use the Milnor basis for the truncated Steenrod
ALGORITHM:
Use the Milnor basis for the truncated Steenrod
algebra `A`, and for cohomology, use the basis with which it
is equipped. For each pair of basis elements `a` and `h`,
compute the product `a \otimes h`, and use this to assemble a
Expand Down
4 changes: 2 additions & 2 deletions src/sage/topology/cell_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,9 @@ def homology_with_basis(self, base_ring=QQ, cohomology=False):
"""
from sage.homology.homology_vector_space_with_basis import \
HomologyVectorSpaceWithBasis, HomologyVectorSpaceWithBasis_mod2
if cohomology:
return self.cohomology_ring(base_ring)
if base_ring == GF(2):
if cohomology:
return self.cohomology_ring(base_ring)
return HomologyVectorSpaceWithBasis_mod2(base_ring, self)
return HomologyVectorSpaceWithBasis(base_ring, self, cohomology)

Expand Down

0 comments on commit 82d33c5

Please sign in to comment.