Skip to content

Commit bfb861b

Browse files
author
Release Manager
committed
gh-36849: Problem with orientations of simplices in simplicial complex maps. Problem with orientation of simplices in simplicial complex maps <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> In rare cases, Sage incorrectly computes the chain complex map associated to a map of simplicial complexes. The problem is that the orientation of each simplex in the image is not correctly compared to its actual orientation in the codomain: an edge `(f(v), f(w))` is not compared correctly to see whether the actual simplex in the codomain is stored as `(f(v), f(w))` or `(f(w), f(v))`. I think that the default sorting of vertices (and hence simplices) means that this usually doesn't come up, but it can arise when the vertices do not have an obvious ordering. See https://ask.sagemath.org/question/74754/chain-morphism-between- subdivisions/ for one such case. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [X] The title is concise, informative, and self-explanatory. - [X] The description explains in detail what this PR is about. - [X] I have linked a relevant issue or discussion. - [X] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36849 Reported by: John H. Palmieri Reviewer(s): Travis Scrimshaw
2 parents 1b1673b + b9e9c4b commit bfb861b

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/sage/topology/simplicial_complex_morphism.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,43 @@ def __call__(self, x, orientation=False):
244244
(0, 1)
245245
sage: g(Simplex([0,1]), orientation=True) # needs sage.modules
246246
((0, 1), -1)
247+
248+
TESTS:
249+
250+
Test that the problem in :issue:`36849` has been fixed::
251+
252+
sage: S = SimplicialComplex([[1,2]],is_mutable=False).barycentric_subdivision()
253+
sage: T = SimplicialComplex([[1,2],[2,3],[1,3]],is_mutable=False).barycentric_subdivision()
254+
sage: f = {x[0]:x[0] for x in S.cells()[0]}
255+
sage: H = Hom(S,T)
256+
sage: z = H(f)
257+
sage: z.associated_chain_complex_morphism()
258+
Chain complex morphism:
259+
From: Chain complex with at most 2 nonzero terms over Integer Ring
260+
To: Chain complex with at most 2 nonzero terms over Integer Ring
247261
"""
248262
dim = self.domain().dimension()
249263
if not isinstance(x, Simplex) or x.dimension() > dim or x not in self.domain().faces()[x.dimension()]:
250264
raise ValueError("x must be a simplex of the source of f")
251265
tup = x.tuple()
252-
fx = []
253-
for j in tup:
254-
fx.append(self._vertex_dictionary[j])
266+
fx = [self._vertex_dictionary[j] for j in tup]
255267
if orientation:
256268
from sage.algebras.steenrod.steenrod_algebra_misc import convert_perm
257269
from sage.combinat.permutation import Permutation
258270

259271
if len(set(fx)) == len(tup):
260-
oriented = Permutation(convert_perm(fx)).signature()
272+
# We need to compare the image simplex, as given in
273+
# the order specified by self, with its orientation in
274+
# the codomain.
275+
image = Simplex(set(fx))
276+
Y_faces = self.codomain()._n_cells_sorted(image.dimension())
277+
idx = Y_faces.index(image)
278+
actual_image = Y_faces[idx]
279+
# The signature of the permutation specified by self:
280+
sign_image = Permutation(convert_perm(fx)).signature()
281+
# The signature of the permutation of the simplex in the domain:
282+
sign_simplex = Permutation(convert_perm(actual_image)).signature()
283+
oriented = sign_image * sign_simplex
261284
else:
262285
oriented = 1
263286
return (Simplex(set(fx)), oriented)

0 commit comments

Comments
 (0)