#6101: computation of induced morphism on homology and cohomology of simplicial
complex morphisms
-------------------------------------+-------------------------------------
       Reporter:  bantieau           |        Owner:  bantieau
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.10
      Component:  algebraic          |   Resolution:
  topology                           |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/jhpalmieri       |  ec81de20addced6a723f51413c3ffb31eaf4bc13
  /induced-maps                      |     Stopgaps:
   Dependencies:  #19179, #6102      |
-------------------------------------+-------------------------------------

Comment (by jhpalmieri):

 Going this route tempts me to make `Simplex` inherit from `Element`, but
 you might want to construct abstract instances of `Simplex` which are not
 elements of any particular complex. So I can't use the `Element.__init__`
 method, which requires setting a parent. As a result, I don't think I can
 use `_element_constructor_` for simplicial complexes. Instead, I can do
 something like this (plus doctests):
 {{{
 #!diff
 diff --git a/src/sage/homology/simplicial_complex.py
 b/src/sage/homology/simplicial_complex.py
 index 8d00cd6..366c1db 100644
 --- a/src/sage/homology/simplicial_complex.py
 +++ b/src/sage/homology/simplicial_complex.py
 @@ -1077,6 +1077,21 @@ class SimplicialComplex(Parent,
 GenericCellComplex):
          """
          return self._vertex_set

 +    def _an_element_(self):
 +        return self.facets()[0]
 +
 +    def __contains__(self, x):
 +        if not isinstance(x, Simplex):
 +            return False
 +        dim = x.dimension()
 +        return x in self.n_faces(dim)
 +
 +    def __call__(self, simplex):    # not _element_constructor_
 +        if simplex not in self:
 +            raise ValueError
 +        return simplex
 +
      def maximal_faces(self):
          """
          The maximal faces (a.k.a. facets) of this simplicial complex.
 }}}
 Then the full test suite passes.

--
Ticket URL: <http://trac.sagemath.org/ticket/6101#comment:32>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to