Skip to content

Commit

Permalink
gh-35107: sage.{finance,interacts,libs,numerical,stats,tests}: Replac…
Browse files Browse the repository at this point in the history
…e imports from sage.*.all for namespace packages

<!-- ^^^^^
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 #1234" use "Introduce new method to
calculate 1+1"
-->
### 📚 Description
Fixes #34957

<!-- 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 #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: #35107
Reported by: Matthias Köppe
Reviewer(s): Dima Pasechnik, Tobias Diez
  • Loading branch information
Release Manager committed Mar 18, 2023
2 parents b82f457 + a123603 commit 49c2cd3
Show file tree
Hide file tree
Showing 30 changed files with 84 additions and 67 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=81dde9cfffd7aab81def87cdb9df95d68df3a7e0
md5=6c7050003c660cecb9363b802a8a7f63
cksum=658724891
sha1=d593e6b130ad78162b7efaf18f9be312ca49fc8f
md5=5bae34229686080975fd118ef2deff08
cksum=3618148381
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c36342c98a8b9a82feb84759676d74d6815a4840
fcbf5470c0bdd7ae51eff141bb3961a2a73b293e
4 changes: 3 additions & 1 deletion src/sage/finance/fractal.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ AUTHOR:
- William Stein (2008)
"""

from sage.rings.all import RDF, CDF, Integer
from sage.rings.real_double import RDF
from sage.rings.complex_double import CDF
from sage.rings.integer import Integer
from sage.modules.free_module_element import vector
I = CDF.gen()

Expand Down
4 changes: 2 additions & 2 deletions src/sage/interacts/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def html(obj):
sage: html("<h1>Hello world</h1>")
<h1>Hello world</h1>
"""
from sage.all import html
from sage.misc.html import html
pretty_print(html(obj))


Expand Down Expand Up @@ -1301,7 +1301,7 @@ def simpson_integration(
else:
interval = interval_g[0]
def parabola(a, b, c):
from sage.all import solve
from sage.symbolic.relation import solve
A, B, C = SR.var("A, B, C")
K = solve([A*a[0]**2+B*a[0]+C==a[1], A*b[0]**2+B*b[0]+C==b[1], A*c[0]**2+B*c[0]+C==c[1]], [A, B, C], solution_dict=True)[0]
f = K[A]*x**2+K[B]*x+K[C]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/arb/arb_version.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8
from sage.libs.arb.arb cimport arb_version
from sage.libs.arb.arb cimport arb_version
from sage.cpython.string cimport char_to_str

def version():
Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/coxeter3/coxeter_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sage.structure.unique_representation import UniqueRepresentation
from sage.structure.element_wrapper import ElementWrapper
from sage.structure.richcmp import richcmp
from sage.categories.all import CoxeterGroups
from sage.categories.coxeter_groups import CoxeterGroups
from sage.structure.parent import Parent

from sage.combinat.root_system.coxeter_matrix import CoxeterMatrix
Expand All @@ -37,7 +37,7 @@ def __classcall__(cls, cartan_type, *args, **options):
Coxeter group of type ['B', 3] relabelled by {1: 3, 2: 2, 3: 1} implemented by Coxeter3
"""
from sage.combinat.all import CartanType
from sage.combinat.root_system.cartan_type import CartanType
ct = CartanType(cartan_type)
return super().__classcall__(cls, ct, *args, **options)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/eclib/homspace.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from libcpp.map cimport map
from ..eclib cimport vec, svec, mat, smat
from .mat cimport MatrixFactory

from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
from sage.rings.integer_ring import ZZ
from sage.rings.integer cimport Integer
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/eclib/mat.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Cremona matrices

from ..eclib cimport scalar, addscalar

from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
from sage.rings.integer_ring import ZZ

from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
Expand Down
12 changes: 6 additions & 6 deletions src/sage/libs/eclib/mwrank.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -593,20 +593,20 @@ cdef class _mw:
Reducing saturation bound from given value 20 to computed index bound 3
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 7)
Checking 3-saturation
Checking 3-saturation
Points were proved 3-saturated (max q used = 7)
done
P2 = [-2:3:1] is generator number 2
saturating up to 20...Saturation index bound (for points of good reduction) = 4
Reducing saturation bound from given value 20 to computed index bound 4
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
possible kernel vector = [1,1]
This point may be in 2E(Q): [14:-52:1]
...and it is!
...and it is!
Replacing old generator #1 with new generator [1:-1:1]
Reducing index bound from 4 to 2
Points have successfully been 2-saturated (max q used = 7)
Expand All @@ -618,9 +618,9 @@ cdef class _mw:
Reducing saturation bound from given value 20 to computed index bound 3
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 11)
Checking 3-saturation
Checking 3-saturation
Points were proved 3-saturated (max q used = 13)
done, index = 1.
P4 = [-1:3:1] = -1*P1 + -1*P2 + -1*P3 (mod torsion)
Expand Down
4 changes: 3 additions & 1 deletion src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ from sage.cpython.string cimport str_to_bytes, char_to_str
from sage.misc.cachefunc import cached_method
from sage.structure.sage_object cimport SageObject
from sage.structure.parent import Parent
from sage.rings.all import ZZ, QQ, RDF
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF

from sage.groups.perm_gps.permgroup_element cimport PermutationGroupElement
from sage.combinat.permutation import Permutation
Expand Down
4 changes: 3 additions & 1 deletion src/sage/libs/giac/giac.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ from sage.ext.stdsage cimport PY_NEW
from sage.libs.gmp.mpz cimport mpz_t, mpz_init_set
from sage.rings.all import ZZ, QQ, IntegerModRing
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
from sage.rings.integer cimport Integer
from sage.rings.rational cimport Rational
from sage.structure.element cimport Matrix
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/lcalc/lcalc_Lfunction.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ cdef class Lfunction:

def find_zeros(self, T1, T2, stepsize):
"""
Finds zeros on critical line between ``T1`` and ``T2`` using step size
Finds zeros on critical line between ``T1`` and ``T2`` using step size
of stepsize. This function might miss zeros if step size is too
large. This function computes the zeros of the L-function by using
change in signs of areal valued function whose zeros coincide with
Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/linkages/padics/API.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ cdef inline long cremove(celement out, celement a, long prec, PowComputer_class
- ``a`` -- the element whose valuation and unit are desired.
- ``prec`` -- a long, used if `a = 0`.
- ``prime_pow`` -- the PowComputer for the ring.
- ``reduce_relative`` -- a bint: whether the final result
should be reduced at precision ``prec`` (case ``False``)
- ``reduce_relative`` -- a bint: whether the final result
should be reduced at precision ``prec`` (case ``False``)
or ``prec - valuation`` (case ``True``)
OUTPUT:
Expand Down
8 changes: 4 additions & 4 deletions src/sage/libs/linkages/padics/Polynomial_shared.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ cdef inline long cremove(celement out, celement a, long prec, PowComputer_ prime
INPUT:
- ``out`` -- a ``celement`` to store the unit part
- ``a`` -- the ``celement`` whose valuation and unit are desired
- ``prec`` -- a ``long``, the return value if ``a`` is zero
- ``prime_pow`` -- the ``PowComputer`` for the ring
- ``reduce_relative`` -- a bint: whether the final result
- ``reduce_relative`` -- a bint: whether the final result
should be reduced at precision ``prec`` (case ``False``)
or ``prec - valuation`` (case ``True``)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/linkages/padics/fmpz_poly_unram.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ cdef inline long cremove(celement out, celement a, long prec, PowComputer_ prime
- ``a`` -- the element whose valuation and unit are desired.
- ``prec`` -- a long, used if `a = 0`.
- ``prime_pow`` -- the PowComputer for the ring.
- ``reduce_relative`` -- a bint: whether the final result
- ``reduce_relative`` -- a bint: whether the final result
should be reduced at precision ``prec`` (case ``False``)
or ``prec - valuation`` (case ``True``)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/linkages/padics/mpz.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ cdef inline int csetone(mpz_t out, PowComputer_ prime_pow) except -1:
- ``prime_pow`` -- the PowComputer for the ring.
"""
mpz_set_ui(out, 1)

cdef inline int csetzero(mpz_t out, PowComputer_ prime_pow) except -1:
"""
Sets to 0.
Expand All @@ -378,7 +378,7 @@ cdef inline int csetzero(mpz_t out, PowComputer_ prime_pow) except -1:
- ``prime_pow`` -- the PowComputer for the ring.
"""
mpz_set_ui(out, 0)

cdef inline bint cisone(mpz_t out, PowComputer_ prime_pow) except -1:
"""
Returns whether this element is equal to 1.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/linkages/padics/relaxed/API.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ cdef inline void element_get_slice(celement res, celement x, long start, long le
.. NOTE::
This function only sets up a pointer to the requested slice
(the slice is not copied). Hence any future modification
(the slice is not copied). Hence any future modification
of the slice ``res`` will affect the container ``x``.
"""
pass
Expand Down
4 changes: 3 additions & 1 deletion src/sage/libs/pari/convert_sage.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ from sage.ext.stdsage cimport PY_NEW
from sage.libs.gmp.mpz cimport mpz_fits_slong_p, mpz_sgn, mpz_get_ui, mpz_set, mpz_set_si, mpz_set_ui
from sage.libs.gmp.mpq cimport mpq_denref, mpq_numref
from sage.rings.integer cimport smallInteger
from sage.rings.all import RealField, ComplexField, QuadraticField
from sage.rings.real_mpfr import RealField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.number_field.number_field import QuadraticField
from sage.matrix.args cimport (MatrixArgs, MA_ENTRIES_SEQ_SEQ,
MA_ENTRIES_SEQ_FLAT, MA_ENTRIES_CALLABLE,
MA_ENTRIES_UNKNOWN, MA_ENTRIES_SCALAR)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/cvxopt_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ cdef class CVXOPTBackend(GenericBackend):
This amounts to adding a new column to the matrix. By default,
the variable is both positive and real.
Variable types are always continuous, and thus the parameters
``binary``, ``integer``, and ``continuous`` have no effect.
``binary``, ``integer``, and ``continuous`` have no effect.
INPUT:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/cvxopt_sdp_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AUTHORS:
#*****************************************************************************

from sage.numerical.sdp import SDPSolverException
from sage.matrix.all import Matrix
from sage.matrix.constructor import Matrix
from .matrix_sdp_backend cimport MatrixSDPBackend


Expand Down
5 changes: 3 additions & 2 deletions src/sage/numerical/backends/generic_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ def default_mip_solver(solver=None):
- a string indicating one of the available solvers
(see :class:`MixedIntegerLinearProgram`);
- a callable (typically a subclass of
- a callable (typically a subclass of
:class:`sage.numerical.backends.generic_backend.GenericBackend`);
- ``None`` (default), in which case the current default solver
Expand Down Expand Up @@ -1759,7 +1759,8 @@ cpdef GenericBackend get_solver(constraint_generation = False, solver = None, ba

if base_ring is not None:
base_ring = base_ring.fraction_field()
from sage.rings.all import QQ, RDF
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
if base_ring is QQ:
solver = "Ppl"
elif solver in ["Interactivelp", "Ppl"] and not base_ring.is_exact():
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/matrix_sdp_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ other classes implementing solvers.
# http://www.gnu.org/licenses/
#*****************************************************************************

from sage.matrix.all import Matrix
from sage.matrix.constructor import Matrix
from .generic_sdp_backend cimport GenericSDPBackend

cdef class MatrixSDPBackend(GenericSDPBackend):
Expand Down
24 changes: 12 additions & 12 deletions src/sage/numerical/gauss_legendre.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def nodes_uncached(degree, prec):
- ``degree`` -- integer. The number of nodes. Must be 3 or even.
- ``prec`` -- integer (minimal value 53). Binary precision with which the
- ``prec`` -- integer (minimal value 53). Binary precision with which the
nodes and weights are computed.
OUTPUT:
Expand Down Expand Up @@ -166,13 +166,13 @@ def nodes(degree, prec):
Compute the integration nodes and weights for the Gauss-Legendre quadrature
scheme, caching the output
Works by calling ``nodes_uncached``.
Works by calling ``nodes_uncached``.
INPUT:
- ``degree`` -- integer. The number of nodes. Must be 3 or even.
- ``prec`` -- integer (minimal value 53). Binary precision with which the
- ``prec`` -- integer (minimal value 53). Binary precision with which the
nodes and weights are computed.
OUTPUT:
Expand Down Expand Up @@ -271,10 +271,10 @@ def integrate_vector_N(f, prec, N=3):
Integrate a one-argument vector-valued function numerically using Gauss-Legendre,
setting the number of nodes.
This function uses the Gauss-Legendre quadrature scheme to approximate the
This function uses the Gauss-Legendre quadrature scheme to approximate the
integral `\int_0^1 f(t) \, dt`. It is different from ``integrate_vector``
by using a specific number of nodes rather than targeting a specified error
bound on the result.
bound on the result.
INPUT:
Expand All @@ -284,9 +284,9 @@ def integrate_vector_N(f, prec, N=3):
- ``N`` -- integer (default: 3). Number of nodes to use.
OUTPUT:
OUTPUT:
Vector approximating value of the integral.
Vector approximating value of the integral.
EXAMPLES::
Expand All @@ -300,14 +300,14 @@ def integrate_vector_N(f, prec, N=3):
.. NOTE::
The nodes and weights are calculated in the real field with ``prec``
The nodes and weights are calculated in the real field with ``prec``
bits of precision. If the vector space in which ``f`` takes values
is over a field which is incompatible with this field (e.g. a finite
field) then a TypeError occurs.
field) then a TypeError occurs.
"""
# We use nodes_uncached, because caching takes up memory, and numerics in
# Bruin-DisneyHogg-Gao suggest that caching provides little benefit in the
# use in the Riemann surfaces module.
# We use nodes_uncached, because caching takes up memory, and numerics in
# Bruin-DisneyHogg-Gao suggest that caching provides little benefit in the
# use in the Riemann surfaces module.
nodelist = nodes_uncached(N, prec)
I = nodelist[0][1]*f(nodelist[0][0])
for i in range(1,len(nodelist)):
Expand Down
14 changes: 9 additions & 5 deletions src/sage/numerical/interactive_simplex_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@

from sage.misc.abstract_method import abstract_method
from sage.geometry.all import Polyhedron
from sage.matrix.all import (column_matrix,
identity_matrix,
matrix,
random_matrix)
from sage.matrix.special import column_matrix
from sage.matrix.special import identity_matrix
from sage.matrix.constructor import Matrix as matrix
from sage.matrix.special import random_matrix
from sage.misc.latex import LatexExpr, latex
from sage.misc.cachefunc import cached_function, cached_method
from sage.misc.prandom import randint, random
Expand All @@ -195,7 +195,11 @@
from sage.modules.all import random_vector, vector
from sage.misc.lazy_import import lazy_import
lazy_import("sage.plot.all", ["Graphics", "arrow", "line", "point", "rainbow", "text"])
from sage.rings.all import Infinity, PolynomialRing, QQ, RDF, ZZ
from sage.rings.infinity import Infinity
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.integer_ring import ZZ
from sage.structure.all import SageObject
from sage.symbolic.ring import SR

Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/linear_functions.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint):
sage: f._coeff_formatter(sqrt5)
'sqrt5*'
sage: from sage.rings.all import AA
sage: from sage.rings.qqbar import AA
sage: sqrt5 = AA(5).sqrt()
sage: p = MixedIntegerLinearProgram(solver='interactivelp', base_ring=AA)
sage: LF = p.linear_functions_parent()
Expand Down
Loading

0 comments on commit 49c2cd3

Please sign in to comment.