def __call__(self, x, orientation=False): """ Input is a simplex of the domain. Output is the image simplex. If optional argument ``orientation`` is True, return a pair ``(image simplex, oriented)`` where ``oriented`` is 1 or `-1` depending on whether the map preserves or reverses the orientation of the image simplex. EXAMPLES:: sage: S = simplicial_complexes.Sphere(2) sage: T = simplicial_complexes.Sphere(3) sage: S Simplicial complex with vertex set (0, 1, 2, 3) and facets {(0, 2, 3), (0, 1, 2), (1, 2, 3), (0, 1, 3)} sage: T Simplicial complex with vertex set (0, 1, 2, 3, 4) and 5 facets sage: f = {0:0,1:1,2:2,3:3} sage: H = Hom(S,T) sage: x = H(f) sage: from sage.homology.simplicial_complex import Simplex sage: x(Simplex([0,2,3])) (0, 2, 3) An orientation-reversing example:: sage: X = SimplicialComplex(1, [[0,1]]) sage: g = Hom(X,X)({0:1, 1:0}) sage: g(Simplex([0,1])) (0, 1) sage: g(Simplex([0,1]), orientation=True) ((0, 1), -1) """ dim = self._domain.dimension() if not isinstance(x, simplicial_complex.Simplex) or x.dimension( ) > dim or not x in self._domain.faces()[x.dimension()]: raise ValueError, "x must be a simplex of the source of f" tup = x.tuple() fx = [] for j in tup: fx.append(self._vertex_dictionary[j]) if orientation: if len(set(fx)) == len(tup): oriented = Permutation(convert_perm(fx)).signature() else: oriented = 1 return (simplicial_complex.Simplex(set(fx)), oriented) else: return simplicial_complex.Simplex(set(fx))
def __call__(self, x, orientation=False): """ Input is a simplex of the domain. Output is the image simplex. If the optional argument ``orientation`` is ``True``, then this returns a pair ``(image simplex, oriented)`` where ``oriented`` is 1 or `-1` depending on whether the map preserves or reverses the orientation of the image simplex. EXAMPLES:: sage: S = simplicial_complexes.Sphere(2) sage: T = simplicial_complexes.Sphere(3) sage: S Minimal triangulation of the 2-sphere sage: T Minimal triangulation of the 3-sphere sage: f = {0:0,1:1,2:2,3:3} sage: H = Hom(S,T) sage: x = H(f) sage: from sage.topology.simplicial_complex import Simplex sage: x(Simplex([0,2,3])) (0, 2, 3) An orientation-reversing example:: sage: X = SimplicialComplex([[0,1]], is_mutable=False) sage: g = Hom(X,X)({0:1, 1:0}) sage: g(Simplex([0,1])) (0, 1) sage: g(Simplex([0,1]), orientation=True) ((0, 1), -1) """ dim = self.domain().dimension() if not isinstance(x, Simplex) or x.dimension( ) > dim or x not in self.domain().faces()[x.dimension()]: raise ValueError("x must be a simplex of the source of f") tup = x.tuple() fx = [] for j in tup: fx.append(self._vertex_dictionary[j]) if orientation: if len(set(fx)) == len(tup): oriented = Permutation(convert_perm(fx)).signature() else: oriented = 1 return (Simplex(set(fx)), oriented) else: return Simplex(set(fx))
def __call__(self,x,orientation=False): """ Input is a simplex of the domain. Output is the image simplex. If the optional argument ``orientation`` is ``True``, then this returns a pair ``(image simplex, oriented)`` where ``oriented`` is 1 or `-1` depending on whether the map preserves or reverses the orientation of the image simplex. EXAMPLES:: sage: S = simplicial_complexes.Sphere(2) sage: T = simplicial_complexes.Sphere(3) sage: S Simplicial complex with vertex set (0, 1, 2, 3) and facets {(0, 2, 3), (0, 1, 2), (1, 2, 3), (0, 1, 3)} sage: T Simplicial complex with vertex set (0, 1, 2, 3, 4) and 5 facets sage: f = {0:0,1:1,2:2,3:3} sage: H = Hom(S,T) sage: x = H(f) sage: from sage.homology.simplicial_complex import Simplex sage: x(Simplex([0,2,3])) (0, 2, 3) An orientation-reversing example:: sage: X = SimplicialComplex([[0,1]], is_mutable=False) sage: g = Hom(X,X)({0:1, 1:0}) sage: g(Simplex([0,1])) (0, 1) sage: g(Simplex([0,1]), orientation=True) ((0, 1), -1) """ dim = self._domain.dimension() if not isinstance(x,simplicial_complex.Simplex) or x.dimension() > dim or not x in self._domain.faces()[x.dimension()]: raise ValueError, "x must be a simplex of the source of f" tup=x.tuple() fx=[] for j in tup: fx.append(self._vertex_dictionary[j]) if orientation: if len(set(fx)) == len(tup): oriented = Permutation(convert_perm(fx)).signature() else: oriented = 1 return (simplicial_complex.Simplex(set(fx)), oriented) else: return simplicial_complex.Simplex(set(fx))