Opened 4 years ago

Closed 4 years ago

#14578 closed defect (fixed)

SimplicialComplex chain complex composition not zero

Reported by: vbraun Owned by: jhpalmieri
Priority: major Milestone: sage-5.10
Component: algebraic topology Keywords:
Cc: jhpalmieri, tscrim Merged in: sage-5.10.beta4
Authors: John Palmieri Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Testcase extracted from http://ask.sagemath.org/question/2572/error-computing-homology-of-a-simplicial-complex

sage: t0 = SimplicialComplex()
sage: t0.add_face(('a', 'b'))
sage: t0.add_face(('c', 'd', 'e'))
sage: t0.add_face(('e', 'f', 'c'))
sage: t0.homology()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-374-8061bc7260ca> in <module>()
----> 1 t0.homology()

/home/vbraun/opt/sage-5.10.beta2/local/lib/python2.7/site-packages/sage/homology/cell_complex.pyc in homology(self, dim, **kwds)
    547         # _homology_ method.  See SimplicialComplex for one example.
    548         if hasattr(self, '_homology_'):
--> 549             return self._homology_(dim, **kwds)
    550 
    551         C = self.chain_complex(cochain=cohomology, augmented=True,

/home/vbraun/opt/sage-5.10.beta2/local/lib/python2.7/site-packages/sage/homology/simplicial_complex.pyc in _homology_(self, dim, **kwds)
   1923         kwds['subcomplex']=L
   1924         C = self.chain_complex(dimensions=dims, augmented=True,
-> 1925                                cochain=cohomology, **kwds)
   1926         if verbose:
   1927             print " Done computing the chain complex. "

/home/vbraun/opt/sage-5.10.beta2/local/lib/python2.7/site-packages/sage/homology/simplicial_complex.pyc in chain_complex(self, **kwds)
   1786             return ChainComplex(data=differentials, degree=1, **kwds)
   1787         else:
-> 1788             return ChainComplex(data=differentials, degree=-1, **kwds)
   1789 
   1790     def _homology_(self, dim=None, **kwds):

/home/vbraun/opt/sage-5.10.beta2/local/lib/python2.7/site-packages/sage/homology/chain_complex.pyc in __init__(self, data, **kwds)
    460                             raise TypeError, "The differentials d_{%s} and d_{%s} are not compatible: their product is not defined." % (n, n+degree)
    461                         if not prod.is_zero():
--> 462                             raise ValueError, "The differentials d_{%s} and d_{%s} are not compatible: their composition is not zero." % (n, n+degree)
    463                 else:
    464                     if not mat.nrows() == 0:

ValueError: The differentials d_{2} and d_{1} are not compatible: their composition is not zero.

on sage-5.10.beta2

Attachments (1)

trac_14578-add-face.patch (2.6 KB) - added by jhpalmieri 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 4 years ago by jhpalmieri

The problem is the add_face method: it should sort the new vertex set, just like the __init__ method does. Actually, we should cache the setting of sort_facets, and if True, then add_face should sort the vertex set.

comment:2 Changed 4 years ago by jhpalmieri

First attempt at a patch.

Changed 4 years ago by jhpalmieri

comment:3 Changed 4 years ago by jhpalmieri

  • Cc tscrim added
  • Status changed from new to needs_review

comment:4 Changed 4 years ago by vbraun

  • Authors set to John Palmieri
  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

Looks good to me!

comment:5 Changed 4 years ago by jdemeyer

  • Merged in set to sage-5.10.beta4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.