Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.graphs, sage.combinat.{designs,posets}, sage.sandpiles: Update # needs #36273

Conversation

mkoeppe
Copy link
Member

@mkoeppe mkoeppe commented Sep 16, 2023

Also file-level # needs in the rest of sage.combinat.

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes introduce new doctests warnings. For instance In graphs (many more in combinat):

sage -t --long --warn-long 32.7 --random-seed=56484082308499901277842533432351053437 src/sage/graphs/graph.py
**********************************************************************
File "src/sage/graphs/graph.py", line 5855, in sage.graphs.graph.Graph.distance_graph
Warning: Variable 'degrees' referenced here was set only in doctest marked '# long time, needs sage.symbolic'
    degrees.append(2^8)
**********************************************************************
File "src/sage/graphs/graph.py", line 5856, in sage.graphs.graph.Graph.distance_graph
Warning: Variable 'degrees' referenced here was set only in doctest marked '# long time, needs sage.symbolic'
    degrees == H.degree_histogram()
    [1325 tests, 13.41 s]
sage -t --long --warn-long 32.7 --random-seed=56484082308499901277842533432351053437 src/sage/graphs/distances_all_pairs.pyx
**********************************************************************
File "src/sage/graphs/distances_all_pairs.pyx", line 2301, in sage.graphs.distances_all_pairs.szeged_index
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs networkx'
    a = szeged_index(G, algorithm='low')
**********************************************************************
File "src/sage/graphs/distances_all_pairs.pyx", line 2302, in sage.graphs.distances_all_pairs.szeged_index
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs networkx'
    b = szeged_index(G, algorithm='high')
    [180 tests, 1.06 s]
sage -t --long --warn-long 32.7 --random-seed=56484082308499901277842533432351053437 src/sage/graphs/strongly_regular_db.pyx
**********************************************************************
File "src/sage/graphs/strongly_regular_db.pyx", line 1926, in sage.graphs.strongly_regular_db.SRG_100_44_18_20
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.groups'
    G.is_strongly_regular(parameters=True)    # long time
**********************************************************************
File "src/sage/graphs/strongly_regular_db.pyx", line 1948, in sage.graphs.strongly_regular_db.SRG_100_45_20_20
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.groups'
    G.is_strongly_regular(parameters=True)    # long time
**********************************************************************
File "src/sage/graphs/strongly_regular_db.pyx", line 2620, in sage.graphs.strongly_regular_db.SRG_630_85_20_10
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.groups'
    G.is_strongly_regular(parameters=True)    # long time
    [344 tests, 10.40 s]
sage -t --long --warn-long 32.7 --random-seed=56484082308499901277842533432351053437 src/sage/graphs/generators/distance_regular.pyx
**********************************************************************
File "src/sage/graphs/generators/distance_regular.pyx", line 363, in sage.graphs.generators.distance_regular.TruncatedWittGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.pari sage.modules'
    G.is_distance_regular(True)      # long time (due to above)              # needs sage.modules
    [207 tests, 59.56 s]
sage -t --long --warn-long 32.7 --random-seed=56484082308499901277842533432351053437 src/sage/graphs/generators/smallgraphs.py
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 460, in sage.graphs.generators.smallgraphs.Cell600
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.size()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 462, in sage.graphs.generators.smallgraphs.Cell600
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_regular(12)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 464, in sage.graphs.generators.smallgraphs.Cell600
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_vertex_transitive()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 536, in sage.graphs.generators.smallgraphs.Cell120
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.size()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 538, in sage.graphs.generators.smallgraphs.Cell120
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_regular(4)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 540, in sage.graphs.generators.smallgraphs.Cell120
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_vertex_transitive()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4759, in sage.graphs.generators.smallgraphs.MathonStronglyRegularGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)   # long time
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4766, in sage.graphs.generators.smallgraphs.MathonStronglyRegularGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4769, in sage.graphs.generators.smallgraphs.MathonStronglyRegularGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4793, in sage.graphs.generators.smallgraphs.JankoKharaghaniGraph
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.libs.pari'
    g.is_strongly_regular(parameters=True)  # long time
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4885, in sage.graphs.generators.smallgraphs.JankoKharaghaniTonchevGraph
Warning: Variable 'Gamma' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    Gamma.is_strongly_regular(parameters=True)  # long time
    [574 tests, 26.23 s]
sage -t --long --warn-long 32.7 --random-seed=56484082308499901277842533432351053437 src/sage/graphs/generators/families.py
**********************************************************************
File "src/sage/graphs/generators/families.py", line 3845, in sage.graphs.generators.families.MathonPseudocyclicMergingGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)    # long time
**********************************************************************
File "src/sage/graphs/generators/families.py", line 3848, in sage.graphs.generators.families.MathonPseudocyclicMergingGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)    # long time
**********************************************************************
File "src/sage/graphs/generators/families.py", line 3851, in sage.graphs.generators.families.MathonPseudocyclicMergingGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)    # long time
    [482 tests, 12.80 s]

and a doctest error in sandpiles

sage -t --long --warn-long 32.8 --random-seed=321572006474589592224501753422986174817 src/sage/sandpiles/sandpile.py
**********************************************************************
File "src/sage/sandpiles/sandpile.py", line 2754, in sage.sandpiles.sandpile.Sandpile.solve
Failed example:
    Z = S.solve()                                                         # needs sage.libs.singular
Expected:
    [[-0.707107000000000 + 0.707107000000000*I,
      0.707107000000000 - 0.707107000000000*I],
     [-0.707107000000000 - 0.707107000000000*I,
      0.707107000000000 + 0.707107000000000*I],
     [-I, -I],
     [I, I],
     [0.707107000000000 + 0.707107000000000*I,
      -0.707107000000000 - 0.707107000000000*I],
     [0.707107000000000 - 0.707107000000000*I,
      -0.707107000000000 + 0.707107000000000*I],
     [1, 1],
     [-1, -1]]
Got:
    <BLANKLINE>
**********************************************************************
1 item had failures:
   1 of   5 in sage.sandpiles.sandpile.Sandpile.solve
    [935 tests, 1 failure, 26.22 s]

src/sage/graphs/generators/families.py Outdated Show resolved Hide resolved
@@ -24014,7 +24016,7 @@ class by some canonization function `c`. If `G` and `H` are graphs,
....: [(0,1), (0,2), (1,2)],
....: [(0,1), (0,2), (0,3)]]
sage: algos = ['sage']
sage: algos.append('bliss') # optional - bliss
sage: import sage.graphs.bliss; algos.append('bliss') # optional - bliss
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this import necessary ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes this line immune to tag probing (sage --fixdoctests --probe all):
Without this change, the line algos.append('bliss') can be run whether bliss is available are not, so probing would remove this tag, leading to an error later.

@mkoeppe mkoeppe force-pushed the needs_for_sage_graphs_sage_combinat_designs_sage_combinat_posets_sage_sandpiles branch from 92c3fde to 94babfd Compare September 23, 2023 19:25
Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see other warnings such as:

sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/species/generating_series.py
**********************************************************************
File "src/sage/combinat/species/generating_series.py", line 548, in sage.combinat.species.generating_series.CycleIndexSeriesRing
Warning: Variable 'R' referenced here was set only in doctest marked '# needs sage.modules'
    R is CycleIndexSeriesRing(QQ)
    [130 tests, 1.44 s]
sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/words/word_generators.py
**********************************************************************
File "src/sage/combinat/words/word_generators.py", line 856, in sage.combinat.words.word_generators.WordGenerator.CharacteristicSturmianWord
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.symbolic' just before this line to avoid repeating the tag 4 times
    a = words.LowerMechanicalWord(1/pi)[1:]                               # optional - sage.symbolic
**********************************************************************
File "src/sage/combinat/words/word_generators.py", line 938, in sage.combinat.words.word_generators.WordGenerator._CharacteristicSturmianWord_LetterIterator
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.symbolic' just before this line to avoid repeating the tag 4 times
    alpha = (sqrt(3)-1)/2                                                 # optional - sage.symbolic
    [301 tests, 1.09 s]
sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/words/morphism.py
**********************************************************************
File "src/sage/combinat/words/morphism.py", line 2889, in sage.combinat.words.morphism.WordMorphism.?
Warning: Variable 'V' referenced here was set only in doctest marked '# needs sage.modules'
    S = set(map(tuple, [i*V[0] + j*V[1]
                        for i in [-1,0,1] for j in [-1,0,1]]))
**********************************************************************
File "src/sage/combinat/words/morphism.py", line 3332, in sage.combinat.words.morphism.WordMorphism.abelian_rotation_subspace
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.modules' just before this line to avoid repeating the tag 5 times
    WordMorphism('0->1,1->0').abelian_rotation_subspace()                 # optional - sage.modules
    [610 tests, 1.40 s]

@@ -456,7 +456,7 @@ def Cell600(embedding=1):
EXAMPLES::

sage: # long time
sage: g = graphs.Cell600()
sage: g = graphs.Cell600() # needs sage.rings.number_field
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining doctest warnings in src/sage/graphs/generators/smallgraphs.py, introduced in this PR:

sage -t --long --warn-long 34.0 --random-seed=75874225553897883545888612139197852719 src/sage/graphs/generators/smallgraphs.py
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 460, in sage.graphs.generators.smallgraphs.Cell600
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.size()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 462, in sage.graphs.generators.smallgraphs.Cell600
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_regular(12)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 464, in sage.graphs.generators.smallgraphs.Cell600
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_vertex_transitive()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 536, in sage.graphs.generators.smallgraphs.Cell120
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.size()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 538, in sage.graphs.generators.smallgraphs.Cell120
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_regular(4)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 540, in sage.graphs.generators.smallgraphs.Cell120
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.rings.number_field'
    g.is_vertex_transitive()
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4759, in sage.graphs.generators.smallgraphs.MathonStronglyRegularGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)   # long time
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4766, in sage.graphs.generators.smallgraphs.MathonStronglyRegularGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4769, in sage.graphs.generators.smallgraphs.MathonStronglyRegularGraph
Warning: Variable 'G' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    G.is_strongly_regular(parameters=True)
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4793, in sage.graphs.generators.smallgraphs.JankoKharaghaniGraph
Warning: Variable 'g' referenced here was set only in doctest marked '# long time, needs sage.libs.pari'
    g.is_strongly_regular(parameters=True)  # long time
**********************************************************************
File "src/sage/graphs/generators/smallgraphs.py", line 4885, in sage.graphs.generators.smallgraphs.JankoKharaghaniTonchevGraph
Warning: Variable 'Gamma' referenced here was set only in doctest marked '# long time, needs sage.libs.gap'
    Gamma.is_strongly_regular(parameters=True)  # long time
    [574 tests, 12.13 s]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed in e110826

@@ -1,4 +1,4 @@
# optional - sage.combinat sage.groups
# sage.doctest: needs sage.combinat sage.groups
r"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining doctest warnings in this file:

sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/integer_vectors_mod_permgroup.py
**********************************************************************
File "src/sage/combinat/integer_vectors_mod_permgroup.py", line 190, in sage.combinat.integer_vectors_mod_permgroup.IntegerVectorsModPermutationGroup
Warning: Consider using a block-scoped tag by inserting the line 'sage: # long time' just before this line to avoid repeating the tag 4 times
    G = PermutationGroup([[(6,)]]) # long time
    [171 tests, 0.58 s]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 82fb0f5

@@ -1924,8 +1924,8 @@ def is_resolvable(self, certificate=False, solver=None, verbose=0, check=True,
sage: TD.is_resolvable()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining doctest warnings in this file:

sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/designs/incidence_structures.py
**********************************************************************
File "src/sage/combinat/designs/incidence_structures.py", line 1541, in sage.combinat.designs.incidence_structures.IncidenceStructure.is_t_design
Warning: Consider using a block-scoped tag by inserting the line 'sage: # optional - gap_package_design' just before this line to avoid repeating the tag 5 times
    BD = designs.WittDesign(9)         # optional - gap_package_design
    [344 tests, 2.08 s]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 67eb2e1

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# sage.doctest: needs sage.combinat sage.modules
r"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remaining warnings in this file:

sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/words/paths.py
**********************************************************************
File "src/sage/combinat/words/paths.py", line 1648, in sage.combinat.words.paths.FiniteWordPath_2d.animate
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.plot' just before this line to avoid repeating the tag 6 times
    a = words.fibonacci_tile(0).animate()                                 # optional - sage.plot
    [531 tests, 29.82 s]

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# sage.doctest: needs sage.combinat sage.modules
r"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remaining warnings:

sage -t --long --warn-long 33.8 --random-seed=61144299382637325659043318932957598596 src/sage/combinat/diagram_algebras.py
**********************************************************************
File "src/sage/combinat/diagram_algebras.py", line 2416, in sage.combinat.diagram_algebras.PartitionAlgebra
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.symbolic' just before this line to avoid repeating the tag 4 times
    q = var('q')                                                              # optional - sage.symbolic
**********************************************************************
File "src/sage/combinat/diagram_algebras.py", line 2428, in sage.combinat.diagram_algebras.PartitionAlgebra
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.symbolic' just before this line to avoid repeating the tag 4 times
    P = PA.basis().list()                                                     # optional - sage.symbolic
**********************************************************************
File "src/sage/combinat/diagram_algebras.py", line 2458, in sage.combinat.diagram_algebras.PartitionAlgebra
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.symbolic' just before this line to avoid repeating the tag 6 times
    S = SymmetricGroupAlgebra(SR, 2)                                          # optional - sage.symbolic
**********************************************************************
File "src/sage/combinat/diagram_algebras.py", line 3839, in sage.combinat.diagram_algebras.BrauerAlgebra.jucys_murphy
Warning: Consider using a block-scoped tag by inserting the line 'sage: # needs sage.symbolic' just before this line to avoid repeating the tag 4 times
    z = var('z')                                                          # optional - sage.symbolic
    [953 tests, 16.68 s]

@mkoeppe
Copy link
Member Author

mkoeppe commented Oct 1, 2023

I'll take care of the other files (outside of
sage.graphs, sage.combinat.{designs,posets}, sage.sandpiles) in a separate PR.

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Documentation preview for this PR (built with commit 67eb2e1; changes) is ready! 🎉

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Further PRs are needed to complete the task in combinat.

@mkoeppe
Copy link
Member Author

mkoeppe commented Oct 1, 2023

Thank you!

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 1, 2023
…age.sandpiles`: Update # needs

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
Also file-level `# needs` in the rest of `sage.combinat`.


<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Part of: sagemath#29705
- Cherry-picked from: sagemath#35095
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36273
Reported by: Matthias Köppe
Reviewer(s): David Coudert, Matthias Köppe
@vbraun vbraun merged commit 7142833 into sagemath:develop Oct 8, 2023
15 of 16 checks passed
@mkoeppe mkoeppe added this to the sage-10.2 milestone Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants