Opened 23 months ago

Last modified 3 months ago

#30400 needs_work enhancement

Add finite topological spaces

Reported by: gh-jcuevas-rozo Owned by: gh-jcuevas-rozo
Priority: major Milestone: sage-9.7
Component: algebraic topology Keywords: Finite topological spaces
Cc: jhpalmieri Merged in:
Authors: Julián Cuevas-Rozo Reviewers:
Report Upstream: N/A Work issues: Rework on top of #31925
Branch: u/gh-jcuevas-rozo/add_finite_topological_spaces (Commits, GitHub, GitLab) Commit: 3c2e0d4ce41d764d3d413e81b430087aeed41d7b
Dependencies: #31925 Stopgaps:

Status badges

Description (last modified by gh-jcuevas-rozo)

This ticket provides a class for finite topological spaces and methods dealing with properties in general topology. It is expected to create a second ticket to add algebraic topology properties (see ticket #30447).

Principal reference: Algebraic topology of finite topological spaces and applications by Jonathan Barmak.

Change History (69)

comment:1 Changed 23 months ago by gh-jcuevas-rozo

  • Branch set to u/gh-jcuevas-rozo/add_finite_topological_spaces

comment:2 Changed 23 months ago by gh-jcuevas-rozo

  • Commit set to f1045dbe82ab5effd639d8489536bff267d5fbf4

I have added the file finite_topological_spaces.py in ~/sage/src/sage/homology. I think this is a correct place to put it because different methods dealing with homotopy types and weak homotopy types will be added in next commits, but the discussion is open and I accept other suggestions in order to put it in the correct place.


New commits:

f1045dbFiniteTopologicalSpace class and methods in general topology added

comment:3 Changed 23 months ago by gh-jcuevas-rozo

  • Owner changed from (none) to gh-jcuevas-rozo

comment:4 Changed 23 months ago by git

  • Commit changed from f1045dbe82ab5effd639d8489536bff267d5fbf4 to 1cbdd3f968554b5f3bd7049b728c2cfa3950ca83

Branch pushed to git repo; I updated commit sha1. New commits:

1cbdd3fDocumentation added

comment:5 Changed 23 months ago by gh-jcuevas-rozo

  • Description modified (diff)
  • Status changed from new to needs_review

comment:6 Changed 23 months ago by gh-jcuevas-rozo

I have changed the status to needs_review. I have created a ticket #30447 where I will continue to working about the changes made in this ticket #30400, but... how can I import such changes to the new ticket? (how to link #30447 to #30400?)

comment:7 Changed 23 months ago by jhpalmieri

Add #30400 in the dependency field on #30447. (I've done that.)

comment:8 Changed 23 months ago by gh-jcuevas-rozo

Thank you so much, I've learned it for next tickets.

comment:9 Changed 23 months ago by git

  • Commit changed from 1cbdd3f968554b5f3bd7049b728c2cfa3950ca83 to e51800dfe3c0a5e36ea32c0073b3e40a61e5ba5c

Branch pushed to git repo; I updated commit sha1. New commits:

e51800dFailures in tests repaired

comment:10 follow-up: Changed 23 months ago by jhpalmieri

I'm getting some doctest failures. Also, it would be nice to add this to the reference manual. Here are changes to fix some of these:

  • src/doc/en/reference/homology/index.rst

    diff --git a/src/doc/en/reference/homology/index.rst b/src/doc/en/reference/homology/index.rst
    index bf98e0841f..148dc4bae0 100644
    a b cell complexes. 
    3535   sage/homology/algebraic_topological_model
    3636   sage/homology/homology_morphism
    3737   sage/homology/matrix_utils
     38   sage/homology/finite_topological_spaces
    3839   sage/interfaces/chomp
    3940
    4041.. include:: ../footer.txt
  • src/sage/homology/finite_topological_spaces.py

    diff --git a/src/sage/homology/finite_topological_spaces.py b/src/sage/homology/finite_topological_spaces.py
    index 3a43eabed4..430e2a84ad 100644
    a b from sage.combinat.posets.hasse_diagram import HasseDiagram 
    7272def dict_to_matrix(ordered_eltos, dictionary):
    7373    r"""
    7474    Return a matrix from the information given by ``dictionary``.   
     75
    7576    INPUT:
    7677
    7778    - ``ordered_eltos`` -- a list.
    def dict_to_matrix(ordered_eltos, dictionary): 
    7980    - ``dictionary`` -- a dict whose key list is ``ordered_eltos`` and its values
    8081      are sets of elements in ``ordered_eltos``.
    8182
    82     OUTPUT::
     83    OUTPUT:
    8384
    8485    - A binary matrix whose `(i,j)` entry is equal to 1 if and only if ``ordered_eltos[i]``
    8586      is in ``dictionary[ordered_eltos[j]]``.
    def FiniteSpace(data, elements=None, is_T0=False): 
    124125    - ``elements`` -- it is ignored when data is of type 1, 2 or 4. When ``data``
    125126      is a topogenous matrix, this parameter gives the underlying set of the space.
    126127
    127     EXAMPLES::
     128    EXAMPLES:
    128129
    129130    A dictionary as ``data``::
    130131
    def FiniteSpace(data, elements=None, is_T0=False): 
    135136        sage: type(T)
    136137        <class 'sage.homology.finite_topological_spaces.FiniteTopologicalSpace'>
    137138        sage: FiniteSpace({'a': {'a', 'b'}})
    138         Traceback (most recent call last)
     139        Traceback (most recent call last):
    139140        ...
    140141        ValueError: The data does not correspond to a valid dictionary
    141142        sage: FiniteSpace({'a': {'a', 'b'}, 'b': {'a', 'b'}, 'c': {'a', 'c'}})
    142         Traceback (most recent call last)
     143        Traceback (most recent call last):
    143144        ...
    144145        ValueError: The introduced data does not define a topology
    145146
    146147    When ``data`` is a tuple or a list, the elements are in ``range(n)`` where
    147     ``n`` is the lenght of ``data``::
     148    ``n`` is the length of ``data``::
    148149
    149150        sage: from sage.homology.finite_topological_spaces import FiniteSpace
    150151        sage: T = FiniteSpace([{0, 3}, {1, 3}, {2, 3}, {3}]) ; T
    def FiniteSpace(data, elements=None, is_T0=False): 
    155156        sage: T.elements()
    156157        [3, 0, 1, 2]
    157158        sage: FiniteSpace(({0, 2}, {0, 2}))
    158         Traceback (most recent call last)
     159        Traceback (most recent call last):
    159160        ...
    160161        ValueError: This kind of data assume the elements are in range(2)
    161162
    def FiniteSpace(data, elements=None, is_T0=False): 
    182183        sage: M.elements()
    183184        [5, 'e', 'h', 0, 'c']
    184185        sage: FiniteSpace(mat, elements=[5, 'e', 'h', 0, 0])
    185         Traceback (most recent call last)
     186        Traceback (most recent call last):
    186187        ...
    187188        AssertionError: Not valid list of elements
    188189
    class FiniteTopologicalSpace(Parent): 
    386387            sage: from sage.homology.finite_topological_spaces import FiniteSpace
    387388            sage: T = FiniteSpace(({0}, {1}, {2, 3}, {3}))
    388389            sage: T.underlying_set()
     390            {0, 1, 2, 3}
    389391           
    390392        """
    391393        return set(self._elements)
    class FiniteTopologicalSpace(Parent): 
    474476            sage: T.Ux(4)
    475477            {3, 4}
    476478            sage: T.Ux(5)
    477             Traceback (most recent call last)
     479            Traceback (most recent call last):
    478480            ...
    479481            ValueError: The point 5 is not an element of the space
    480482        """
    class FiniteTopologicalSpace(Parent): 
    787789            True
    788790            sage: T.boundary(T.boundary(Fr)) == T.boundary(Fr)
    789791            True
    790             sage: X == Fr.union(T.interior(E), T.exterior(E))|||
     792            sage: X == Fr.union(T.interior(E), T.exterior(E))
    791793            True
    792794        """
    793795        X = self.underlying_set()

I get sporadic doctest failures:

sage -t --warn-long 80.8 --random-seed=0 src/sage/homology/finite_topological_spaces.py
**********************************************************************
File "src/sage/homology/finite_topological_spaces.py", line 133, in sage.homology.finite_topological_spaces.FiniteSpace
Failed example:
    T = FiniteSpace({'a': {'a', 'c'}, 'b': {'b'}, 'c':{'a', 'c'}}) ; T
Expected:
    Finite topological space of 3 points with minimal basis
     {'a': {'c', 'a'}, 'b': {'b'}, 'c': {'c', 'a'}}
Got:
    Finite topological space of 3 points with minimal basis 
     {'a': {'a', 'c'}, 'b': {'b'}, 'c': {'a', 'c'}}
**********************************************************************
File "src/sage/homology/finite_topological_spaces.py", line 180, in sage.homology.finite_topological_spaces.FiniteSpace
Failed example:
    M = FiniteSpace(mat, elements=(5, 'e', 'h', 0, 'c')) ; M
Expected:
    Finite topological space of 5 points with minimal basis
     {5: {5}, 'e': {'h', 'e'}, 'h': {'h', 'e'}, 0: {0, 'c', 5}, 'c': {0, 'c', 5}}
Got:
    Finite topological space of 5 points with minimal basis 
     {5: {5}, 'e': {'e', 'h'}, 'h': {'e', 'h'}, 0: {0, 'c', 5}, 'c': {0, 'c', 5}}
**********************************************************************
File "src/sage/homology/finite_topological_spaces.py", line 319, in sage.homology.finite_topological_spaces.FiniteTopologicalSpace.__init__
Failed example:
    T = FiniteTopologicalSpace(elements, minimal_basis, matrix(mat_dict)) ; T
Expected:
    Finite topological space of 4 points with minimal basis
     {'a': {3, 'a'}, 3: {3, 'a'}, 2: {1, 2}, 1: {1}}
Got:
    Finite topological space of 4 points with minimal basis 
     {'a': {'a', 3}, 3: {'a', 3}, 2: {1, 2}, 1: {1}}
**********************************************************************
2 items had failures:
   2 of  24 in sage.homology.finite_topological_spaces.FiniteSpace
   1 of   7 in sage.homology.finite_topological_spaces.FiniteTopologicalSpace.__init__
    [231 tests, 3 failures, 0.13 s]
----------------------------------------------------------------------
sage -t --warn-long 80.8 --random-seed=0 src/sage/homology/finite_topological_spaces.py  # 3 doctests failed
----------------------------------------------------------------------

The issue is that these sets may print in different orders, and I think it's more or less random.

By the way, it's better to say if E is None instead of if E == None.


New commits:

e51800dFailures in tests repaired

comment:11 Changed 23 months ago by git

  • Commit changed from e51800dfe3c0a5e36ea32c0073b3e40a61e5ba5c to 7b777873dae08b042218aad1299c49479926823c

Branch pushed to git repo; I updated commit sha1. New commits:

7b77787Failure tests repaired

comment:12 Changed 23 months ago by git

  • Commit changed from 7b777873dae08b042218aad1299c49479926823c to 124dc44a4ae468033867502116ab71b4ab0b5e8b

Branch pushed to git repo; I updated commit sha1. New commits:

124dc44Repairing failures shown in comment 10 from jhpalmieri

comment:13 in reply to: ↑ 10 Changed 23 months ago by gh-jcuevas-rozo

Replying to jhpalmieri:

I'm getting some doctest failures. Also, it would be nice to add this to the reference manual. Here are changes to fix some of these:

Thanks for the suggestions, I have changed the files in order to include the improvements.

The issue is that these sets may print in different orders, and I think it's more or less random.

I see... I think it depends on the implementation of sets in SageMath, do I have to impose an specific order for printing or it is not necessary?

comment:14 Changed 23 months ago by jhpalmieri

Doctests have to pass, so something has to change. Here are suggestions, but if you can think of meaningful doctests that don't rely on the ordering (one example is the test T._minimal_basis['a'] == ... below), it's better than just marking everything # random.

  • src/sage/homology/finite_topological_spaces.py

    diff --git a/src/sage/homology/finite_topological_spaces.py b/src/sage/homology/finite_topological_spaces.py
    index 5c40fe26ce..548322f174 100644
    a b def FiniteSpace(data, elements=None, is_T0=False): 
    127127    A dictionary as ``data``::
    128128
    129129        sage: from sage.homology.finite_topological_spaces import FiniteSpace
    130         sage: T = FiniteSpace({'a': {'a', 'c'}, 'b': {'b'}, 'c':{'a', 'c'}}) ; T
     130        sage: T = FiniteSpace({'a': {'a', 'c'}, 'b': {'b'}, 'c':{'a', 'c'}})
     131        sage: T # random
    131132        Finite topological space of 3 points with minimal basis
    132133         {'a': {'c', 'a'}, 'b': {'b'}, 'c': {'c', 'a'}}
     134        sage: T._minimal_basis # random
     135         {'a': {'c', 'a'}, 'b': {'b'}, 'c': {'c', 'a'}}
     136        sage: T._minimal_basis['a'] == set(['a', 'c'])
     137        True
    133138        sage: type(T)
    134139        <class 'sage.homology.finite_topological_spaces.FiniteTopologicalSpace'>
    135140        sage: FiniteSpace({'a': {'a', 'b'}})
    def FiniteSpace(data, elements=None, is_T0=False): 
    174179         {0: {0}, 1: {1, 2}, 2: {1, 2}, 3: {0, 3, 4}, 4: {0, 3, 4}}
    175180        sage: T.elements()
    176181        [0, 1, 2, 3, 4]
    177         sage: M = FiniteSpace(mat, elements=(5, 'e', 'h', 0, 'c')) ; M
     182        sage: M = FiniteSpace(mat, elements=(5, 'e', 'h', 0, 'c'))
     183        sage: M # random
    178184        Finite topological space of 5 points with minimal basis
    179185         {5: {5}, 'e': {'h', 'e'}, 'h': {'h', 'e'}, 0: {0, 'c', 5}, 'c': {0, 'c', 5}}
    180186        sage: M.elements()
    class FiniteTopologicalSpace(Parent): 
    313319            sage: minimal_basis = {'a': {3, 'a'}, 3: {3, 'a'}, 2: {2, 1}, 1: {1}}
    314320            sage: mat_dict = {(0, 0): 1, (0, 1): 1, (1, 1): 1, (2, 2): 1, \
    315321            ....:             (2, 3): 1, (3, 2): 1, (3, 3): 1}
    316             sage: T = FiniteTopologicalSpace(elements, minimal_basis, matrix(mat_dict)) ; T
     322            sage: T = FiniteTopologicalSpace(elements, minimal_basis, matrix(mat_dict))
     323            sage: T # random
    317324            Finite topological space of 4 points with minimal basis
    318325             {'a': {3, 'a'}, 3: {3, 'a'}, 2: {1, 2}, 1: {1}}
    319326            sage: T.topogenous_matrix() == matrix(mat_dict)
    class FiniteTopologicalSpace(Parent): 
    325332        self._minimal_basis = minimal_basis
    326333        self._topogenous = topogenous
    327334
    328     def __repr__(self):
     335    def _repr_(self):
    329336        r"""
    330337        Print representation.
    331338
    class FiniteTopologicalSpace_T0(FiniteTopologicalSpace): 
    10121019        self._poset = poset
    10131020        self._T0 = True
    10141021
    1015     def __repr__(self):
     1022    def _repr_(self):
    10161023        r"""
    10171024        Print representation.
    10181025

By the way, for classes which inherit from SageObject, like Parent, it is better to define _repr_ rather than __repr__. See https://doc.sagemath.org/html/en/developer/coding_in_python.html#print-representation.

comment:15 Changed 23 months ago by jhpalmieri

More suggestions:

  • src/doc/en/reference/references/index.rst

    diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst
    index c58f1acbb9..96157140c4 100644
    a b REFERENCES: 
    181181             of the Slovak Academy of Sciences. Mathematica Slovaca vol 30, n 4,
    182182             pages 405--417, 1980
    183183
     184.. [Ale1937] \P. Alexandroff, *Diskrete Raume*, Mat. Sb. (N.S.) 2, 501--518 (1937).
     185
    184186.. [Al1947] \A. A. Albert, *A Structure Theory for Jordan
    185187            Algebras*. Annals of Mathematics, Second Series, Vol. 48,
    186188            No. 3 (Jul., 1947), pp. 546--567.
    REFERENCES: 
    373375             Four Russians'. Cryptography E-Print Archive
    374376             (http://eprint.iacr.org/2006/251.pdf), 2006.
    375377
     378.. [Bar2011] \J. A. Barmak,
     379             *Algebraic topology of finite topological spaces and applications*.
     380             Lecture Notes in Mathematics Vol. 2032 (2011).
     381
    376382.. [Bat1991] \V. V. Batyrev, *On the classification of smooth projective
    377383             toric varieties*, Tohoku Math. J. **43** (1991), 569-585
    378384
    REFERENCES: 
    48804886              *Generation of random chordal graphs using subtrees of a tree*,
    48814887              :arxiv:`1810.13326v1`.
    48824888
     4889.. [Shi1968] \M. Shiraki, *On finite topological spaces*,
     4890             Rep. Fac. Sci. Kagoshima Univ.  1, 1--8 (1968).
     4891
    48834892.. [Shi2002] \M. Shimozono
    48844893             *Affine type A crystal structure on tensor products of rectangles,
    48854894             Demazure characters, and nilpotent varieties*,
  • src/sage/homology/finite_topological_spaces.py

    diff --git a/src/sage/homology/finite_topological_spaces.py b/src/sage/homology/finite_topological_spaces.py
    index 5c40fe26ce..c01c344ca2 100644
    a b A *finite topological space* is a topological space with finitely many points an 
    77a *finite preordered set* is a finite set with a transitive and reflexive relation.
    88Finite spaces and finite preordered sets are basically the same objects considered
    99from different perspectives. Given a finite topological space `X`, for every point
    10 `x\in X` the *minimal open set* `U_x` as the intersection of all the open sets
     10`x\in X`, define the *minimal open set* `U_x` as the intersection of all the open sets
    1111which contain `x` (it is an open set since arbitrary intersections of open sets
    1212in finite spaces are open). The minimal open sets constitute a basis for the topology
    1313of `X`. Indeed, any open set `U` of `X` is the union of the sets `U_x` with `x\in U`.
    14 This basis is called the *minimal basis of `X`*. A preorder on `X` by `x\leqslant y`
     14This basis is called the *minimal basis of* `X`. A preorder on `X` is given by `x\leqslant y`
    1515if `x\in U_y`.
    1616
    1717If `X` is now a finite preordered set, one can define a topology on `X` given by
    then `y` is contained in every basic set containing `x`, and therefore `y\in U_x 
    2020Conversely, if `y\in U_x`, then `y\in\lbrace z\in X\vert z\leqslant x\rbrace`.
    2121Therefore `y\leqslant x` if and only if `y\in U_x`. This shows that these two
    2222applications, relating topologies and preorders on a finite set, are mutually
    23 inverse. This simple remark, made in first place by Alexandroff [1], allows us to study
     23inverse. This simple remark, made in first place by Alexandroff [Ale1937]_, allows us to study
    2424finite spaces by combining Algebraic Topology with the combinatorics arising from
    2525their intrinsic preorder structures. The antisymmetry of a finite preorder
    2626corresponds exactly to the `T_0` separation axiom. Recall that a topological space
    27 `X` is said to be *`T_0`* if for any pair of points in `X` there exists an open
     27`X` is said to be `T_0` if for any pair of points in `X` there exists an open
    2828set containing one and only one of them. Therefore finite `T_0`-spaces are in
    29 correspondence with finite partially ordered sets (posets) [2].
     29correspondence with finite partially ordered sets (posets) [Bar2011]_.
    3030
    3131Now, if `X = \lbrace x_1, x_2, \ldots , x_n\rbrace` is a finite space and for
    3232each `i` the unique minimal open set containing `x_i` is denoted by `U_i`, a
    33 *topogenous matrix* of the space is a `n \times n` matrix `A = \left[a_{ij}\right]`
     33*topogenous matrix* of the space is the `n \times n` matrix `A = \left[a_{ij}\right]`
    3434defined by `a_{ij} = 1` if `x_i \in U_j` and `a_{ij} = 0` otherwise (this is the
    35 transposed matrix of the Definition 1 in [3]). A finite space `X` is `T_0` if and
     35transposed matrix of the Definition 1 in [Shi1968]_). A finite space `X` is `T_0` if and
    3636only if the topogenous matrix `A` defined above is similar (via a permutation matrix)
    37 to a certain upper triangular matrix [3]. This is the reason one can assume that
     37to a certain upper triangular matrix [Shi1968]_. This is the reason one can assume that
    3838the topogenous matrix of a finite `T_0`-space is upper triangular.
    3939
    4040
    AUTHOR:: 
    4444
    4545REFERENCES:
    4646
    47 - [1] Alexandroff P., *Diskrete Raume*, Mat. Sb. (N.S.) 2, 501--518 (1937).
    48 - [2] Barmak, J.A., *Algebraic topology of finite topological spaces and applications*.
    49       Lecture Notes in Mathematics Vol. 2032 (2011).
    50 - [3] Shiraki M., *On finite topological spaces*, Rep. Fac. Sci. Kagoshima Univ.
    51       1, 1--8 (1968).
     47- [Ale1937]_
     48- [Bar2011]_
     49- [Shi1968]_
    5250
    5351"""
    5452# ****************************************************************************
    class FiniteTopologicalSpace(Parent): 
    559564            ...
    560565            ValueError: Parameter 'points' is not a valid set of representatives
    561566        """
    562         if self._T0==True:
     567        if self._T0 is True:
    563568            return self
    564569        else:
    565570            if points is None:
    566571                points = [list(A)[0] for A in self._T0]
    567             elif check==True:
     572            elif check:
    568573                assert isinstance(points, (tuple, list, set)), \
    569574                       "Parameter 'points' must be of type tuple, list or set"
    570575                assert len(points)==len(self._T0), \

comment:16 Changed 23 months ago by git

  • Commit changed from 124dc44a4ae468033867502116ab71b4ab0b5e8b to 6efd9ed73aa50508bf28a3af876e7143357eeb7f

Branch pushed to git repo; I updated commit sha1. New commits:

6efd9edReparing failures shown in comments 14 and 15 ticket 30400

comment:17 Changed 23 months ago by gh-jcuevas-rozo

I have fixed some failures shown in comments 14 and 15. I have added a method space_sorting, which allows to sort the print representation of finite spaces (I have learned to run doctests and I had not got failures after defining such method).

comment:18 follow-up: Changed 22 months ago by chapoton

maybe you could get rid of dict_to_matrix, used only once

comment:19 Changed 22 months ago by git

  • Commit changed from 6efd9ed73aa50508bf28a3af876e7143357eeb7f to 38c2e84aebdc349988a8e59c91d3dcd832e18792

Branch pushed to git repo; I updated commit sha1. New commits:

38c2e84dict_to_matrix function removed

comment:20 in reply to: ↑ 18 Changed 22 months ago by gh-jcuevas-rozo

Replying to chapoton:

maybe you could get rid of dict_to_matrix, used only once

Thanks for the suggestion.

comment:21 follow-up: Changed 21 months ago by gh-jcuevas-rozo

What could be the reason why this ticket passed the tests on October 18 but not on October 22? It has not been modified in recent weeks...

comment:22 Changed 21 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:23 Changed 21 months ago by git

  • Commit changed from 38c2e84aebdc349988a8e59c91d3dcd832e18792 to db381f24619e001d0ca42b59ff6f599b318782c2

Branch pushed to git repo; I updated commit sha1. New commits:

f7ea792Merge branch 'master' of git://github.com/sagemath/sage into t/30400/add_finite_topological_spaces
db381f2Order complex and barycentric subdivision added

comment:24 in reply to: ↑ 21 Changed 21 months ago by chapoton

Replying to gh-jcuevas-rozo:

What could be the reason why this ticket passed the tests on October 18 but not on October 22? It has not been modified in recent weeks...

Because sage itself is moving, and the patchbots always use the latest develop branch, which sometimes does not pass all the tests.

By the way, you should pul your real full name in the "Authors" fields here above.

comment:25 Changed 21 months ago by gh-jcuevas-rozo

  • Authors changed from gh-jcuevas-rozo to Julián Cuevas-Rozo

comment:26 Changed 21 months ago by git

  • Commit changed from db381f24619e001d0ca42b59ff6f599b318782c2 to 538a6ab776feb0b53037aa3752b38a01a3adde2f

Branch pushed to git repo; I updated commit sha1. New commits:

538a6abbeat points and weak points added

comment:27 Changed 21 months ago by git

  • Commit changed from 538a6ab776feb0b53037aa3752b38a01a3adde2f to 3bbc6e20b897ea89fb3c86518cabd989795818bd

Branch pushed to git repo; I updated commit sha1. New commits:

3bbc6e2Fixing tests

comment:28 Changed 20 months ago by git

  • Commit changed from 3bbc6e20b897ea89fb3c86518cabd989795818bd to 6fc8b088789e7fbaf73a3a7a440c2643b7902b55

Branch pushed to git repo; I updated commit sha1. New commits:

5dfbe89Merge branch 'u/gh-jcuevas-rozo/add_finite_topological_spaces' of git://trac.sagemath.org/sage into t/30862/dvf_and_homology_of_h_regular_finite_topological_spaces
d860beehregular homology added (missing documentation)
6fc8b08kenzo.py restored and some methods added to finite_topological_spaces.py

comment:29 Changed 20 months ago by git

  • Commit changed from 6fc8b088789e7fbaf73a3a7a440c2643b7902b55 to a6face57b0e9c6a56c7ba9230e8066fddce1d54a

Branch pushed to git repo; I updated commit sha1. New commits:

a6face5Non-ascii character deleted

comment:30 Changed 20 months ago by git

  • Commit changed from a6face57b0e9c6a56c7ba9230e8066fddce1d54a to 8a123d6cbc464d6cffc8a7202e003dbb640c22f5

Branch pushed to git repo; I updated commit sha1. New commits:

8a123d6Fixing 'blocks' warnings

comment:31 Changed 18 months ago by gh-bollu

What's the SAGE etiquette for review? I'm interested to understand what's going on here, but don't know anything in particular about finite topologies. Am I expected to be an expert in the subject matter? Do comments on the code/general structure help?

comment:32 Changed 18 months ago by jhpalmieri

I think that any feedback would be good. General comments are good, and if you can delve at all into the mathematics, that would also be good. I hope I can get back to this to help with the review myself, but I haven't had the time yet.

comment:33 follow-up: Changed 18 months ago by gh-kliem

Maybe a stupid comment, but isn't the singular of matrices "matrix"? Or is this something special about Kenzo.

comment:34 in reply to: ↑ 33 Changed 18 months ago by gh-jcuevas-rozo

Replying to gh-kliem:

Maybe a stupid comment, but isn't the singular of matrices "matrix"? Or is this something special about Kenzo.

Don´t worry, it is a good question. The term 'matrice', used in Kenzo, comes from French and it means matrix (as you noticed). In Kenzo, the type 'matrice' is used for sparse matrices.

comment:35 follow-up: Changed 17 months ago by jhpalmieri

My apologies for the delay, I am going to try working on this ticket. Some style comments:

  • Preferred Sage style is to keep lines under 80 characters when possible. One place that violates this is in the docstrings. Don't work too hard to get the doctests under 80 characters, but the paragraphs of text should satisfy this.
  • I don't know if it's officially a Sage style, but it is in general better to not use assert statements for error checking, because they can be ignored when Python is run with optimization flags turned on. The Python documentation says that assert statements should be used for debugging. (I think these statements are currently used throughout the Sage library, and maybe we should start a campaign to eliminate them. In the meantime, we shouldn't add more.)
  • I'm getting doctest failures of the form cannot import name '__convertarray__' from .... I do not have Kenzo installed; I think those doctests should be marked optional - kenzo. See below for some fixes, although I may have been too aggressive in applying the tags.
  • I'm getting other doctest failures from E = random.sample(X, k) with a deprecation warning:
        DeprecationWarning: Sampling from a set deprecated
        since Python 3.9 and will be removed in a subsequent version.
    
  • The documentation isn't building, but I think I've fixed that. See below.
  • src/sage/homology/finite_topological_spaces.py

    diff --git a/src/sage/homology/finite_topological_spaces.py b/src/sage/homology/finite_topological_spaces.py
    index 5307dbbad1..61285a8e06 100644
    a b def quotient_group_matrices(*matrices, left_null=False, right_null=False, check= 
    127127
    128128    EXAMPLES::
    129129
    130         sage: from sage.homology.finite_topological_spaces import quotient_group_matrices, __convertarray__
    131         sage: from sage.interfaces.kenzo import s2k_matrix
    132         sage: quotient_group_matrices()
     130        sage: from sage.homology.finite_topological_spaces import quotient_group_matrices, __convertarray__ # optional - kenzo
     131        sage: from sage.interfaces.kenzo import s2k_matrix # optional - kenzo
     132        sage: quotient_group_matrices() # optional - kenzo
    133133        0
    134         sage: s_M1 = matrix(2, 3, [1, 2, 3, 4, 5, 6])
    135         sage: M1 = __convertarray__(s2k_matrix(s_M1))
    136         sage: quotient_group_matrices(M1, left_null=True)
     134        sage: s_M1 = matrix(2, 3, [1, 2, 3, 4, 5, 6]) # optional - kenzo
     135        sage: M1 = __convertarray__(s2k_matrix(s_M1)) # optional - kenzo
     136        sage: quotient_group_matrices(M1, left_null=True) # optional - kenzo
    137137        C3
    138         sage: quotient_group_matrices(M1, right_null=True)
     138        sage: quotient_group_matrices(M1, right_null=True) # optional - kenzo
    139139        Z
    140         sage: s_M2 = matrix(2, 2, [1, -1, 1, -1])
    141         sage: M2 = __convertarray__(s2k_matrix(s_M2))
    142         sage: s_M3 = matrix(2, 2, [1, 0, 1, 0])
    143         sage: M3 = __convertarray__(s2k_matrix(s_M3))
    144         sage: quotient_group_matrices(M2, M3)
     140        sage: s_M2 = matrix(2, 2, [1, -1, 1, -1]) # optional - kenzo
     141        sage: M2 = __convertarray__(s2k_matrix(s_M2)) # optional - kenzo
     142        sage: s_M3 = matrix(2, 2, [1, 0, 1, 0]) # optional - kenzo
     143        sage: M3 = __convertarray__(s2k_matrix(s_M3)) # optional - kenzo
     144        sage: quotient_group_matrices(M2, M3) # optional - kenzo
    145145        0
    146         sage: s_M4 = matrix(2, 2, [0, 0, 1, 0])
    147         sage: M4 = __convertarray__(s2k_matrix(s_M4))
    148         sage: quotient_group_matrices(M2, M4)
     146        sage: s_M4 = matrix(2, 2, [0, 0, 1, 0]) # optional - kenzo
     147        sage: M4 = __convertarray__(s2k_matrix(s_M4)) # optional - kenzo
     148        sage: quotient_group_matrices(M2, M4) # optional - kenzo
    149149        Traceback (most recent call last):
    150150        ...
    151151        AssertionError: m1*m2 must be zero
    def k2s_binary_matrix_sparse(kmatrix): 
    192192    EXAMPLES::
    193193
    194194        sage: from sage.homology.finite_topological_spaces import k2s_binary_matrix_sparse, \
    195               s2k_binary_matrix_sparse, __randomtop__
    196         sage: KM2 = __randomtop__(6,1)
    197         sage: k2s_binary_matrix_sparse(KM2)
     195              s2k_binary_matrix_sparse, __randomtop__ # optional - kenzo
     196        sage: KM2 = __randomtop__(6,1) # optional - kenzo
     197        sage: k2s_binary_matrix_sparse(KM2) # optional - kenzo
    198198        [1 1 1 1 1 1]
    199199        [0 1 1 1 1 1]
    200200        [0 0 1 1 1 1]
    201201        [0 0 0 1 1 1]
    202202        [0 0 0 0 1 1]
    203203        [0 0 0 0 0 1]
    204         sage: KM = __randomtop__(100, float(0.8))
    205         sage: SM = k2s_binary_matrix_sparse(KM)
    206         sage: SM == k2s_binary_matrix_sparse(s2k_binary_matrix_sparse(SM))
     204        sage: KM = __randomtop__(100, float(0.8)) # optional - kenzo
     205        sage: SM = k2s_binary_matrix_sparse(KM) # optional - kenzo
     206        sage: SM == k2s_binary_matrix_sparse(s2k_binary_matrix_sparse(SM)) # optional - kenzo
    207207        True
    208208    """
    209209    data = __vector_to_list__(__matrice_to_lmtrx__(kmatrix)).python()
    def s2k_binary_matrix_sparse(smatrix): 
    226226    EXAMPLES::
    227227
    228228        sage: from sage.homology.finite_topological_spaces import k2s_binary_matrix_sparse, \
    229               s2k_binary_matrix_sparse
    230         sage: SM2 = matrix.ones(5)
    231         sage: s2k_binary_matrix_sparse(SM2)
     229              s2k_binary_matrix_sparse # optional - kenzo
     230        sage: SM2 = matrix.ones(5) # optional - kenzo
     231        sage: s2k_binary_matrix_sparse(SM2) # optional - kenzo
    232232        <ECL:
    233233        ========== MATRIX 5 lines + 5 columns =====
    234234        L1=[C1=1][C2=1][C3=1][C4=1][C5=1]
    def FiniteSpace(data, elements=None, is_T0=False): 
    273273      underlying set of the space.
    274274     
    275275    - ``is_T0`` -- (default ``False``) it is a boolean that indicates, when it is
    276       previously known, if the finite space is `T_0.
     276      previously known, if the finite space is `T_0`.
    277277
    278278    EXAMPLES:
    279279
    def RandomFiniteT0Space(*args): 
    444444    INPUT:
    445445
    446446    - ``args`` -- A tuple of two arguments. The first argument must be an integer
    447      number, while the second argument must be either a number between 0 and 1, or
    448      ``True``.
     447      number, while the second argument must be either a number between 0 and 1, or
     448      ``True``.
    449449
    450450    OUTPUT:
    451451
    def RandomFiniteT0Space(*args): 
    458458    EXAMPLES::
    459459
    460460        sage: from sage.homology.finite_topological_spaces import RandomFiniteT0Space
    461         sage: RandomFiniteT0Space(5, 0)
     461        sage: RandomFiniteT0Space(5, 0) # optional - kenzo
    462462        Finite T0 topological space of 5 points with minimal basis
    463463         {0: {0}, 1: {1}, 2: {2}, 3: {3}, 4: {4}}
    464         sage: RandomFiniteT0Space(5, 2)
     464        sage: RandomFiniteT0Space(5, 2) # optional - kenzo
    465465        Finite T0 topological space of 5 points with minimal basis
    466466         {0: {0}, 1: {0, 1}, 2: {0, 1, 2}, 3: {0, 1, 2, 3}, 4: {0, 1, 2, 3, 4}}
    467         sage: RandomFiniteT0Space(6, True)
     467        sage: RandomFiniteT0Space(6, True) # optional - kenzo
    468468        Finite T0 topological space of 6 points with minimal basis
    469469         {0: {0}, 1: {1}, 2: {0, 1, 2}, 3: {0, 1, 3}, 4: {0, 1, 2, 3, 4}, 5: {0, 1, 2, 3, 5}}
    470         sage: RandomFiniteT0Space(150, 0.2)
     470        sage: RandomFiniteT0Space(150, 0.2) # optional - kenzo
    471471        Finite T0 topological space of 150 points
    472         sage: RandomFiniteT0Space(5, True)
     472        sage: RandomFiniteT0Space(5, True) # optional - kenzo
    473473        Traceback (most recent call last):
    474474        ...
    475475        AssertionError: The first argument must be an integer number greater than 5
    class FiniteTopologicalSpace_T0(FiniteTopologicalSpace): 
    18751875            ....:            [11, 16], [15, 17], [2, 19], [6, 20], [18, 20]]
    18761876            sage: P = Poset((list(range(1,21)), Pcovers), cover_relations=True)
    18771877            sage: X = FiniteSpace(P)
    1878             sage: dvf = X.discrete_vector_field(); dvf
     1878            sage: dvf = X.discrete_vector_field(); dvf # optional - kenzo
    18791879            [(2, 3), (4, 6), (8, 9), (7, 12), (15, 17), (18, 20), (10, 13), (11, 16)]
    1880             sage: X.show(dvf)
     1880            sage: X.show(dvf) # optional - kenzo
    18811881            Graphics object consisting of 45 graphics primitives
    18821882            sage: Qcovers = [[1, 2], [2, 3], [3, 4], [3, 5]]
    18831883            sage: Q = Poset((list(range(1,6)), Qcovers), cover_relations=True)
    18841884            sage: Y = FiniteSpace(Q)
    18851885            sage: Z = Y.barycentric_subdivision()
    1886             sage: dvf = Z.discrete_vector_field(h_admissible=True)
    1887             sage: Z.show(dvf)
     1886            sage: dvf = Z.discrete_vector_field(h_admissible=True) # optional - kenzo
     1887            sage: Z.show(dvf) # optional - kenzo
    18881888            Graphics object consisting of 71 graphics primitives
    18891889        """
    18901890        kenzo_top = s2k_binary_matrix_sparse(self._topogenous)
    class FiniteTopologicalSpace_T0(FiniteTopologicalSpace): 
    19191919            ....:           [2, 4], [1, 4]]
    19201920            sage: P = Poset((list(range(1,14)), covers), cover_relations = True)
    19211921            sage: X = FiniteSpace(P)
    1922             sage: X.hregular_homology()
     1922            sage: X.hregular_homology() # optional - kenzo
    19231923            {0: Z, 1: C2, 2: 0}
    1924             sage: dvf = X.discrete_vector_field()
    1925             sage: X.show(dvf)
     1924            sage: dvf = X.discrete_vector_field() # optional - kenzo
     1925            sage: X.show(dvf) # optional - kenzo
    19261926            Graphics object consisting of 38 graphics primitives
    1927             sage: X.hregular_homology(dvfield = dvf)
     1927            sage: X.hregular_homology(dvfield = dvf) # optional - kenzo
    19281928            {0: Z, 1: C2, 2: 0}
    19291929        """
    19301930        assert deg==None or deg.is_integer(), "The degree must be an integer number or None"

comment:36 follow-up: Changed 17 months ago by jhpalmieri

Two more things about the documentation: \minus and \im are not standard LaTeX commands and they do not render properly. Should \minus be replaced by - or \setminus? I'm not sure what to do about \im: replace it every time by \mathrm{im} or similar?

comment:37 Changed 17 months ago by jhpalmieri

Maybe \mathop{\mathrm{im}} or \mathrm{im}\,.

comment:38 in reply to: ↑ 35 Changed 16 months ago by gh-jcuevas-rozo

Replying to jhpalmieri:

  • Preferred Sage style is to keep lines under 80 characters when possible. One place that violates this is in the docstrings. Don't work too hard to get the doctests under 80 characters, but the paragraphs of text should satisfy this.

I tried my best to do it, I have shortened the lines that didn't satisfy the rule.

  • I don't know if it's officially a Sage style, but it is in general better to not use assert statements for error checking, because they can be ignored when Python is run with optimization flags turned on. The Python documentation says that assert statements should be used for debugging. (I think these statements are currently used throughout the Sage library, and maybe we should start a campaign to eliminate them. In the meantime, we shouldn't add more.)

The assert statements have been completely changed to conditional statements.

  • I'm getting doctest failures of the form cannot import name '__convertarray__' from .... I do not have Kenzo installed; I think those doctests should be marked optional - kenzo. See below for some fixes, although I may have been too aggressive in applying the tags.

The optional - kenzo mark has been added to the required lines. Also, some functions have been added directly to src/sage/interfaces.kenzo.py.

  • I'm getting other doctest failures from E = random.sample(X, k) with a deprecation warning:
        DeprecationWarning: Sampling from a set deprecated
        since Python 3.9 and will be removed in a subsequent version.
    

I have changed "sampling from a set X" by "sampling from a list(X)" in order to fix these warnings.

comment:39 in reply to: ↑ 36 Changed 16 months ago by gh-jcuevas-rozo

Replying to jhpalmieri:

Two more things about the documentation: \minus and \im are not standard LaTeX commands and they do not render properly. Should \minus be replaced by - or \setminus? I'm not sure what to do about \im: replace it every time by \mathrm{im} or similar?

I have replaced \minus by - and \im by \mathrm{im}\ .

comment:40 Changed 16 months ago by git

  • Commit changed from 8a123d6cbc464d6cffc8a7202e003dbb640c22f5 to a06a949ec873dd72fc54f26cb5829289111400d9

Branch pushed to git repo; I updated commit sha1. New commits:

a06a949Style suggestions added

comment:41 Changed 16 months ago by git

  • Commit changed from a06a949ec873dd72fc54f26cb5829289111400d9 to 481bef5cd865492f547cea19f705b62793661415

Branch pushed to git repo; I updated commit sha1. New commits:

481bef5two pyflakes errors fixed

comment:42 Changed 16 months ago by gh-jcuevas-rozo

I have seen the pyflakes errors here, but I don't know how to fix them, since the undefined names mentioned there depends on the installation of Kenzo (up to I understand)...

comment:43 Changed 16 months ago by jhpalmieri

Thank you for checking those pyflakes errors. I agree that they don't need to be fixed.

comment:44 follow-up: Changed 16 months ago by jhpalmieri

In the example

    sage: T = FiniteSpace([{0, 3}, {1, 3}, {2, 3}, {3}]) ; T
    Finite T0 topological space of 4 points with minimal basis
     {0: {3, 0}, 1: {3, 1}, 2: {3, 2}, 3: {3}}
    sage: T.elements()
    [3, 0, 1, 2]

I would have expected T.elements() to be [0, 1, 2, 3], so I found the topogeneous matrix confusing. Even more with the following, I expect the elements to be sorted the way I enter them:

    sage: T = FiniteSpace([{0, 3}, {1, 3}, {2, 3}, {3}], elements=[0,1,2,3])                  
    sage: T.elements()                                                                        
    [3, 0, 1, 2]

Should they be sorted in some cases? If the sets of elements are likely to be large, I can understand not wanting to sort by default, but if the user supplies a list of elements, shouldn't we use that?

I have no experience with finite topological spaces, so maybe users won't expect this sorting. From the Python/Sage point of view, the current situation seems odd, though. Looking at the code, is the point to have an upper triangulate topogeneous matrix? If so, please add a comment about this to the documentation, pointing out an example. However, the example constructed from matrix data does not have an upper triangular topogeneous matrix, so maybe I'm confused. Or is it only upper triangular if the space is T0? The comment in the code could be clarified. Is this right:

  • src/sage/homology/finite_topological_spaces.py

    diff --git a/src/sage/homology/finite_topological_spaces.py b/src/sage/homology/finite_topological_spaces.py
    index 80f0b32fd1..ddab80d6f1 100644
    a b def FiniteSpace(data, elements=None, is_T0=False): 
    129129         {0: {3, 0}, 1: {3, 1}, 2: {3, 2}, 3: {3}}
    130130        sage: type(T)
    131131        <class 'sage.homology.finite_topological_spaces.FiniteTopologicalSpace_T0'>
     132
     133    Note that the set of elements is sorted in perhaps an unexpected
     134    way. This is to ensure that in the case of a T0 space, the
     135    topogenous matrix is upper triangular::
     136
    132137        sage: T.elements()
    133138        [3, 0, 1, 2]
     139        sage: T.topogenous_matrix()
     140        [1 1 1 1]
     141        [0 1 0 0]
     142        [0 0 1 0]
     143        [0 0 0 1]
     144
    134145        sage: FiniteSpace(({0, 2}, {0, 2}))
    135146        Traceback (most recent call last):
    136147        ...
    def FiniteSpace(data, elements=None, is_T0=False): 
    226237                basis[j] = Uj
    227238            eltos = range(n)
    228239
    229     # This fixes a topological sort (it guarantees an upper triangular topogenous matrix)
     240    # This fixes a topological sort (it guarantees an upper triangular topogenous matrix
     241    # in the T0 case)
    230242    eltos = list(eltos)
    231243    sorted_str_eltos = sorted([str(x) for x in eltos])
    232244    eltos.sort(key = lambda x: (len(basis[x]), sorted_str_eltos.index(str(x))))
Last edited 16 months ago by jhpalmieri (previous) (diff)

comment:45 Changed 16 months ago by jhpalmieri

After installing kenzo 1.1.9 (via make kenzo), I get doctest failures from the optional kenzo doctests. For example:

File "src/sage/homology/finite_topological_spaces.py", line 300, in sage.homology.finite_topological_spaces.RandomFiniteT0Space
Failed example:
    RandomFiniteT0Space(5, 0)                                # optional - kenzo               
Exception raised:
    Traceback (most recent call last):
      File "/Users/palmieri/Desktop/Sage/sage_builds/TESTING/sage-9.3.beta7/local/lib/python3.9/site-packages/sage/doctest/forker.py", line 714, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/palmieri/Desktop/Sage/sage_builds/TESTING/sage-9.3.beta7/local/lib/python3.9/site-packages/sage/doctest/forker.py", line 1133, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.homology.finite_topological_spaces.RandomFiniteT0Space[1]>", line 1, in <module>
        RandomFiniteT0Space(Integer(5), Integer(0))                                # optional - kenzo
      File "/Users/palmieri/Desktop/Sage/sage_builds/TESTING/sage-9.3.beta7/local/lib/python3.9/site-packages/sage/homology/finite_topological_spaces.py", line 327, in RandomFiniteT0Space
        topogenous = kenzo.k2s_binary_matrix_sparse(kenzo_top)
      File "/Users/palmieri/Desktop/Sage/sage_builds/TESTING/sage-9.3.beta7/local/lib/python3.9/site-packages/sage/interfaces/kenzo.py", line 2130, in k2s_binary_matrix_sparse
        data = __vector_to_list__(__matrice_to_lmtrx__(kmatrix)).python()
      File "sage/libs/ecl.pyx", line 854, in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8614)
        return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
      File "sage/libs/ecl.pyx", line 365, in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:5896)
        raise RuntimeError("ECL says: {}".format(
    RuntimeError: ECL says: The function VECTOR-TO-LIST is undefined.

comment:46 Changed 16 months ago by jhpalmieri

I also get failures in src/sage/interfaces/kenzo.py when kenzo is installed. Do I need to do more than ./configure --enable-kenzo=yes && make?

comment:47 Changed 16 months ago by tscrim

All of the interface tests pass for me without this branch, and I am getting similar failures with the branch. These failures are happening on my Ubuntu machine.

comment:48 Changed 16 months ago by gh-jcuevas-rozo

I apologize for the delay, but I was looking for the answer to the raised questions. By now, this ticket is working by using the following commands in order to load a testing branch of Kenzo:

git clone https://github.com/miguelmarco/kenzo/
cd kenzo
git checkout testing
sage -ecl < compile.lisp
mv kenzo--all-systems.fasb $HOME/sage/local/lib/ecl/kenzo.fas

The changes made in this branch will be added in a future release of Kenzo.

comment:49 in reply to: ↑ 44 Changed 16 months ago by gh-jcuevas-rozo

Replying to jhpalmieri:

In the example

    sage: T = FiniteSpace([{0, 3}, {1, 3}, {2, 3}, {3}]) ; T
    Finite T0 topological space of 4 points with minimal basis
     {0: {3, 0}, 1: {3, 1}, 2: {3, 2}, 3: {3}}
    sage: T.elements()
    [3, 0, 1, 2]

I would have expected T.elements() to be [0, 1, 2, 3], so I found the topogeneous matrix confusing. Even more with the following, I expect the elements to be sorted the way I enter them:

    sage: T = FiniteSpace([{0, 3}, {1, 3}, {2, 3}, {3}], elements=[0,1,2,3])                  
    sage: T.elements()                                                                        
    [3, 0, 1, 2]

Should they be sorted in some cases? If the sets of elements are likely to be large, I can understand not wanting to sort by default, but if the user supplies a list of elements, shouldn't we use that?


I think the attribute T.elements() has no a good name, I think I should change it to T.topogenous_sorting() or something like that. If the user want to obtain the set of elements of the space, the attribute T.underlying_set() could be the best option.


I have no experience with finite topological spaces, so maybe users won't expect this sorting. From the Python/Sage point of view, the current situation seems odd, though. Looking at the code, is the point to have an upper triangulate topogeneous matrix? If so, please add a comment about this to the documentation, pointing out an example. However, the example constructed from matrix data does not have an upper triangular topogeneous matrix, so maybe I'm confused. Or is it only upper triangular if the space is T0? The comment in the code could be clarified. Is this right:

  • src/sage/homology/finite_topological_spaces.py

    diff --git a/src/sage/homology/finite_topological_spaces.py b/src/sage/homology/finite_topological_spaces.py
    index 80f0b32fd1..ddab80d6f1 100644
    a b def FiniteSpace(data, elements=None, is_T0=False): 
    129129         {0: {3, 0}, 1: {3, 1}, 2: {3, 2}, 3: {3}}
    130130        sage: type(T)
    131131        <class 'sage.homology.finite_topological_spaces.FiniteTopologicalSpace_T0'>
     132
     133    Note that the set of elements is sorted in perhaps an unexpected
     134    way. This is to ensure that in the case of a T0 space, the
     135    topogenous matrix is upper triangular::
     136
    132137        sage: T.elements()
    133138        [3, 0, 1, 2]
     139        sage: T.topogenous_matrix()
     140        [1 1 1 1]
     141        [0 1 0 0]
     142        [0 0 1 0]
     143        [0 0 0 1]
     144
    134145        sage: FiniteSpace(({0, 2}, {0, 2}))
    135146        Traceback (most recent call last):
    136147        ...
    def FiniteSpace(data, elements=None, is_T0=False): 
    226237                basis[j] = Uj
    227238            eltos = range(n)
    228239
    229     # This fixes a topological sort (it guarantees an upper triangular topogenous matrix)
     240    # This fixes a topological sort (it guarantees an upper triangular topogenous matrix
     241    # in the T0 case)
    230242    eltos = list(eltos)
    231243    sorted_str_eltos = sorted([str(x) for x in eltos])
    232244    eltos.sort(key = lambda x: (len(basis[x]), sorted_str_eltos.index(str(x))))


The comments in the code are absolutely right, thanks for the suggestions!

comment:50 Changed 16 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.

comment:51 Changed 13 months ago by git

  • Commit changed from 481bef5cd865492f547cea19f705b62793661415 to 103698cd85f446f420c447eee00d6c0200680884

Branch pushed to git repo; I updated commit sha1. New commits:

103698c.elements() changed by .topogenous_sorting()

comment:52 follow-up: Changed 13 months ago by dimpase

This only adds to confusion one gets upon looking at what's in sage/homology/. IMHO this needs a restructuring (not on this ticket), maybe introducing something like sage/topology with parts such as spaces, homology, etc

comment:53 in reply to: ↑ 52 ; follow-up: Changed 13 months ago by jhpalmieri

Replying to dimpase:

This only adds to confusion one gets upon looking at what's in sage/homology/. IMHO this needs a restructuring (not on this ticket), maybe introducing something like sage/topology with parts such as spaces, homology, etc

I created #31925 for this.

comment:54 in reply to: ↑ 53 ; follow-up: Changed 13 months ago by dimpase

Replying to jhpalmieri:

Replying to dimpase:

This only adds to confusion one gets upon looking at what's in sage/homology/. IMHO this needs a restructuring (not on this ticket), maybe introducing something like sage/topology with parts such as spaces, homology, etc

I created #31925 for this.

perhaps this ticket, i.e. #30400, can be a start for sage/topology ?

comment:55 in reply to: ↑ 54 ; follow-up: Changed 13 months ago by jhpalmieri

Replying to dimpase:

Replying to jhpalmieri:

Replying to dimpase:

This only adds to confusion one gets upon looking at what's in sage/homology/. IMHO this needs a restructuring (not on this ticket), maybe introducing something like sage/topology with parts such as spaces, homology, etc

I created #31925 for this.

perhaps this ticket, i.e. #30400, can be a start for sage/topology ?

This and also #31748.

comment:56 in reply to: ↑ 55 ; follow-up: Changed 13 months ago by jhpalmieri

Replying to jhpalmieri:

Replying to dimpase:

Replying to jhpalmieri:

Replying to dimpase:

This only adds to confusion one gets upon looking at what's in sage/homology/. IMHO this needs a restructuring (not on this ticket), maybe introducing something like sage/topology with parts such as spaces, homology, etc

I created #31925 for this.

perhaps this ticket, i.e. #30400, can be a start for sage/topology ?

This and also #31748.

I'm working on #31925, and if it's in good enough shape, it can be a dependency for this ticket, and the file here would get added to sage/topology. My understanding is that this ticket requires an upgrade to Kenzo anyway, so this one is not immediately ready for merging. Is there a ticket for the new Kenzo?

comment:57 in reply to: ↑ 56 ; follow-up: Changed 13 months ago by slelievre

Replying to jhpalmieri:

Is there a ticket for the new Kenzo?

The Trac query for tickets whose summary includes "kenzo" reveals:

  • #29617: Support system installations of ECL and fix the kenzo SPKG build

which upgrades from Kenzo 1.1.9 to Kenzo 1.1.10 and udates the "upstream" info to point to

It got positive review in early April 2021, and was rebased on 9.4.beta0 in late May 2021.

Other Kenzo sources seem more outdated, mentioning only Kenzo 1.1.7:

Thankfully,

comment:58 in reply to: ↑ 57 Changed 13 months ago by jhpalmieri

Replying to slelievre:

Replying to jhpalmieri:

Is there a ticket for the new Kenzo?

The Trac query for tickets whose summary includes "kenzo" reveals:

  • #29617: Support system installations of ECL and fix the kenzo SPKG build

which upgrades from Kenzo 1.1.9 to Kenzo 1.1.10 and udates the "upstream" info to point to

It got positive review in early April 2021, and was rebased on 9.4.beta0 in late May 2021.

Other Kenzo sources seem more outdated, mentioning only Kenzo 1.1.7:

Thankfully,

See also comment:48 on this ticket for the upgrade that I think we need.

comment:59 Changed 13 months ago by jhpalmieri

In any case, #31925 is ready for review, and this ticket could go in after it.

comment:60 Changed 13 months ago by mkoeppe

  • Dependencies set to #31925
  • Status changed from needs_review to needs_work
  • Work issues set to Rework on top of #31925

comment:61 Changed 12 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

Setting a new milestone for this ticket based on a cursory review.

comment:62 Changed 11 months ago by git

  • Commit changed from 103698cd85f446f420c447eee00d6c0200680884 to d266e725c593e92b80be9871cbff1bc69b60d381

Branch pushed to git repo; I updated commit sha1. New commits:

0491dd2Merge branch 't/31925/f641bbb597fbf58103ed8c84867bab207a10ffde' into t/30400/add_finite_topological_spaces
d266e72finite spaces moved to topology folder

comment:63 Changed 11 months ago by git

  • Commit changed from d266e725c593e92b80be9871cbff1bc69b60d381 to 3c2e0d4ce41d764d3d413e81b430087aeed41d7b

Branch pushed to git repo; I updated commit sha1. New commits:

3c2e0d4references updated

comment:64 Changed 11 months ago by gh-jcuevas-rozo

  • Status changed from needs_work to needs_review

It has been merged with ticket #31925.

comment:65 Changed 11 months ago by jhpalmieri

I think there needs to be a ticket with the appropriate upgrade to Kenzo (comment:48), and this ticket should depend on that one. I think that we cannot really test this one without the Kenzo upgrade.

comment:66 Changed 9 months ago by chapoton

red branch => needs work

comment:67 Changed 9 months ago by chapoton

  • Status changed from needs_review to needs_work

comment:68 Changed 7 months ago by mkoeppe

  • Milestone changed from sage-9.5 to sage-9.6

comment:69 Changed 3 months ago by mkoeppe

  • Milestone changed from sage-9.6 to sage-9.7
Note: See TracTickets for help on using tickets.