From 3386b9771da01f0be07d4399144a7f4614c03a76 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Fri, 22 Sep 2023 19:08:36 -0700 Subject: [PATCH] tidying up reviewer changes, adding a few other small fixes --- .../homology_vector_space_with_basis.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/sage/homology/homology_vector_space_with_basis.py b/src/sage/homology/homology_vector_space_with_basis.py index 632f9631052..503da8e6a90 100644 --- a/src/sage/homology/homology_vector_space_with_basis.py +++ b/src/sage/homology/homology_vector_space_with_basis.py @@ -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): @@ -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) @@ -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))}) @@ -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: