typo in simplicial complex documentation?

67 views
Skip to first unread message

David Joyner

unread,
Jun 8, 2017, 8:16:15 PM6/8/17
to SAGE support
Hi all:

This is kind of a newbie question, as I'm not an expert on simplicial
complexes. It's also a minor technical issue on the documentation, not
the code.

I'm trying to debug some code of mine and, on reading the
documentation for chain_complex on
http://doc.sagemath.org/html/en/reference/homology/sage/homology/simplicial_complex.html,
found this: "The rows and columns of the boundary matrices are indexed
by the lists given by the n_cells() method, which by default are
sorted." On the other hand, the documentation for n_cells has this
statement: "Sort the list if the argument sort is True. If sort is
None (the default), then sort depending on the value of the
sort_facets parameter (from the initialization of the simplicial
complex)." However, the sort_facets parameter (unless I'm mistaken)
does not sort the individual faces but rather sorts the vertices in
each facet. In my code, I expected the faces of a fixed dimension to
be returned as a deterministic sorted list not a set whose ordering
could be random. Now, it *does* seem as though the faces are sorted.
It's just that, to me, the documentation of n_cells doesn't make that
clear.

I'm asking if I'm mis-understanding something here or not.

- David Joyner

John H Palmieri

unread,
Jun 8, 2017, 10:49:41 PM6/8/17
to sage-support


On Thursday, June 8, 2017 at 5:16:15 PM UTC-7, David Joyner wrote:
Hi all:

This is kind of a newbie question, as I'm not an expert on simplicial
complexes. It's also a minor technical issue on the documentation, not
the code.

I'm trying to debug some code of mine and, on reading the
documentation for chain_complex on
http://doc.sagemath.org/html/en/reference/homology/sage/homology/simplicial_complex.html,
found this: "The rows and columns of the boundary matrices are indexed
by the lists given by the n_cells() method, which by default are
sorted." On the other hand, the documentation for n_cells has this
statement: "Sort the list if the argument sort is True. If sort is
None (the default), then sort depending on the value of the
sort_facets parameter (from  the initialization of the simplicial
complex)." However, the sort_facets parameter (unless I'm mistaken)
does not sort the individual faces but rather sorts the vertices in
each facet.

The documentation means that if "sort_facets" was True originally, then n_cells will also sort its result before returning it. ("then sort depending on the value of the sort_facets parameter": so if sort_facets was True, then n_cells should also sort. It doesn't mean "sort using the effect of the sort_facets parameter", but sort depending on its value, which is True or False. This could be made clearer, I guess.)

I don't know if there is ever a good reason to specify sort_facets=False. Maybe we should deprecate it?
 
In my code, I expected the faces of a fixed dimension to
be returned as a deterministic sorted list not a set whose ordering
could be random. Now, it *does* seem as though the faces are sorted.
It's just that, to me, the documentation of n_cells doesn't make that
clear.

I'm asking if I'm mis-understanding something here or not.

- David Joyner

--
John
 

David Joyner

unread,
Jun 10, 2017, 10:05:49 PM6/10/17
to SAGE support
On Thu, Jun 8, 2017 at 10:49 PM, John H Palmieri <jhpalm...@gmail.com> wrote:
>
>
> On Thursday, June 8, 2017 at 5:16:15 PM UTC-7, David Joyner wrote:
>>
>> Hi all:
>>
>> This is kind of a newbie question, as I'm not an expert on simplicial
>> complexes. It's also a minor technical issue on the documentation, not
>> the code.
>>
>> I'm trying to debug some code of mine and, on reading the
>> documentation for chain_complex on
>>
>> http://doc.sagemath.org/html/en/reference/homology/sage/homology/simplicial_complex.html,
>> found this: "The rows and columns of the boundary matrices are indexed
>> by the lists given by the n_cells() method, which by default are
>> sorted." On the other hand, the documentation for n_cells has this
>> statement: "Sort the list if the argument sort is True. If sort is
>> None (the default), then sort depending on the value of the
>> sort_facets parameter (from the initialization of the simplicial
>> complex)." However, the sort_facets parameter (unless I'm mistaken)
>> does not sort the individual faces but rather sorts the vertices in
>> each facet.
>
>
> The documentation means that if "sort_facets" was True originally, then
> n_cells will also sort its result before returning it. ("then sort depending
> on the value of the sort_facets parameter": so if sort_facets was True, then
> n_cells should also sort. It doesn't mean "sort using the effect of the
> sort_facets parameter", but sort depending on its value, which is True or
> False. This could be made clearer, I guess.)
>


To be clear, I am getting different computations using the same sage
computations on different machines. One (recent, but used, linux)
machine consistently gives ones result, the other gives (randomly?)
several others. The "other" (a 8 yr old, a mac with possibly memory
issues) machine gives different results. I'm not saying your methods
are machine dependent, just that *for me* they seem to be.

To be clear, these "inconsistent" computations take at least one day.
The "toy" (consistent) examples are okay.

> I don't know if there is ever a good reason to specify sort_facets=False.
> Maybe we should deprecate it?
>
>>
>> In my code, I expected the faces of a fixed dimension to
>> be returned as a deterministic sorted list not a set whose ordering
>> could be random. Now, it *does* seem as though the faces are sorted.
>> It's just that, to me, the documentation of n_cells doesn't make that
>> clear.
>>
>> I'm asking if I'm mis-understanding something here or not.
>>
>> - David Joyner
>
>
> --
> John
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

John H Palmieri

unread,
Jun 11, 2017, 11:30:40 AM6/11/17
to sage-support

That's strange. Are you just getting different orders when you sort, or different answers for homology? Are the answers consistent on each machine? What type of object are the vertices?
 

David Joyner

unread,
Jun 11, 2017, 1:13:52 PM6/11/17
to SAGE support
On Sun, Jun 11, 2017 at 11:30 AM, John H Palmieri
The example which gives strange output is the bipyramid complex:

S = SimplicialComplex(maximal_faces=[(1,2,3), (1,2,4),\
(1,2,5), (1,3,4),(1,3,5),(2,3,4),(2,3,5)])

which has 9 1-faces. I'm computing the list of all stable configurations,
namely vectors c in ZZ^9 having non-negative components which cannot
fire (in the sense of chip-firing - see Duval, Klivans, Martin
https://arxiv.org/pdf/1101.3981.pdf) with respect to the 1-dimls simplicial
spanning tree given by the 1-faces (1, 4), (1,5), (2,5), (3,4). On an old
mac running OS 10.11.6 and sage 7.2.b0, the output is usually 268125,
after about a day, but once I also got 137500. On a linux machine running
ubuntu and sage 7.3, I always get 395625. These computations use
the S.chain_complex.differential method to compute the 1-diml
combinatorial up Laplacian, Q, then does a time-consuming search.
(Basically, I check that no column vector q of Q, except possibly one
corresponding to a face in the spanning tree, has the property that
all components of c-q remain non-negative, except possibly those
corresponding to a face in the spanning tree.)

A similar computation using the 3-simplex is relatively quick and
always produces
2500 stable configurations for both machines.

John H Palmieri

unread,
Jun 11, 2017, 3:20:26 PM6/11/17
to sage-support

The sorting was introduced after 7.2, so it's not surprising if that version gives different results. The sorting certainly affects the chain complex, and it is possible in older versions that the ordering used for the simplices to define the matrices for the chain complex is somewhat arbitrary, and not necessarily consistent with other methods for simplicial complexes. I would trust Sage 7.3 over 7.2 because of this sorting. I don't think any relevant changes have been made since 7.3, but it would be interesting to see if you get different results with 7.6 or 8.0.

  John

 

David Joyner

unread,
Jun 12, 2017, 5:45:25 AM6/12/17
to SAGE support
I'm relieved to hear this.

> and it is possible in older versions that the ordering used for the
> simplices to define the matrices for the chain complex is somewhat
> arbitrary, and not necessarily consistent with other methods for simplicial
> complexes. I would trust Sage 7.3 over 7.2 because of this sorting. I don't
> think any relevant changes have been made since 7.3, but it would be
> interesting to see if you get different results with 7.6 or 8.0.
>

Yesterday, I deleted 7.2 and installed 7.6. After a long computation,
it too produces 395625.

Thank you!
Reply all
Reply to author
Forward
0 new messages