Skip to content

Commit

Permalink
tidying up reviewer changes, adding a few other small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpalmieri committed Sep 23, 2023
1 parent 82d33c5 commit cd95bec
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/sage/homology/homology_vector_space_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,13 @@ def _test_duality(self, **options):
sage: simplicial_complexes.RandomComplex(12, 3, .5).homology_with_basis(GF(2))._test_duality() # long time
"""
tester = self._tester(**options))
tester = self._tester(**options)
dual = self.dual()
dims = [a[0] for a in self._indices]
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)])
tester.assertEqual(m, 1,f "error in dimension {dim}")
tester.assertEqual(m, 1, f"error in dimension {dim}")

class Element(CombinatorialFreeModule.Element):
def to_cycle(self):
Expand Down Expand Up @@ -596,7 +596,8 @@ def __init__(self, base_ring, cell_complex, category=None):
category = Category.join((category,
LeftModules(SteenrodAlgebra(2)),
RightModules(SteenrodAlgebra(2))))
HomologyVectorSpaceWithBasis.__init__(self, base_ring, cell_complex,
HomologyVectorSpaceWithBasis.__init__(self, base_ring,
cell_complex,
cohomology=False,
category=category)

Expand Down Expand Up @@ -681,18 +682,17 @@ def _acted_upon_(self, a, self_on_left):
"""
# Handle field elements first.
if a in self.base_ring():
return self.map_coefficients(lambda c: c*a)
if not self_on_left: # i.e., module element on left
a = a.antipode()

return a * self
m = self.degree()
n = a.degree()
if m <= n:
return self.parent().zero()

if not self_on_left: # i.e., module element on left
a = a.antipode()
P = self.parent()
B = list(P.basis(m-n))
return P._from_dict({b.support()[0]: self.eval(a * x)
return P._from_dict({x.support()[0]: self.eval(a * x)
for x in sorted(self.parent().dual().basis(m-n))})


Expand Down Expand Up @@ -960,7 +960,6 @@ class CohomologyRing_mod2(CohomologyRing):
- ``base_ring`` -- must be the field ``GF(2)``
- ``cell_complex`` -- the cell complex whose homology we are
computing
- ``category`` -- (optional) a subcategory of modules with basis
EXAMPLES:
Expand Down

0 comments on commit cd95bec

Please sign in to comment.