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

Finite field relative #1

Open
wants to merge 918 commits into
base: ring-extensions-revisions
Choose a base branch
from

Conversation

roed314
Copy link
Owner

@roed314 roed314 commented Mar 23, 2023

This is a fake PR so we can see what changes are in #34992 on top of those in #34991.

dimpase and others added 30 commits March 18, 2023 18:42
Polynomials have variable length and repeated Python built-in +=
operator can behave in a quadratic way for large strings.
- make all PolyDict methods but two cpdef and doctested
- implement binary search in ETuple
Release Manager and others added 30 commits April 1, 2023 00:43
    
<!-- ^^^^^
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"
-->
### 📚 Description

Replace some doctests by similar but faster ones in the file
`finite_monoids.py`

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35257
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
    
Recent versions of PARI have a `qfbcornacchia()` function which can
replace special cases of `qfbsolve()` while being much faster. In this
patch we add a path to `qfbcornacchia()` in the
`BinaryQF.solve_integer()` method; it can be selected using an optional
`algorithm=` argument. See the added doctest for an example of the
speedup.

Also fixes sagemath#35292.
    
URL: sagemath#35262
Reported by: Lorenz Panny
Reviewer(s): Lorenz Panny, Travis Scrimshaw
…sage.homology` into methods

    
<!-- ^^^^^
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"
-->
### 📚 Description
Part of:
- sagemath#29705

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35263
Reported by: Matthias Köppe
Reviewer(s): David Coudert
    
<!-- ^^^^^
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"
-->
### 📚 Description

Calling `Stream_inexact.__getitem__(n)` for `n ==
self._approximate_order`, we can update `self._true_order` and
`self._approximate_order` as follows:

* if the result is non-zero, we now know that `n` is the true order
* otherwise, we know that `n+1` is a lower bound for the order.
<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

This fixes sagemath#35261, but it may not be the best fix, because it
potentially makes `__getitem__` slower.

Fixes sagemath#34556, which was the original issue.

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35265
Reported by: Martin Rubey
Reviewer(s): Martin Rubey, Travis Scrimshaw
…dularization

    
<!-- ^^^^^
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"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->
These tags make it possible/meaningful to doctest `sage.graphs` even
when some "standard" packages (`networkx`, `numpy`, the modularized
distribution packaging providing `sage.groups`) are not installed.

- Part of sagemath#29705
- Split out from sagemath#34998

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
This is just one commit on top of:
- sagemath#35237
    
URL: sagemath#35266
Reported by: Matthias Köppe
Reviewer(s): David Coudert, Dima Pasechnik, Matthias Köppe
…octest tags for modularization

    
<!-- ^^^^^
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"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

Adding tags that make it possible/meaningful to doctest
`sage.manifolds`, `sage.tensor` even when some "standard" packages
(`pplpy`, the modularized distribution packaging providing
`sage.symbolic` and `sage.manifolds`) are not installed. Also taking
care of `sage.geometry.riemannian_manifolds`.

- Part of sagemath#29705
- Split out from sagemath#34998

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
This is just two commits on top of:
- sagemath#35237
    
URL: sagemath#35267
Reported by: Matthias Köppe
Reviewer(s): Eric Gourgoulhon
…essarily independent) generating set

    
Currently, constructing an `AdditiveAbelianGroupWrapper` requires prior
knowledge of an *independent* set of generators for the group. This
patch adds an algorithm (implemented following Sutherland's thesis) to
construct an `AdditiveAbelianGroupWrapper` from an arbitrary generating
set, whose members need not be independent. This is useful for all kinds
of things, including structure computations for finite abelian groups.
    
URL: sagemath#35270
Reported by: Lorenz Panny
Reviewer(s): Lorenz Panny, Travis Scrimshaw
    
<!-- ^^^^^
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"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
We replace some `import`s by `lazy_imports` in
`sage.categories.drinfeld_modules` and make the import of
`DrinfeldModule` into the global namespace lazy. We also move the
module-level import of `PolynomialBaseringInjection` in
`sage.rings.polynomial.polynomial_ring` into a method.
<!-- Why is this change required? What problem does it solve? -->

`git grep '^from sage.rings' src/sage/categories` reveals that the
recently added `.drinfeld_modules` is the only module that imports
nontrivial things from `sage.rings`. This is a new obstacle to
modularization (it caused an error due to import cycles in sagemath#35095.)

The purpose of reducing the module-level import to a method-level import
is explained in https://doc.sagemath.org/html/en/developer/packaging_sag
e_library.html#module-level-runtime-dependencies

<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35275
Reported by: Matthias Köppe
Reviewer(s): Antoine Leudière, Matthias Köppe
…]`: Handle missing implementation modules

    
<!-- ^^^^^
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"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
We modify the `__init__` methods of univariate polynomial implementation
classes so that they all take an `implementation` keyword (and pass it
on to their `super`).
We guard the imports of implementation classes in the `PolynomialRing`
constructor with `try... except ImportError` and fall back to
alternative implementations unless a specific implementation was
requested.
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->
This is part of:
- sagemath#29705

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35277
Reported by: Matthias Köppe
Reviewer(s): Marc Mezzarobba
…'docker' in the name (step 3)

    
<!-- ^^^^^
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"
-->
### 📚 Description
Step 3 of the rename done in sagemath#35079 and sagemath#35080.

This will speed up the "Build & Test" and "Build documentation"
workflows because they will start from more recent images.

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35278
Reported by: Matthias Köppe
Reviewer(s): Dima Pasechnik
    
<!-- ^^^^^
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"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
We should be able to import Python modules from `sage.categories` even
if implementation modules are not installed; that's the premise of the
distribution **sagemath-categories**.
Here we make changes to avoid module-level dependencies on some higher-
level functionality, such as symbolic functions, linear algebra, etc.
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

sagemath#35275 takes care of some other imports.

Part of
- sagemath#29705

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35279
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
…niteFieldElement.sqrt()

    
Library code (for example, in `EllipticCurve_generic.lift_x()`)
sometimes passes this argument, which currently makes things fail.
    
URL: sagemath#35280
Reported by: Lorenz Panny
Reviewer(s): roed314
    
<!-- ^^^^^
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"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

Using the ABC `sage.rings.number_field.number_field_base.NumberField`

Deprecating `is_NumberField`.

Part of:
- sagemath#29705

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
- Depends on sagemath#35277
    
URL: sagemath#35283
Reported by: Matthias Köppe
Reviewer(s): Marc Mezzarobba
…or them

    
### 📚 primesieve/count update

primesieve and primecount update, add gentoo packages info for them

### 📝 Checklist

- [X] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

A straightforward upgrade
    
URL: sagemath#35284
Reported by: Dima Pasechnik
Reviewer(s): François Bissey
    
<!-- ^^^^^
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"
-->
### 📚 Description

There is a missing colon which makes the doc displaying incorrectly.

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 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! -->

- [ ] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->

@kryzar @ymusleh @xcaruso
    
URL: sagemath#35287
Reported by: David Ayotte
Reviewer(s): Antoine Leudière, David Coudert
    
### 📚 pplpy/pplpy_doc:  update upstream info and deps

these are now hosted on sagemath;
also, build system of pplpy errors out if there is no sphinx.

### 📝 Checklist


- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
    
URL: sagemath#35289
Reported by: Dima Pasechnik
Reviewer(s): Matthias Köppe
    
### 📚 Description update pplpy to 0.8.7

with 0.8.6, gcc 12.2.1 complains, see
sagemath#35285 (comment)

### 📝 Checklist


- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
    
URL: sagemath#35290
Reported by: Dima Pasechnik
Reviewer(s): Matthias Köppe
    
<!-- ^^^^^
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"
-->
### 📚 Description

Currently, `Stream_cauchy_compose` unnecessarily evaluates its right
argument `g` (implicitly), even if the corresponding coefficient of the
left argument `f` is zero.  This breaks various recursive definitions.


Fixes sagemath#35261.

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35291
Reported by: Martin Rubey
Reviewer(s): Travis Scrimshaw
    
<!-- ^^^^^
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"
-->
### 📚 Description

This address the arity problem noted in sagemath#35261. It also removes a `TODO`
in a `revert()` implementation by making the behavior the same across
different implementations. Warnings are added for the user for the
assumptions made by the code.

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->

- sagemath#35127 Avoiding a long test.
- sagemath#35254 Avoiding merge conflicts.
- sagemath#35291 Making sure these changes work together.
- sagemath#35265 For some slight simplification of the new stream's
`__getitem__`.
    
URL: sagemath#35293
Reported by: Travis Scrimshaw
Reviewer(s): Martin Rubey, Travis Scrimshaw
…eld.quadratic_twist

    
### 📚 Description

The current implementation of `quadratic_twist` computes (possibly
several times) unnecessary finite field square roots, but the only
requirement is to select `D` which has no such square roots, which can
be tested efficiently using PARI (by checking that the norm is not a
quadratic residue).

This solves slowness over large finite field extensions:
```
sage: p = 2**255 - 19
....: K.<a> = GF(p**64)
# Sage 9.8
sage: %timeit EllipticCurve(K, [0,
K.random_element()]).quadratic_twist()
17.8 s ± 8.5 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
# This patch
sage: %timeit EllipticCurve(K, [0,
K.random_element()]).quadratic_twist()
9.69 ms ± 388 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
```

### 📝 Checklist

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
    
URL: sagemath#35294
Reported by: Rémy Oudompheng
Reviewer(s): Lorenz Panny
…enerated .c files, run Cython instead

    
### 📚 Description

pyscipopt's tarball has generated with an old Cython .c files. This
breaks it on Python 3.11+, see
sagemath#35299

This fixes sagemath#35299 by switching to a tarball without .c files.

### 📝 Checklist

- [x ] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x ] I have linked an issue or discussion.
    
URL: sagemath#35303
Reported by: Dima Pasechnik
Reviewer(s): Matthias Köppe
    
<!-- ^^^^^
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"
-->
### 📚 Description
A copy button is added to the top right of each code block in the HTML
documentation.

Key added functionality, compared to just selecting the code and copy-
pasting it to a Sage session:
- it's just one click
- the output of doctests is omitted
- comments (in particular the many new `# optional - ...` comments) are
stripped away

Example: https://deploy-preview-35304--sagemath-tobias.netlify.app/refer
ence/discrete_geometry/sage/geometry/polyhedron/base7.html#sage.geometry
.polyhedron.base7.Polyhedron_base7.volume

Resolves sagemath#35239

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes sagemath#1337" -->

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: sagemath#35304
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee, Tobias Diez
    
This patch modifies the repr()/str() method of polynomials to use a
StringIO buffer instead of `s += ...` to build the result string. It is
known that repeatedly calling `+=` has quadratic complexity for large
Python strings.

Currently calling `str()`  on a high degree polynomial takes a very long
amount of time and it may happen accidentally (a script was stuck during
2 hours trying to format a degree 300000 polynomial for an exception
message).

```
sage: p = random_prime(2**96)
sage: K = GF(p**24, 'a')
sage: pol = K["x"].random_element(30000)
# Before patch
sage: %time _ = str(pol)
CPU times: user 2min 22s, sys: 1min 43s, total: 4min 5s
Wall time: 4min 5s
# After patch
sage: %time _ = str(pol)
CPU times: user 692 ms, sys: 21 ms, total: 713 ms
Wall time: 713 ms
```

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

None.
    
URL: sagemath#35307
Reported by: Rémy Oudompheng
Reviewer(s): Lorenz Panny
…rable vertices

Fixes sagemath#35300.

### 📚 Description

We specify an ordering of the vertices in the call to `eccentricity`.
This way we fix both `radius` and `diameter`.

### 📝 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! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->

URL: sagemath#35310
Reported by: David Coudert
Reviewer(s): Frédéric Chapoton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.