@@ -244,20 +244,41 @@ def __call__(self, x, orientation=False):
244
244
(0, 1)
245
245
sage: g(Simplex([0,1]), orientation=True) # needs sage.modules
246
246
((0, 1), -1)
247
+
248
+ TESTS::
249
+
250
+ sage: S = SimplicialComplex([[1,2]],is_mutable=False).barycentric_subdivision()
251
+ sage: T = SimplicialComplex([[1,2],[2,3],[1,3]],is_mutable=False).barycentric_subdivision()
252
+ sage: f = {x[0]:x[0] for x in S.cells()[0]}
253
+ sage: H = Hom(S,T)
254
+ sage: z = H(f)
255
+ sage: z.associated_chain_complex_morphism()
256
+ Chain complex morphism:
257
+ From: Chain complex with at most 2 nonzero terms over Integer Ring
258
+ To: Chain complex with at most 2 nonzero terms over Integer Ring
247
259
"""
248
260
dim = self .domain ().dimension ()
249
261
if not isinstance (x , Simplex ) or x .dimension () > dim or x not in self .domain ().faces ()[x .dimension ()]:
250
262
raise ValueError ("x must be a simplex of the source of f" )
251
263
tup = x .tuple ()
252
- fx = []
253
- for j in tup :
254
- fx .append (self ._vertex_dictionary [j ])
264
+ fx = [self ._vertex_dictionary [j ] for j in tup ]
255
265
if orientation :
256
266
from sage .algebras .steenrod .steenrod_algebra_misc import convert_perm
257
267
from sage .combinat .permutation import Permutation
258
268
259
269
if len (set (fx )) == len (tup ):
260
- oriented = Permutation (convert_perm (fx )).signature ()
270
+ # We need to compare the image simplex, as given in
271
+ # the order specified by self, with its orientation in
272
+ # the codomain.
273
+ image = Simplex (set (fx ))
274
+ Y_faces = self .codomain ()._n_cells_sorted (image .dimension ())
275
+ idx = Y_faces .index (image )
276
+ actual_image = Y_faces [idx ]
277
+ # The signature of the permutation specified by self:
278
+ sign_image = Permutation (convert_perm (fx )).signature ()
279
+ # The signature of the permutation of the simplex in the domain:
280
+ sign_simplex = Permutation (convert_perm (actual_image )).signature ()
281
+ oriented = sign_image * sign_simplex
261
282
else :
262
283
oriented = 1
263
284
return (Simplex (set (fx )), oriented )
0 commit comments