Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
git grep -l 'all import matrix' src/sage | xargs sed -i.bak 's/sage[.…
Browse files Browse the repository at this point in the history
…]matrix[.]all import matrix *$/sage.matrix.constructor import matrix/'
  • Loading branch information
Matthias Koeppe committed Sep 19, 2021
1 parent b693d89 commit 8e357e1
Show file tree
Hide file tree
Showing 38 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/sage/algebras/quatalg/quaternion_algebra_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ from sage.rings.integer cimport Integer
from sage.rings.polynomial.polynomial_integer_dense_flint cimport Polynomial_integer_dense_flint
from sage.rings.number_field.number_field_element cimport NumberFieldElement
from sage.rings.all import PolynomialRing
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix


from sage.libs.gmp.mpz cimport *
Expand Down
2 changes: 1 addition & 1 deletion src/sage/arith/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def algdep(z, degree, known_bits=None, use_bits=None, known_digits=None,

is_complex = isinstance(z, ComplexNumber)
n = degree+1
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
M = matrix(ZZ, n, n+1+int(is_complex))
r = ZZ.one() << prec
M[0, 0] = 1
Expand Down
2 changes: 1 addition & 1 deletion src/sage/calculus/functions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
r"""
Calculus functions
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.structure.element import is_Matrix
from sage.structure.element import is_Vector
from sage.symbolic.ring import is_SymbolicVariable
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/self_dual_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.matrix.constructor import block_diagonal_matrix
from sage.rings.integer_ring import ZZ
from sage.groups.perm_gps.permgroup import PermutationGroup
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/cluster_algebra_quiver/cluster_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ def g_matrix(self, show_warnings=True):
ValueError: Unable to calculate g-vectors. Need to use g vectors.
"""

from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
if self._use_g_vec:
return copy(self._G)
elif self._use_fpolys and self._cluster: # This only calls g_vector when it will not create a loop.
Expand Down Expand Up @@ -3036,7 +3036,7 @@ def universal_extension(self):
"for finite type cluster algebras at a "
"bipartite initial cluster")

from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.combinat.root_system.cartan_matrix import CartanMatrix

A = 2 - self.b_matrix().apply_map(abs).transpose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from sage.graphs.all import Graph, DiGraph
from sage.arith.all import binomial, euler_phi
from sage.all import prod
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix


class QuiverMutationTypeFactory(SageObject):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/matrices/latin.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.integer_ring import ZZ
from sage.rings.all import Integer
from sage.matrix.matrix_integer_dense import Matrix_integer_dense
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/rsk.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

from bisect import bisect_left, bisect_right
from sage.structure.element import is_Matrix
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.integer_ring import ZZ


Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#*****************************************************************************
from sage.categories.morphism import SetMorphism
from sage.categories.homset import Hom
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
import sage.combinat.partition
import sage.data_structures.blas_dict as blas
from . import classical
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/hall_littlewood.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from sage.libs.symmetrica.all import hall_littlewood
from . import sfa
import sage.combinat.partition
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.categories.morphism import SetMorphism
from sage.categories.homset import Hom
from sage.rings.rational_field import QQ
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/witt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# http://www.gnu.org/licenses/
#*****************************************************************************
from . import multiplicative
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix

class SymmetricFunctionAlgebra_witt(multiplicative.SymmetricFunctionAlgebra_multiplicative):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/subword_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ def is_root_independent(self):
sage: SC.is_root_independent()
True
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
M = matrix(self.greedy_facet(side="negative").root_configuration())
return M.rank() == max(M.ncols(), M.nrows())

Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/symmetric_group_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from sage.categories.weyl_groups import WeylGroups
from sage.rings.all import QQ, PolynomialRing
from sage.arith.all import factorial
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.modules.free_module_element import vector
from sage.groups.perm_gps.permgroup_element import PermutationGroupElement
from sage.misc.persist import register_unpickle_override
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
from sage.geometry.toric_lattice import ToricLattice, is_ToricLattice
from sage.geometry.toric_plotter import ToricPlotter
from sage.graphs.digraph import DiGraph
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
from sage.misc.all import walltime, prod
from sage.modules.all import vector, span
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/point_collection.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ from sage.structure.sage_object cimport SageObject
from sage.structure.richcmp cimport richcmp_not_equal, richcmp

from sage.geometry.toric_lattice import ToricLattice
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.misc.latex import latex


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ cdef class CombinatorialPolyhedron(SageObject):
self._n_Hrepresentation = len(facets)
far_face = tuple(i for i in range(len(Vrep) - 1))
self._dimension = data.dim()
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.all import ZZ
data = matrix(ZZ, data.incidence_matrix().rows()
+ [[ZZ.one() for _ in range(len(facets))]])
Expand Down Expand Up @@ -442,7 +442,7 @@ cdef class CombinatorialPolyhedron(SageObject):

if not isinstance(data, Matrix_integer_dense):
from sage.rings.all import ZZ
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
data = matrix(ZZ, data, sparse=False)
assert isinstance(data, Matrix_integer_dense), "conversion to ``Matrix_integer_dense`` didn't work"

Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/fqf_orthogonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from sage.groups.abelian_gps.abelian_aut import AbelianGroupAutomorphismGroup_subgroup, AbelianGroupAutomorphism, AbelianGroupAutomorphismGroup_gap
from sage.modules.torsion_quadratic_module import TorsionQuadraticModule
from sage.rings.integer_ring import ZZ
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.categories.action import Action


Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/matrix_gps/finitely_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
from sage.rings.all import QQbar
from sage.structure.element import is_Matrix
from sage.matrix.matrix_space import MatrixSpace, is_MatrixSpace
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.structure.sequence import Sequence
from sage.misc.cachefunc import cached_method
from sage.modules.free_module_element import vector
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/kenzo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups
from sage.groups.additive_abelian.additive_abelian_group import AdditiveAbelianGroup

from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.homology.chain_complex import ChainComplex
from sage.topology.simplicial_set import AbstractSimplex, SimplicialSet

Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/macaulay2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ def _matrix_(self, R):
sage: matrix(ZZ, m.transpose()).dimensions() # optional - macaulay2
(0, 2)
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
m = matrix(R, self.entries()._sage_())
if not m.nrows():
return matrix(R, 0, self.numcols()._sage_())
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def _matrix_(self, R):
50 x 50 dense matrix over Real Field with 53 bits of precision
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
matlab = self.parent()
entries = matlab.strip_answer(matlab.eval("mat2str({0})".format(self.name())))
entries = entries.strip()[1:-1].replace(';', ' ')
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 @@ -864,5 +864,5 @@ cdef cmatrix_mod_pn(celement a, long aprec, long valshift, PowComputer_ prime_po
L[-1].append(zero)
fmpz_poly_shift_left(prime_pow.poly_matmod, prime_pow.poly_matmod, 1)
creduce(prime_pow.poly_matmod, prime_pow.poly_matmod, aprec, prime_pow)
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
return matrix(R, deg, deg, L)
2 changes: 1 addition & 1 deletion src/sage/matrix/strassen.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def test(n, m, R, c=2):
3 True
4 True
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
A = matrix(R,n,m,range(n*m))
B = A.__copy__(); B._echelon_in_place_classical()
C = A.__copy__(); C._echelon_strassen(c)
Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/modsym/heilbronn.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def hecke_images_gamma0_weight2(int u, int v, int N, indices, R):
# Create a zero dense matrix over QQ with len(indices) rows
# and #P^1(N) columns.
cdef Matrix_rational_dense T
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.rational_field import QQ
T = matrix(QQ, len(indices), len(P1), sparse=False)
original_base_ring = R.base_ring()
Expand Down Expand Up @@ -684,7 +684,7 @@ def hecke_images_nonquad_character_weight2(int u, int v, int N, indices, chi, R)
# Create a zero dense matrix over K with len(indices) rows
# and #P^1(N) columns.
cdef Matrix_cyclo_dense T
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
T = matrix(K, len(indices), len(P1), sparse=False)

cdef Py_ssize_t i, j
Expand Down Expand Up @@ -778,7 +778,7 @@ def hecke_images_quad_character_weight2(int u, int v, int N, indices, chi, R):
# Create a zero dense matrix over QQ with len(indices) rows
# and #P^1(N) columns.
cdef Matrix_rational_dense T
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
T = matrix(QQ, len(indices), len(P1), sparse=False)

if R.base_ring() != QQ:
Expand Down Expand Up @@ -868,7 +868,7 @@ def hecke_images_gamma0_weight_k(int u, int v, int i, int N, int k, indices, R):
# So we create a zero dense matrix over QQ with len(indices) rows
# and #P^1(N) * (k-1) columns.
cdef Matrix_rational_dense T
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.rational_field import QQ
T = matrix(QQ, len(indices), len(P1)*(k-1), sparse=False)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/pollack_stevens/dist.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ from sage.arith.all import binomial, bernoulli
from sage.modules.free_module_element import vector, zero_vector
from sage.matrix.matrix cimport Matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.misc.prandom import random
from sage.functions.other import floor
from sage.structure.element cimport RingElement, Element
Expand Down
2 changes: 1 addition & 1 deletion src/sage/plot/plot3d/list_plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from sage.structure.element import is_Matrix
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.all import RDF
from sage.misc.superseded import deprecation

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/finite_field_base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ cdef class FiniteField(Field):
inclusion_map = self.coerce_map_from(base)

from sage.modules.free_module_element import vector
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from .maps_finite_field import (
MorphismVectorSpaceToFiniteField, MorphismFiniteFieldToVectorSpace)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement):
[1590 1375 1695 1032 2358]
[2415 590 2370 2970 1032]
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
# this may be the wrong precision when ram_prec_cap is not divisible by e.
R = IntegerModRing(self.prime_pow.pow_Integer(self.prime_pow.capdiv(self.absprec)))
n = self.prime_pow.deg
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2859,7 +2859,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement):
if self.valuation_c() < 0:
raise ValueError("self must be integral")
n = self.prime_pow.deg
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
if self._is_exact_zero():
from sage.rings.integer_ring import IntegerRing
return matrix(IntegerRing(), n, n)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement):
[1590 1375 1695 1032 2358]
[2415 590 2370 2970 1032]
"""
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
R = IntegerModRing(self.prime_pow.pow_Integer(self.prime_pow.prec_cap))
n = self.prime_pow.deg
L = []
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/qadic_flint_CR.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ cdef class qAdicCappedRelativeElement(CRElement):
if self.ordp < 0:
raise ValueError("self must be integral")
if exactzero(self.ordp):
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
return matrix(ZZ, self.prime_pow.deg, self.prime_pow.deg)
else:
return cmatrix_mod_pn(self.unit, self.ordp + self.relprec, self.ordp, self.prime_pow)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/padics/qadic_flint_FP.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ cdef class qAdicFloatingPointElement(FPElement):
if self.ordp < 0:
raise ValueError("self must be integral")
if very_pos_val(self.ordp):
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
return matrix(ZZ, self.prime_pow.deg, self.prime_pow.deg)
else:
return cmatrix_mod_pn(self.unit, self.ordp + self.prime_pow.prec_cap, self.ordp, self.prime_pow)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/curves/affine_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
from sage.categories.homset import Hom, End, hom
from sage.categories.number_fields import NumberFields

from sage.matrix.all import matrix
from sage.matrix.constructor import matrix

from sage.rings.all import degree_lowest_rational_function
from sage.rings.number_field.number_field import NumberField
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/curves/projective_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
from sage.categories.homset import Hom, End

from sage.interfaces.all import singular
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.misc.all import add, sage_eval

from sage.rings.all import degree_lowest_rational_function, IntegerRing
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/saturation.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def p_saturation(self, Plist, p, sieve=True):

if verbose:
print("Using sieve method to saturate...")
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.sets.primes import Primes

A = matrix(GF(p), 0, n)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from sage.arith.all import binomial, integer_ceil as ceil
from sage.functions.log import log
from sage.functions.other import floor
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
from sage.misc.misc import newton_method_sizes
from sage.misc.profiler import Profiler
Expand Down
2 changes: 1 addition & 1 deletion src/sage/stats/hmm/hmm.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ from cysignals.signals cimport sig_on, sig_off

from sage.finance.time_series cimport TimeSeries
from sage.structure.element import is_Matrix
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.misc.randstate cimport current_randstate, randstate
from cpython.object cimport PyObject_RichCompare

Expand Down
2 changes: 1 addition & 1 deletion src/sage/symbolic/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ def solve_mod(eqns, modulus, solution_dict=False):
from sage.symbolic.expression import is_Expression
from sage.misc.all import cartesian_product_iterator
from sage.modules.free_module_element import vector
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix

if not isinstance(eqns, (list, tuple)):
eqns = [eqns]
Expand Down

0 comments on commit 8e357e1

Please sign in to comment.