From 4910b66dd667cb9e1f84d0b1182cac657a76af5c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 21 Feb 2023 15:34:01 +0100 Subject: [PATCH] Rename some CamelCase constructors to snake_case FractionField -> fraction_field LaurentSeriesField -> laurent_series_field LaurentSeriesRing -> laurent_series_ring MatrixSpace -> matrix_space NumberField -> number_field PolynomialRing -> polynomial_ring PowerSeriesRing -> power_series_ring ResidueField -> residue_field ResidueRing -> residue_ring --- docs/src/constructors.md | 26 +- docs/src/fraction.md | 34 +- docs/src/ideal.md | 8 +- docs/src/index.md | 14 +- docs/src/matrix.md | 72 +- docs/src/matrix_algebras.md | 4 +- docs/src/mpoly_interface.md | 2 +- docs/src/mpolynomial.md | 54 +- docs/src/mseries.md | 16 +- docs/src/ncpolynomial.md | 38 +- docs/src/numberfield.md | 8 +- docs/src/polynomial.md | 104 +-- docs/src/puiseux.md | 2 +- docs/src/rand.md | 6 +- docs/src/rational.md | 4 +- docs/src/residue.md | 36 +- docs/src/ring_interface.md | 2 +- docs/src/series.md | 52 +- docs/src/total_fraction.md | 12 +- docs/src/types.md | 2 +- docs/src/visualizing_types.md | 4 +- src/AbsMSeries.jl | 26 +- src/AbsSeries.jl | 6 +- src/AbstractAlgebra.jl | 20 +- src/Aliases.jl | 21 + src/Fraction.jl | 12 +- src/LaurentSeries.jl | 32 +- src/MPoly.jl | 38 +- src/Matrix.jl | 58 +- src/NCPoly.jl | 18 +- src/NCRings.jl | 2 +- src/NumberField.jl | 4 +- src/Poly.jl | 22 +- src/RelSeries.jl | 28 +- src/Residue.jl | 14 +- src/ResidueField.jl | 14 +- src/Rings.jl | 2 +- src/algorithms/MPolyFactor.jl | 8 +- src/fundamental_interface.jl | 16 +- src/generic/AbsMSeries.jl | 14 +- src/generic/Fraction.jl | 4 +- src/generic/GenericTypes.jl | 26 +- src/generic/Ideal.jl | 4 +- src/generic/LaurentMPoly.jl | 2 +- src/generic/LaurentPoly.jl | 2 +- src/generic/LaurentSeries.jl | 102 +-- src/generic/MPoly.jl | 8 +- src/generic/Matrix.jl | 4 +- src/generic/NCPoly.jl | 4 +- src/generic/NumberField.jl | 8 +- src/generic/Poly.jl | 4 +- src/generic/PuiseuxSeries.jl | 14 +- src/generic/RationalFunctionField.jl | 10 +- src/generic/RelSeries.jl | 4 +- src/generic/ResidueField.jl | 2 +- src/generic/UnivPoly.jl | 4 +- src/julia/Rational.jl | 4 +- test/Benchmark-test.jl | 18 +- test/Factor-test.jl | 2 +- test/NCRings-test.jl | 10 +- test/PrettyPrinting-test.jl | 4 +- test/Rings-conformance-tests.jl | 4 +- test/algorithms/MPolyEvaluate-test.jl | 2 +- test/algorithms/MPolyFactor-test.jl | 4 +- test/generic/AbsMSeries-test.jl | 74 +- test/generic/AbsSeries-test.jl | 164 ++--- test/generic/FactoredFraction-test.jl | 20 +- test/generic/Fraction-test.jl | 68 +- test/generic/FreeAssAlgebra-test.jl | 10 +- test/generic/FreeModule-test.jl | 12 +- test/generic/FunctionField-test.jl | 2 +- test/generic/Ideal-test.jl | 44 +- test/generic/LaurentMPoly-test.jl | 6 +- test/generic/LaurentPoly-test.jl | 16 +- test/generic/LaurentSeries-test.jl | 186 ++--- test/generic/MPoly-test.jl | 134 ++-- test/generic/Matrix-test.jl | 768 ++++++++++----------- test/generic/MatrixAlgebra-test.jl | 206 +++--- test/generic/Module-test.jl | 2 +- test/generic/ModuleHomomorphism-test.jl | 4 +- test/generic/NCPoly-test.jl | 50 +- test/generic/Poly-test.jl | 400 +++++------ test/generic/PuiseuxSeries-test.jl | 36 +- test/generic/RationalFunctionField-test.jl | 4 +- test/generic/RelSeries-test.jl | 176 ++--- test/generic/Residue-test.jl | 152 ++-- test/generic/ResidueField-test.jl | 92 +-- test/generic/TotalFraction-test.jl | 26 +- test/generic/UnivPoly-test.jl | 10 +- test/julia/Floats-test.jl | 2 +- test/julia/GFElem-test.jl | 4 +- test/julia/Rationals-test.jl | 4 +- todo.txt | 2 +- 93 files changed, 1900 insertions(+), 1879 deletions(-) diff --git a/docs/src/constructors.md b/docs/src/constructors.md index 295617b17e..71613ef0b7 100644 --- a/docs/src/constructors.md +++ b/docs/src/constructors.md @@ -41,10 +41,10 @@ parent object before one can use it to construct element objects. AbstractAlgebra.jl provides a set of functions for constructing such parent objects. For example, to create a parent object for univariate polynomials over the integers, -we use the `PolynomialRing` parent object constructor. +we use the `polynomial_ring` parent object constructor. ```julia -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") f = x^3 + 3x + 1 g = R(12) ``` @@ -62,14 +62,14 @@ AbstractAlgebra.jl and explain what mathematical domains they represent. | $R = \mathbb{Z}$ | `R = ZZ` | | $R = \mathbb{Q}$ | `R = QQ` | | $R = \mathbb{F}_{p}$ | `R = GF(p)` | -| $R = \mathbb{Z}/n\mathbb{Z}$ | `R = ResidueRing(ZZ, n)` | -| $S = R[x]$ | `S, x = PolynomialRing(R, "x")` | -| $S = R[x, y]$ | `S, (x, y) = PolynomialRing(R, ["x", "y"])` | -| $S = R[[x]]$ (to precision $n$) | `S, x = PowerSeriesRing(R, n, "x")` | -| $S = R((x))$ (to precision $n$) | `S, x = LaurentSeriesRing(R, n, "x")` | -| $S = K((x))$ (to precision $n$) | `S, x = LaurentSeriesField(K, n, "x")` | -| $S = \mathrm{Frac}_R$ | `S = FractionField(R)` | -| $S = R/(f)$ | `S = ResidueRing(R, f)` | -| $S = R/(f)$ (with $(f)$ maximal) | `S = ResidueField(R, f)` | -| $S = \mathrm{Mat}_{m\times n}(R)$| `S = MatrixSpace(R, m, n)` | -| $S = \mathbb{Q}[x]/(f)$ | `S, a = NumberField(f, "a")` | +| $R = \mathbb{Z}/n\mathbb{Z}$ | `R = residue_ring(ZZ, n)` | +| $S = R[x]$ | `S, x = polynomial_ring(R, "x")` | +| $S = R[x, y]$ | `S, (x, y) = polynomial_ring(R, ["x", "y"])`| +| $S = R[[x]]$ (to precision $n$) | `S, x = power_series_ring(R, n, "x")` | +| $S = R((x))$ (to precision $n$) | `S, x = laurent_series_ring(R, n, "x")` | +| $S = K((x))$ (to precision $n$) | `S, x = laurent_series_field(K, n, "x")` | +| $S = \mathrm{Frac}_R$ | `S = fraction_field(R)` | +| $S = R/(f)$ | `S = residue_ring(R, f)` | +| $S = R/(f)$ (with $(f)$ maximal) | `S = residue_field(R, f)` | +| $S = \mathrm{Mat}_{m\times n}(R)$| `S = matrix_space(R, m, n)` | +| $S = \mathbb{Q}[x]/(f)$ | `S, a = number_field(f, "a")` | diff --git a/docs/src/fraction.md b/docs/src/fraction.md index 8819f5931c..938ce3b638 100644 --- a/docs/src/fraction.md +++ b/docs/src/fraction.md @@ -49,7 +49,7 @@ In order to construct fractions in AbstractAlgebra.jl, one can first construct t fraction field itself. This is accomplished with the following constructor. ```julia -FractionField(R::Ring; cached::Bool = true) +fraction_field(R::Ring; cached::Bool = true) ``` Given a base ring `R` return the parent object of the fraction field of $R$. By default @@ -62,10 +62,10 @@ resulting parent objects to coerce various elements into the fraction field. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S = FractionField(R) +julia> S = fraction_field(R) Fraction field of Univariate Polynomial Ring in x over Integers julia> f = S() @@ -92,7 +92,7 @@ FactoredFractionField(R::Ring; cached::Bool = true) **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> S = FactoredFractionField(R) @@ -136,10 +136,10 @@ fraction field without constructing the fraction field parent first. **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = FractionField(R) +julia> S = fraction_field(R) Fraction field of Univariate Polynomial Ring in x over Rationals julia> f = S(x + 1) @@ -183,10 +183,10 @@ characteristic is not known an exception is raised. **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = FractionField(R) +julia> S = fraction_field(R) Fraction field of Univariate Polynomial Ring in x over Rationals julia> f = S(x + 1) @@ -238,10 +238,10 @@ denominator(a::FracElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = FractionField(R) +julia> S = fraction_field(R) Fraction field of Univariate Polynomial Ring in x over Rationals julia> f = S(x + 1) @@ -281,7 +281,7 @@ gcd{T <: RingElem}(::FracElem{T}, ::FracElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> f = (x + 1)//(x^3 + 3x + 1) @@ -308,10 +308,10 @@ Base.sqrt(::FracElem{T}) where {T <: RingElem} **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = FractionField(R) +julia> S = fraction_field(R) Fraction field of Univariate Polynomial Ring in x over Rationals julia> a = (21//4*x^6 - 15*x^5 + 27//14*x^4 + 9//20*x^3 + 3//7*x + 9//10)//(x + 3) @@ -340,7 +340,7 @@ valuation{T <: RingElem}(::FracElem{T}, ::T) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> f = (x + 1)//(x^3 + 3x + 1) @@ -370,11 +370,11 @@ rand(R::FracField, v...) ```@repl using AbstractAlgebra # hide -K = FractionField(ZZ) +K = fraction_field(ZZ) f = rand(K, -10:10) -R, x = PolynomialRing(ZZ, "x") -S = FractionField(R) +R, x = polynomial_ring(ZZ, "x") +S = fraction_field(R) g = rand(S, -1:3, -10:10) ``` diff --git a/docs/src/ideal.md b/docs/src/ideal.md index b09083ee90..ce1ede1fcb 100644 --- a/docs/src/ideal.md +++ b/docs/src/ideal.md @@ -60,7 +60,7 @@ contain duplicates, zero entries or be empty. **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> V = [3*x^2*y - 3*y^2, 9*x^2*y + 7*x*y] @@ -92,7 +92,7 @@ gens(::Generic.Ideal{T}) where T <: RingElement **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> V = [1 + 2x^2 + 3x^3, 5x^4 + 1, 2x - 1] @@ -128,7 +128,7 @@ intersection(::Generic.Ideal{T}, ::Generic.Ideal{T}) where T <: RingElement **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> V = [1 + 2x^2 + 3x^3, 5x^4 + 1, 2x - 1] @@ -170,7 +170,7 @@ normal_form(::U, ::Generic.Ideal{U}) where {T <: RingElement, U <: Union{PolyEle **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> V = [3*x^2*y - 3*y^2, 9*x^2*y + 7*x*y] diff --git a/docs/src/index.md b/docs/src/index.md index 8ebdef139d..9f6db8155c 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -57,7 +57,7 @@ This example makes use of multivariate polynomials. ```julia using AbstractAlgebra -R, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"]) +R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]) f = x + y + z + 1 @@ -73,11 +73,11 @@ using AbstractAlgebra R = GF(7) -S, y = PolynomialRing(R, "y") +S, y = polynomial_ring(R, "y") -T = ResidueRing(S, y^3 + 3y + 1) +T = residue_ring(S, y^3 + 3y + 1) -U, z = PolynomialRing(T, "z") +U, z = polynomial_ring(T, "z") f = (3y^2 + y + 2)*z^2 + (2*y^2 + 1)*z + 4y + 3; @@ -95,9 +95,9 @@ Here is an example using matrices. ```julia using AbstractAlgebra -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") -S = MatrixSpace(R, 10, 10) +S = matrix_space(R, 10, 10) M = rand(S, 0:3, -10:10); @@ -111,7 +111,7 @@ using AbstractAlgebra R, x = QQ["x"] -S, t = PowerSeriesRing(R, 30, "t") +S, t = power_series_ring(R, 30, "t") u = t + O(t^100) diff --git a/docs/src/matrix.md b/docs/src/matrix.md index bcbd1ac236..4580bcfb6d 100644 --- a/docs/src/matrix.md +++ b/docs/src/matrix.md @@ -66,7 +66,7 @@ creation of matrix algebras separately in a dedicated section elsewhere in the documentation. ```julia -MatrixSpace(R::Ring, rows::Int, cols::Int; cache::Bool=true) +matrix_space(R::Ring, rows::Int, cols::Int; cache::Bool=true) ``` Construct the space of matrices with the given number of rows and columns over the @@ -80,10 +80,10 @@ resulting parent objects to coerce various elements into the matrix space. **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> A = S() @@ -145,7 +145,7 @@ Also see the Matrix interface for a list of other ways to create matrices. **Examples** ```jldoctest -julia> S = MatrixSpace(QQ, 2, 3) +julia> S = matrix_space(QQ, 2, 3) Matrix Space of 2 rows and 3 columns over Rationals julia> T = MatrixAlgebra(QQ, 2) @@ -175,10 +175,10 @@ julia> N3 = T(BigInt[2, 3, 1, 1]) [2//1 3//1] [1//1 1//1] -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> M = R[t + 1 1; t^2 0] @@ -299,7 +299,7 @@ Matrices also support iteration, and therefore functions accepting an iterator can be called on them, e.g.: ```jldoctest -julia> M = MatrixSpace(ZZ, 2, 3); x = M(1:6) +julia> M = matrix_space(ZZ, 2, 3); x = M(1:6) [1 2 3] [4 5 6] @@ -443,10 +443,10 @@ Base.map!(f, ::MatrixElem{S}, ::MatrixElem{T}) where {S <: RingElement, T <: Rin **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -785,13 +785,13 @@ fflu{T <: RingElem}(::MatElem{T}, ::SymmetricGroup) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) -julia> S = MatrixSpace(K, 3, 3) +julia> S = matrix_space(K, 3, 3) Matrix Space of 3 rows and 3 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> A = S([K(0) 2a + 3 a^2 + 1; a^2 - 2 a - 1 2a; a^2 - 2 a - 1 2a]) @@ -822,13 +822,13 @@ is_rref{T <: FieldElem}(::MatElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) -julia> S = MatrixSpace(K, 3, 3) +julia> S = matrix_space(K, 3, 3) Matrix Space of 3 rows and 3 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> M = S([K(0) 2a + 3 a^2 + 1; a^2 - 2 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -842,10 +842,10 @@ julia> r, A = rref(M) julia> is_rref(A) true -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in x over Integers julia> M = S([R(0) 2x + 3 x^2 + 1; x^2 - 2 x - 1 2x; x^2 + 3x + 1 2x R(1)]) @@ -894,7 +894,7 @@ pfaffians(::MatElem, ::Int) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, ["x$i" for i in 1:6]) +julia> R, x = polynomial_ring(QQ, ["x$i" for i in 1:6]) (Multivariate Polynomial Ring in 6 variables x1, x2, x3, x4, ..., x6 over Rationals, AbstractAlgebra.Generic.MPoly{Rational{BigInt}}[x1, x2, x3, x4, x5, x6]) julia> M = R[0 x[1] x[2] x[3]; -x[1] 0 x[4] x[5]; -x[2] -x[4] 0 x[6]; -x[3] -x[5] -x[6] 0] @@ -950,16 +950,16 @@ can_solve_left_reduced_triu{T <: RingElement}(::MatElem{T}, ::MatElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) -julia> S = MatrixSpace(K, 3, 3) +julia> S = matrix_space(K, 3, 3) Matrix Space of 3 rows and 3 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 -julia> U = MatrixSpace(K, 3, 1) +julia> U = matrix_space(K, 3, 1) Matrix Space of 3 rows and 1 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> A = S([K(0) 2a + 3 a^2 + 1; a^2 - 2 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -1013,13 +1013,13 @@ julia> x = solve_triu(A, bb, false) [-3//5*x^2 - 3//5*x - 12//5] [ x^2 + 2] -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in x over Integers -julia> U = MatrixSpace(R, 3, 2) +julia> U = matrix_space(R, 3, 2) Matrix Space of 3 rows and 2 columns over Univariate Polynomial Ring in x over Integers julia> A = S([R(0) 2x + 3 x^2 + 1; x^2 - 2 x - 1 2x; x^2 + 3x + 1 2x R(1)]) @@ -1035,10 +1035,10 @@ julia> bbb = U(transpose([2x x + 1 (-x - 1); x + 1 (-x) x^2])) julia> x, d = solve_rational(A, bbb) ([3*x^4-10*x^3-8*x^2-11*x-4 -x^5+3*x^4+x^3-2*x^2+3*x-1; -2*x^5-x^4+6*x^3+2*x+1 x^6+x^5+4*x^4+9*x^3+8*x^2+5*x+2; 6*x^4+12*x^3+15*x^2+6*x-3 -2*x^5-4*x^4-6*x^3-9*x^2-4*x+1], x^5 + 2*x^4 + 15*x^3 + 18*x^2 + 8*x + 7) -julia> S = MatrixSpace(ZZ, 3, 3) +julia> S = matrix_space(ZZ, 3, 3) Matrix Space of 3 rows and 3 columns over Integers -julia> T = MatrixSpace(ZZ, 3, 1) +julia> T = matrix_space(ZZ, 3, 1) Matrix Space of 3 rows and 1 columns over Integers julia> A = S([BigInt(2) 3 5; 1 4 7; 9 2 2]) @@ -1069,13 +1069,13 @@ is_invertible{T <: RingElement}(::MatrixElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) -julia> S = MatrixSpace(K, 3, 3) +julia> S = matrix_space(K, 3, 3) Matrix Space of 3 rows and 3 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> A = S([K(0) 2a + 3 a^2 + 1; a^2 - 2 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -1094,10 +1094,10 @@ true julia> is_invertible_with_inverse(A) (true, [-343//7817*x^2+717//7817*x-2072//7817 -4964//23451*x^2+2195//23451*x-11162//23451 -232//23451*x^2-4187//23451*x-1561//23451; 128//7817*x^2-655//7817*x+2209//7817 599//23451*x^2-2027//23451*x-1327//23451 -1805//23451*x^2+2702//23451*x-7394//23451; 545//7817*x^2+570//7817*x+2016//7817 -1297//23451*x^2-5516//23451*x-337//23451 8254//23451*x^2-2053//23451*x+16519//23451]) -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in x over Integers julia> A = S([R(0) 2x + 3 x^2 + 1; x^2 - 2 x - 1 2x; x^2 + 3x + 1 2x R(1)]) @@ -1127,7 +1127,7 @@ right_kernel{T <: RingElem}(::MatElem{T}) **Examples** ```jldoctest -julia> S = MatrixSpace(ZZ, 4, 4) +julia> S = matrix_space(ZZ, 4, 4) Matrix Space of 4 rows and 4 columns over Integers julia> M = S([1 2 0 4; @@ -1160,10 +1160,10 @@ is_hessenberg{T <: RingElem}(::MatElem{T}) **Examples** ```jldoctest -julia> R = ResidueRing(ZZ, 7) +julia> R = residue_ring(ZZ, 7) Residue ring of Integers modulo 7 -julia> S = MatrixSpace(R, 4, 4) +julia> S = matrix_space(R, 4, 4) Matrix Space of 4 rows and 4 columns over Residue ring of Integers modulo 7 julia> M = S([R(1) R(2) R(4) R(3); R(2) R(5) R(1) R(0); @@ -1290,7 +1290,7 @@ popov_with_transform{T <: PolyElem}(::MatElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x"); +julia> R, x = polynomial_ring(QQ, "x"); julia> A = matrix(R, map(R, Any[1 2 3 x; x 2*x 3*x x^2; x x^2+1 x^3+x^2 x^4+x^2+1])) [1 2 3 x] diff --git a/docs/src/matrix_algebras.md b/docs/src/matrix_algebras.md index 77c8c6a9af..66e06c8d64 100644 --- a/docs/src/matrix_algebras.md +++ b/docs/src/matrix_algebras.md @@ -74,7 +74,7 @@ resulting parent objects to coerce various elements into the matrix algebra. **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) julia> S = MatrixAlgebra(R, 3) @@ -141,7 +141,7 @@ degree(::Generic.MatAlgElem) **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) julia> S = MatrixAlgebra(R, 3) diff --git a/docs/src/mpoly_interface.md b/docs/src/mpoly_interface.md index 52cecfc05b..27ddf91862 100644 --- a/docs/src/mpoly_interface.md +++ b/docs/src/mpoly_interface.md @@ -80,7 +80,7 @@ and floating point types. To construct a multivariate polynomial ring, there is the following constructor. ```julia -PolynomialRing(R::Ring, s::Vector{AbstractString}; ordering=:lex, cached=true) +polynomial_ring(R::Ring, s::Vector{AbstractString}; ordering=:lex, cached=true) ``` Return a tuple, `S, vars` consisting of a polynomial ring $S$ and an array of diff --git a/docs/src/mpolynomial.md b/docs/src/mpolynomial.md index 7790790777..9dbc13425f 100644 --- a/docs/src/mpolynomial.md +++ b/docs/src/mpolynomial.md @@ -50,8 +50,8 @@ construct the polynomial ring itself. This is accomplished with one of the follo constructors. ```@docs -PolynomialRing(R::Ring, S::Vector{String}; cached::Bool = true, ordering::Symbol=:lex) -PolynomialRing(R::Ring, n::Int, s::String; cached::Bool = false, ordering::Symbol = :lex) +polynomial_ring(R::Ring, S::Vector{String}; cached::Bool = true, ordering::Symbol=:lex) +polynomial_ring(R::Ring, n::Int, s::String; cached::Bool = false, ordering::Symbol = :lex) ``` Like for univariate polynomials, a shorthand constructor is @@ -69,7 +69,7 @@ ring. **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:deglex) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:deglex) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> T, (z, t) = QQ["z", "t"] @@ -143,7 +143,7 @@ $m$. **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> C = MPolyBuildCtx(R) @@ -167,7 +167,7 @@ julia> push_term!(C, ZZ(4), [1, 1]); julia> f = finish(C) 4*x*y -julia> S, (x, y) = PolynomialRing(QQ, ["x", "y"]) +julia> S, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Rationals, AbstractAlgebra.Generic.MPoly{Rational{BigInt}}[x, y]) julia> f = S(Rational{BigInt}[2, 3, 1], [[3, 2], [1, 0], [0, 1]]) @@ -359,7 +359,7 @@ coeff(::MPolyElem{T}, ::MPolyElem{T}) where T <: RingElement **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = x^2 + 2x + 1 @@ -395,7 +395,7 @@ true julia> is_unit(R(1)) true -julia> S, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> S, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = x^3*y + 3x*y^2 + 1 @@ -424,7 +424,7 @@ x^3*y julia> setcoeff!(f, [3, 1], 12) 12*x^3*y + 3*x*y^2 + 1 -julia> S, (x, y) = PolynomialRing(QQ, ["x", "y"]; ordering=:deglex) +julia> S, (x, y) = polynomial_ring(QQ, ["x", "y"]; ordering=:deglex) (Multivariate Polynomial Ring in x, y over Rationals, AbstractAlgebra.Generic.MPoly{Rational{BigInt}}[x, y]) julia> V = symbols(S) @@ -440,7 +440,7 @@ julia> X = gens(S) julia> ord = ordering(S) :deglex -julia> S, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> S, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = x^3*y + 3x*y^2 + 1 @@ -458,7 +458,7 @@ true julia> d = total_degree(f) 4 -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = 2x^2*y + 2x + y + 1 @@ -479,7 +479,7 @@ julia> v, q = remove(f*g^3, g) julia> n = valuation(f*g^3, g) 3 -julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Rationals, AbstractAlgebra.Generic.MPoly{Rational{BigInt}}[x, y]) julia> f = 3x^2*y^2 + 2x + 1 @@ -505,7 +505,7 @@ is_square(::MPolyElem) **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = -4*x^5*y^4 + 5*x^5*y^3 + 4*x^4 - x^3*y^4 @@ -532,7 +532,7 @@ exponent_vectors(a::MPoly) **Examples** ```jldoctest -julia> S, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> S, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = x^3*y + 3x*y^2 + 1 @@ -579,7 +579,7 @@ map_coefficients(::Any, p::MPolyElem) **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> fz = x^2*y^2 + x + 1 @@ -598,10 +598,10 @@ In case a specific parent ring is constructed, it can also be passed to the func **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) -julia> S, = PolynomialRing(QQ, ["x", "y"]) +julia> S, = polynomial_ring(QQ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Rationals, AbstractAlgebra.Generic.MPoly{Rational{BigInt}}[x, y]) julia> fz = x^5 + y^3 + 1 @@ -626,7 +626,7 @@ coeff(a::T, vars::Vector{T}, exps::Vector{Int}) where T <: MPolyElem **Examples** ```jldoctest -julia> R, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"]) +julia> R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]) (Multivariate Polynomial Ring in x, y, z over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y, z]) julia> f = x^4*y^2*z^2 - 2x^4*y*z^2 + 4x^4*z^2 + 2x^2*y^2 + x + 1 @@ -661,7 +661,7 @@ inflate(f::T, vars::Vector{T}, shift::Vector{Int}, defl::Vector{Int}) where T <: **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = x^7*y^8 + 3*x^4*y^8 - x^4*y^2 + 5x*y^5 - x*y^2 @@ -702,10 +702,10 @@ to_univariate(R::PolyRing{T}, p::MPolyElem{T}) where T <: RingElement **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) -julia> S, z = PolynomialRing(ZZ, "z") +julia> S, z = polynomial_ring(ZZ, "z") (Univariate Polynomial Ring in z over Integers, z) julia> f = 2x^5 + 3x^4 - 2x^2 - 1 @@ -751,7 +751,7 @@ evaluate(::MPolyElem{T}, ::Vector{U}) where {T <: RingElement, U <: NCRingElem} **Examples** ```jldoctest -julia> R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = 2x^2*y^2 + 3x + y + 1 @@ -775,7 +775,7 @@ julia> evaluate(f, [x + y, 2y - x]) julia> f(x + y, 2y - x) 2*x^4 - 4*x^3*y - 6*x^2*y^2 + 8*x*y^3 + 2*x + 8*y^4 + 5*y + 1 -julia> R, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"]) +julia> R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]) (Multivariate Polynomial Ring in x, y, z over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y, z]) julia> f = x^2*y^2 + 2x*z + 3y*z + z + 1 @@ -829,7 +829,7 @@ tail(::MPolyElem{T}) where T <: RingElement ```julia using AbstractAlgebra -R,(x,y) = PolynomialRing(ZZ, ["x", "y"], ordering=:deglex) +R,(x,y) = polynomial_ring(ZZ, ["x", "y"], ordering=:deglex) p = 2*x*y + 3*y^3 + 1 leading_term(p) leading_monomial(p) @@ -863,7 +863,7 @@ lcm(a::MPolyElem{T}, b::MPolyElem{T}) where {T <: RingElement} ```jldoctest julia> using AbstractAlgebra -julia> R,(x,y) = PolynomialRing(ZZ, ["x", "y"]) +julia> R,(x,y) = polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> a = x*y + 2*y @@ -892,7 +892,7 @@ derivative(::MPolyElem{T}, ::MPolyElem{T}) where T <: RingElement **Examples** ```jldoctest -julia> R, (x, y) = AbstractAlgebra.PolynomialRing(ZZ, ["x", "y"]) +julia> R, (x, y) = AbstractAlgebra.polynomial_ring(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integers, AbstractAlgebra.Generic.MPoly{BigInt}[x, y]) julia> f = x*y + x + y + 1 @@ -936,9 +936,9 @@ rand(R::MPolyRing, exp_range::UnitRange{Int}, term_range::UnitRange{Int}, v...) ```@repl using AbstractAlgebra # hide -R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) +R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) f = rand(R, -1:2, 3:5, -10:10) -S, (s, t) = PolynomialRing(GF(7), ["x", "y"]) +S, (s, t) = polynomial_ring(GF(7), ["x", "y"]) g = rand(S, -1:2, 3:5) ``` diff --git a/docs/src/mseries.md b/docs/src/mseries.md index 94f3f0d439..5d9798d8eb 100644 --- a/docs/src/mseries.md +++ b/docs/src/mseries.md @@ -64,7 +64,7 @@ constructors. For the unweighted case: ```julia -PowerSeriesRing(R::Ring, prec::Vector{Int}, s::Vector{U}; cached::Bool = true) where U <: AbstractString +power_series_ring(R::Ring, prec::Vector{Int}, s::Vector{U}; cached::Bool = true) where U <: AbstractString ``` Given a base ring `R` and a vector of strings `s` specifying how the generators @@ -78,7 +78,7 @@ object `S` will depend on `R`, the precision vector and the variable names In the weighted case: ``` -PowerSeriesRing(R::Ring, weights::Vector{Int}, s::Vector{U}, prec::Int; cached::Bool = true) where U <: AbstractString +power_series_ring(R::Ring, weights::Vector{Int}, s::Vector{U}, prec::Int; cached::Bool = true) where U <: AbstractString ``` Given a base ring `R` and a vector of strings `s` specifying how the generators @@ -113,7 +113,7 @@ precisions can be replaced by a single integer in the constructor. **Examples** ```jldoctest -julia> R, (x, y) = PowerSeriesRing(ZZ, [2, 3], ["x", "y"]) +julia> R, (x, y) = power_series_ring(ZZ, [2, 3], ["x", "y"]) (Multivariate power series ring in x, y over Integers, AbstractAlgebra.Generic.AbsMSeries{BigInt, AbstractAlgebra.Generic.MPoly{BigInt}}[x + O(y^3) + O(x^2), y + O(y^3) + O(x^2)]) julia> f = R() @@ -131,13 +131,13 @@ julia> k = R(x + 1) julia> m = x + y + O(y^2) y + x + O(y^2) + O(x^2) -julia> R, (x, y) = PowerSeriesRing(ZZ, 3, ["x", "y"]) +julia> R, (x, y) = power_series_ring(ZZ, 3, ["x", "y"]) (Multivariate power series ring in x, y over Integers, AbstractAlgebra.Generic.AbsMSeries{BigInt, AbstractAlgebra.Generic.MPoly{BigInt}}[x + O(y^3) + O(x^3), y + O(y^3) + O(x^3)]) julia> n = x + y + O(R, 2) y + x + O(y^2) + O(x^2) -julia> R, (x, y) = PowerSeriesRing(ZZ, [2, 3], 10, ["x", "y"]) +julia> R, (x, y) = power_series_ring(ZZ, [2, 3], 10, ["x", "y"]) (Multivariate power series ring in x, y over Integers, AbstractAlgebra.Generic.AbsMSeries{BigInt, AbstractAlgebra.Generic.MPoly{BigInt}}[x + O(10), y + O(10)]) julia> R() @@ -153,7 +153,7 @@ Once a multivariate series ring is constructed, there are various ways to construct series in that ring. The easiest way is simply using the generators returned by the -`PowerSeriesRing` constructor and build up the power series using basic +`power_series_ring` constructor and build up the power series using basic arithmetic, as described in the Ring interface. The power series rings in AbstractAlgebra.jl implement the full Ring interface. @@ -168,7 +168,7 @@ We give some examples of such functionality. **Examples** ```jldoctest -julia> R, (x,) = PowerSeriesRing(ZZ, [5], ["x"]) +julia> R, (x,) = power_series_ring(ZZ, [5], ["x"]) (Multivariate power series ring in x over Integers, AbstractAlgebra.Generic.AbsMSeries{BigInt, AbstractAlgebra.Generic.MPoly{BigInt}}[x + O(x^5)]) julia> f = x^3 + 3x + 21 @@ -205,7 +205,7 @@ true julia> t = divexact(f*x, 1 + x) 21*x - 18*x^2 + 18*x^3 - 17*x^4 + O(x^5) -julia> R, (x, y) = PowerSeriesRing(ZZ, [2, 3], 10, ["x", "y"]) +julia> R, (x, y) = power_series_ring(ZZ, [2, 3], 10, ["x", "y"]) (Multivariate power series ring in x, y over Integers, AbstractAlgebra.Generic.AbsMSeries{BigInt, AbstractAlgebra.Generic.MPoly{BigInt}}[x + O(10), y + O(10)]) julia> f = 3x^2*y + 1 diff --git a/docs/src/ncpolynomial.md b/docs/src/ncpolynomial.md index bc33091df9..fb223ba7da 100644 --- a/docs/src/ncpolynomial.md +++ b/docs/src/ncpolynomial.md @@ -48,7 +48,7 @@ In order to construct polynomials in AbstractAlgebra.jl, one must first construc polynomial ring itself. This is accomplished with the following constructor. ```julia -PolynomialRing(R::NCRing, s::AbstractString; cached::Bool = true) +polynomial_ring(R::NCRing, s::AbstractString; cached::Bool = true) ``` Given a base ring `R` and string `s` specifying how the generator (variable) should be @@ -73,10 +73,10 @@ resulting parent objects to coerce various elements into the polynomial ring. julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> U, z = R["z"] @@ -101,14 +101,14 @@ z + 1 All of the examples here are generic polynomial rings, but specialised implementations of polynomial rings provided by external modules will also usually provide a -`PolynomialRing` constructor to allow creation of their polynomial rings. +`polynomial_ring` constructor to allow creation of their polynomial rings. ## Basic ring functionality Once a polynomial ring is constructed, there are various ways to construct polynomials in that ring. -The easiest way is simply using the generator returned by the `PolynomialRing` +The easiest way is simply using the generator returned by the `polynomial_ring` constructor and build up the polynomial using basic arithmetic, as described in the Ring interface. @@ -126,10 +126,10 @@ We give some examples of such functionality. julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> f = x^3 + 3x + 21 @@ -212,10 +212,10 @@ is_term(::NCPolyElem) julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> a = zero(T) @@ -269,10 +269,10 @@ mullow(::NCPolyElem{T}, ::NCPolyElem{T}, ::Int) where T <: NCRingElem julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -302,10 +302,10 @@ reverse(::NCPolyElem) julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -335,10 +335,10 @@ shift_right(::NCPolyElem, ::Int) julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -368,10 +368,10 @@ evaluated at $a$ by writing $f(a)$. julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) @@ -401,10 +401,10 @@ derivative(::NCPolyElem) julia> R = MatrixAlgebra(ZZ, 2) Matrix Algebra of degree 2 over Integers -julia> S, x = PolynomialRing(R, "x") +julia> S, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, x) -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Matrix Algebra of degree 2 over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 diff --git a/docs/src/numberfield.md b/docs/src/numberfield.md index fc761ce157..884fd6cf95 100644 --- a/docs/src/numberfield.md +++ b/docs/src/numberfield.md @@ -23,7 +23,7 @@ In order to construct number fields in AbstractAlgebra.jl, one must first constr field itself. This is accomplished with the following constructor. ```julia -NumberField(f::Generic.Poly{Rational{BigInt}}, s::AbstractString, t = "\$"; cached = true) +number_field(f::Generic.Poly{Rational{BigInt}}, s::AbstractString, t = "\$"; cached = true) ``` Given an irreducible defining polynomial $f$ in $\mathbb{Q}[x]$, return a tuple $(K, x)$ @@ -36,10 +36,10 @@ $\mathbb{Q}[x]$. **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) julia> f = a^2 + 2a + 7 @@ -49,6 +49,6 @@ x^2 + 2*x + 7 ## Basic field functionality -The number field module in AbstractAlgebra.jl implements the full Field and ResidueRing +The number field module in AbstractAlgebra.jl implements the full Field and residue_ring interfaces. diff --git a/docs/src/polynomial.md b/docs/src/polynomial.md index 49d3d3314c..1d1fa3e8c7 100644 --- a/docs/src/polynomial.md +++ b/docs/src/polynomial.md @@ -49,7 +49,7 @@ In order to construct polynomials in AbstractAlgebra.jl, one must first construc polynomial ring itself. This is accomplished with the following constructor. ```julia -PolynomialRing(R::Ring, s::AbstractString; cached::Bool = true) +polynomial_ring(R::Ring, s::AbstractString; cached::Bool = true) ``` Given a base ring `R` and string `s` specifying how the generator (variable) should be @@ -84,10 +84,10 @@ generators. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> T, z = QQ["z"] @@ -99,14 +99,14 @@ Univariate Polynomial Ring in x over Integers All of the examples here are generic polynomial rings, but specialised implementations of polynomial rings provided by external modules will also usually provide a -`PolynomialRing` constructor to allow creation of their polynomial rings. +`polynomial_ring` constructor to allow creation of their polynomial rings. ## Polynomial constructors Once a polynomial ring is constructed, there are various ways to construct polynomials in that ring. -The easiest way is simply using the generator returned by the `PolynomialRing` +The easiest way is simply using the generator returned by the `polynomial_ring` constructor and build up the polynomial using basic arithmetic. The Julia language has special syntax for the construction of polynomials in terms @@ -147,10 +147,10 @@ over the given ring and with the given variable. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = x^3 + 3x + 21 @@ -171,7 +171,7 @@ y julia> S(x) x -julia> S, x = PolynomialRing(QQ, "x") +julia> S, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> f = S(Rational{BigInt}[2, 3, 1]) @@ -218,7 +218,7 @@ otherwise. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> f = 1 + 2x + 3x^2 @@ -259,10 +259,10 @@ is not known, an exception is raised. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> U = base_ring(S) @@ -307,13 +307,13 @@ gcdinv(f::PolyElem, g::PolyElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = ResidueRing(R, x^3 + 3x + 1) +julia> S = residue_ring(R, x^3 + 3x + 1) Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 -julia> T, y = PolynomialRing(S, "y") +julia> T, y = polynomial_ring(S, "y") (Univariate Polynomial Ring in y over Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, y) julia> f = (3*x^2 + x + 2)*y + x^2 + 1 @@ -467,19 +467,19 @@ is_constant(::PolynomialElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) -julia> T, z = PolynomialRing(QQ, "z") +julia> T, z = polynomial_ring(QQ, "z") (Univariate Polynomial Ring in z over Rationals, z) -julia> U = ResidueRing(ZZ, 17) +julia> U = residue_ring(ZZ, 17) Residue ring of Integers modulo 17 -julia> V, w = PolynomialRing(U, "w") +julia> V, w = polynomial_ring(U, "w") (Univariate Polynomial Ring in w over Residue ring of Integers modulo 17, w) julia> var(R) @@ -537,7 +537,7 @@ true julia> is_monomial(x*y^2) false -julia> S, x = PolynomialRing(ZZ, "x") +julia> S, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> f = x^3 + 3x + 1 @@ -569,7 +569,7 @@ illustrated by example. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> f = x^2 + 2 @@ -602,10 +602,10 @@ mullow{T <: RingElem}(::PolyElem{T}, ::PolyElem{T}, ::Int) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -632,10 +632,10 @@ reverse(::PolyElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -662,10 +662,10 @@ shift_right(::PolyElem, ::Int) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -705,7 +705,7 @@ Base.sqrt(::PolyElem{T}; check::Bool) where T <: RingElement **Examples** ```julia -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") g = x^2+6*x+1 sqrt(g^2) ``` @@ -721,7 +721,7 @@ map_coefficients(::Any, ::PolyElem{<:RingElement}) **Examples** ```julia -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") g = x^3+6*x + 1 change_base_ring(GF(2), g) change_coefficient_ring(GF(2), g) @@ -748,10 +748,10 @@ pseudodivrem{T <: RingElem}(::PolyElem{T}, ::PolyElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = x*y^2 + (x + 1)*y + 3 @@ -781,8 +781,8 @@ primpart(::PolyElem) **Examples** ``` -R, x = PolynomialRing(ZZ, "x") -S, y = PolynomialRing(R, "y") +R, x = polynomial_ring(ZZ, "x") +S, y = polynomial_ring(R, "y") k = x*y^2 + (x + 1)*y + 3 @@ -811,10 +811,10 @@ evaluated at $a$ by writing $f(a)$. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) @@ -863,19 +863,19 @@ integral{T <: Union{ResElem, FieldElem}}(::PolyElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) -julia> T, z = PolynomialRing(QQ, "z") +julia> T, z = polynomial_ring(QQ, "z") (Univariate Polynomial Ring in z over Rationals, z) -julia> U = ResidueRing(T, z^3 + 3z + 1) +julia> U = residue_ring(T, z^3 + 3z + 1) Residue ring of Univariate Polynomial Ring in z over Rationals modulo z^3 + 3*z + 1 -julia> V, w = PolynomialRing(U, "w") +julia> V, w = polynomial_ring(U, "w") (Univariate Polynomial Ring in w over Residue ring of Univariate Polynomial Ring in z over Rationals modulo z^3 + 3*z + 1, w) julia> f = x*y^2 + (x + 1)*y + 3 @@ -913,10 +913,10 @@ discriminant(a::PolyElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = 3x*y^2 + (x + 1)*y + 3 @@ -951,10 +951,10 @@ newton_to_monomial!{T <: RingElem}(::Vector{T}, ::Vector{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = 3x*y^2 + (x + 1)*y + 3 @@ -990,10 +990,10 @@ interpolate{T <: RingElem}(::PolyRing, ::Vector{T}, ::Vector{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> xs = [R(1), R(2), R(3), R(4)] @@ -1028,7 +1028,7 @@ power_sums_to_polynomial(::Vector{T}) where T <: RingElem **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> f = x^4 - 2*x^3 + 10*x^2 + 7*x - 5 @@ -1062,10 +1062,10 @@ chebyshev_u(::Int, ::PolyElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S, y = PolynomialRing(R, "y") +julia> S, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integers, y) julia> f = chebyshev_t(20, y) @@ -1090,13 +1090,13 @@ rand(R::PolyRing, deg::Int, v...) **Examples** ```julia -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") f = rand(R, -1:3, -10:10) -S, y = PolynomialRing(GF(7), "y") +S, y = polynomial_ring(GF(7), "y") g = rand(S, 2:2) -U, z = PolynomialRing(R, "z") +U, z = polynomial_ring(R, "z") h = rand(U, 3:3, -1:2, -10:10) ``` diff --git a/docs/src/puiseux.md b/docs/src/puiseux.md index 7662f931b1..fa8a606fdc 100644 --- a/docs/src/puiseux.md +++ b/docs/src/puiseux.md @@ -338,7 +338,7 @@ Base.sqrt(a::Generic.PuiseuxSeriesElem) **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) julia> S, x = PuiseuxSeriesRing(R, 30, "x") diff --git a/docs/src/rand.md b/docs/src/rand.md index 3547a9e15e..5a83f83e27 100644 --- a/docs/src/rand.md +++ b/docs/src/rand.md @@ -28,7 +28,7 @@ julia> using Random julia> using RandomExtensions -julia> S, x = PolynomialRing(ZZ, "x") +julia> S, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> rand(Random.GLOBAL_RNG, make(S, 1:3, -10:10)) @@ -44,7 +44,7 @@ require creating a make instance or passing in the standard RNG. ```julia julia> using AbstractAlgebra -julia> S, x = PolynomialRing(ZZ, "x") +julia> S, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> rand(S, 1:3, -10:10) @@ -131,7 +131,7 @@ For example, in AbstractAlgebra test code: ```julia using Test -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") test_rand(R, -1:10, -10:10) ``` diff --git a/docs/src/rational.md b/docs/src/rational.md index c3645b641f..37e18ba174 100644 --- a/docs/src/rational.md +++ b/docs/src/rational.md @@ -52,7 +52,7 @@ In order to construct rationals in AbstractAlgebra.jl, one can first construct t rational field itself. This is accomplished using either of the following constructors. ```julia -FractionField(R::Integers{BigInt}) +fraction_field(R::Integers{BigInt}) ``` ```julia @@ -83,7 +83,7 @@ julia> h = QQ(BigInt(1234)) julia> k = QQ(BigInt(12), BigInt(7)) 12//7 -julia> QQ == FractionField(ZZ) +julia> QQ == fraction_field(ZZ) true ``` diff --git a/docs/src/residue.md b/docs/src/residue.md index 2ff5d461e7..b176d35748 100644 --- a/docs/src/residue.md +++ b/docs/src/residue.md @@ -8,7 +8,7 @@ end # Generic residue rings AbstractAlgebra.jl provides modules, implemented in `src/Residue.jl` and -`src/ResidueField` for residue rings and fields, respectively, over any +`src/residue_field` for residue rings and fields, respectively, over any Euclidean domain (in practice most of the functionality is provided for GCD domains that provide a meaningful GCD function) belonging to the AbstractAlgebra.jl abstract type hierarchy. @@ -50,10 +50,10 @@ In order to construct residues in AbstractAlgebra.jl, one must first construct t residue ring itself. This is accomplished with one of the following constructors. ```julia -ResidueRing(R::Ring, m::RingElem; cached::Bool = true) +residue_ring(R::Ring, m::RingElem; cached::Bool = true) ``` ```julia -ResidueField(R::Ring, m::RingElem; cached::Bool = true) +residue_field(R::Ring, m::RingElem; cached::Bool = true) ``` Given a base ring `R` and residue $m$ contained in this ring, return the parent object @@ -61,7 +61,7 @@ of the residue ring $R/(m)$. By default the parent object `S` will depend only o and `m` and will be cached. Setting the optional argument `cached` to `false` will prevent the parent object `S` from being cached. -The `ResidueField` constructor does the same thing as the `ResidueRing` constructor, +The `residue_field` constructor does the same thing as the `residue_ring` constructor, but the resulting object has type belonging to `Field` rather than `Ring`, so it can be used anywhere a field is expected in AbstractAlgebra.jl. No check is made for maximality of the ideal generated by $m$. @@ -79,10 +79,10 @@ resulting parent objects to coerce various elements into the residue ring. **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = ResidueRing(R, x^3 + 3x + 1) +julia> S = residue_ring(R, x^3 + 3x + 1) Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> f = S() @@ -114,7 +114,7 @@ true All of the examples here are generic residue rings, but specialised implementations of residue rings provided by external modules will also usually provide a -`ResidueRing` constructor to allow creation of their residue rings. +`residue_ring` constructor to allow creation of their residue rings. ## Residue constructors @@ -190,10 +190,10 @@ modulus(::ResElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = ResidueRing(R, x^3 + 3x + 1) +julia> S = residue_ring(R, x^3 + 3x + 1) Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> f = S(x + 1) @@ -232,7 +232,7 @@ Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x julia> f == deepcopy(f) true -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) ``` @@ -245,10 +245,10 @@ Base.inv(::ResElem) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = ResidueRing(R, x^3 + 3x + 1) +julia> S = residue_ring(R, x^3 + 3x + 1) Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> f = S(x + 1) @@ -268,10 +268,10 @@ gcd{T <: RingElem}(::ResElem{T}, ::ResElem{T}) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> S = ResidueRing(R, x^3 + 3x + 1) +julia> S = residue_ring(R, x^3 + 3x + 1) Residue ring of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> f = S(x + 1) @@ -298,7 +298,7 @@ Base.sqrt{T <: Integer}(::ResFieldElem{T}) **Examples** ```julia -julia> R = ResidueField(ZZ, 733) +julia> R = residue_field(ZZ, 733) Residue field of Integers modulo 733 julia> a = R(86) @@ -324,10 +324,10 @@ rand(R::ResRing, v...) ```@repl using AbstractAlgebra # hide -R = ResidueRing(ZZ, 7) +R = residue_ring(ZZ, 7) f = rand(R, 0:6) -S, x = PolynomialRing(QQ, "x") -U = ResidueField(S, x^3 + 3x + 1) +S, x = polynomial_ring(QQ, "x") +U = residue_field(S, x^3 + 3x + 1) g = rand(S, 2:2, -10:10) ``` diff --git a/docs/src/ring_interface.md b/docs/src/ring_interface.md index 2462314ffc..56fb995afb 100644 --- a/docs/src/ring_interface.md +++ b/docs/src/ring_interface.md @@ -1042,7 +1042,7 @@ The above implementation of `ConstantPolynomialRing` may be tested as follows. using Test include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) -S, _ = PolynomialRing(QQ, "x") +S, _ = polynomial_ring(QQ, "x") function test_elem(R::ConstPolyRing{elem_type(S)}) return R(rand(base_ring(R), 1:6, -999:999)) diff --git a/docs/src/series.md b/docs/src/series.md index 4b6690de41..7744b5d368 100644 --- a/docs/src/series.md +++ b/docs/src/series.md @@ -40,7 +40,7 @@ These generic series have types `Generic.RelSeries{T}`, `Generic.AbsSeries{T}`, the file `src/generic/GenericTypes.jl` for details. The parent objects have types `Generic.AbsSeriesRing{T}` -and `Generic.RelSeriesRing{T}` and `Generic.LaurentSeriesRing{T}` respectively. +and `Generic.RelSeriesRing{T}` and `Generic.laurent_series_ring{T}` respectively. The default precision, string representation of the variable and base ring $R$ of a generic power series are stored in its parent object. @@ -68,15 +68,15 @@ In order to construct series in AbstractAlgebra.jl, one must first construct the itself. This is accomplished with any of the following constructors. ```julia -PowerSeriesRing(R::Ring, prec_max::Int, s::AbstractString; cached::Bool = true, model=:capped_relative) +power_series_ring(R::Ring, prec_max::Int, s::AbstractString; cached::Bool = true, model=:capped_relative) ``` ```julia -LaurentSeriesRing(R::Ring, prec_max::Int, s::AbstractString; cached::Bool = true) +laurent_series_ring(R::Ring, prec_max::Int, s::AbstractString; cached::Bool = true) ``` ```julia -LaurentSeriesRing(R::Field, prec_max::Int, s::AbstractString; cached::Bool = true) +laurent_series_ring(R::Field, prec_max::Int, s::AbstractString; cached::Bool = true) ``` Given a base ring `R`, a maximum precision (relative or absolute, depending on the @@ -110,16 +110,16 @@ various elements into those rings. **Examples** ```jldoctest -julia> R, x = PowerSeriesRing(ZZ, 10, "x") +julia> R, x = power_series_ring(ZZ, 10, "x") (Univariate power series ring in x over Integers, x + O(x^11)) -julia> S, y = PowerSeriesRing(ZZ, 10, "y"; model=:capped_absolute) +julia> S, y = power_series_ring(ZZ, 10, "y"; model=:capped_absolute) (Univariate power series ring in y over Integers, y + O(y^10)) -julia> T, z = LaurentSeriesRing(ZZ, 10, "z") +julia> T, z = laurent_series_ring(ZZ, 10, "z") (Laurent series ring in z over Integers, z + O(z^11)) -julia> U, w = LaurentSeriesField(QQ, 10, "w") +julia> U, w = laurent_series_field(QQ, 10, "w") (Laurent series field in w over Rationals, w + O(w^11)) julia> f = R() @@ -183,7 +183,7 @@ laurent_series(R::Ring, arr::Vector{T}, len::Int, prec::Int, val::Int, scale::In **Examples** ```jldoctest -julia> S, x = PowerSeriesRing(QQ, 10, "x"; model=:capped_absolute) +julia> S, x = power_series_ring(QQ, 10, "x"; model=:capped_absolute) (Univariate power series ring in x over Rationals, x + O(x^10)) julia> f = S(Rational{BigInt}[0, 2, 3, 1], 4, 6) @@ -223,10 +223,10 @@ O(x::SeriesElem) **Examples** ```jldoctest -julia> R, x = PowerSeriesRing(ZZ, 10, "x") +julia> R, x = power_series_ring(ZZ, 10, "x") (Univariate power series ring in x over Integers, x + O(x^11)) -julia> S, y = LaurentSeriesRing(ZZ, 10, "y") +julia> S, y = laurent_series_ring(ZZ, 10, "y") (Laurent series ring in y over Integers, y + O(y^11)) julia> f = 1 + 2x + O(x^5) @@ -424,7 +424,7 @@ is_gen(::RelSeriesElem) **Examples** ```jldoctest -julia> S, x = PowerSeriesRing(ZZ, 10, "x") +julia> S, x = power_series_ring(ZZ, 10, "x") (Univariate power series ring in x over Integers, x + O(x^11)) julia> f = 1 + 3x + x^3 + O(x^10) @@ -472,10 +472,10 @@ julia> t = divexact(2g, 2) julia> p = precision(f) 10 -julia> R, t = PowerSeriesRing(QQ, 10, "t") +julia> R, t = power_series_ring(QQ, 10, "t") (Univariate power series ring in t over Rationals, t + O(t^11)) -julia> S, x = PowerSeriesRing(R, 30, "x") +julia> S, x = power_series_ring(R, 30, "x") (Univariate power series ring in x over Univariate power series ring in t over Rationals, x + O(x^31)) julia> a = O(x^4) @@ -499,7 +499,7 @@ julia> p = valuation(b) julia> c = coeff(b, 2) 1 + t^2 + O(t^10) -julia> S, x = PowerSeriesRing(ZZ, 10, "x") +julia> S, x = power_series_ring(ZZ, 10, "x") (Univariate power series ring in x over Integers, x + O(x^11)) julia> f = 1 + 3x + x^3 + O(x^5) @@ -529,7 +529,7 @@ change_base_ring(::Ring, ::AbsSeriesElem{<:RingElem}) **Examples** ```jldoctest -julia> R, x = PowerSeriesRing(ZZ, 10, "x") +julia> R, x = power_series_ring(ZZ, 10, "x") (Univariate power series ring in x over Integers, x + O(x^11)) julia> f = 4*x^6 + x^7 + 9*x^8 + 16*x^9 + 25*x^10 + O(x^11) @@ -555,10 +555,10 @@ shift_right{T <: RingElem}(::RelSeriesElem{T}, ::Int) **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S, x = PowerSeriesRing(R, 30, "x") +julia> S, x = power_series_ring(R, 30, "x") (Univariate power series ring in x over Univariate Polynomial Ring in t over Rationals, x + O(x^31)) julia> a = 2x + x^3 @@ -596,10 +596,10 @@ truncate{T <: RingElem}(::RelSeriesElem{T}, ::Int) **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S, x = PowerSeriesRing(R, 30, "x") +julia> S, x = power_series_ring(R, 30, "x") (Univariate power series ring in x over Univariate Polynomial Ring in t over Rationals, x + O(x^31)) julia> a = 2x + x^3 @@ -637,10 +637,10 @@ Base.inv(::RelSeriesElem) **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S, x = PowerSeriesRing(R, 30, "x") +julia> S, x = power_series_ring(R, 30, "x") (Univariate power series ring in x over Univariate Polynomial Ring in t over Rationals, x + O(x^31)) julia> a = 1 + x + 2x^2 + O(x^5) @@ -694,13 +694,13 @@ Base.sqrt(a::RelSeriesElem) **Examples** ```jldoctest -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S, x = PowerSeriesRing(R, 30, "x") +julia> S, x = power_series_ring(R, 30, "x") (Univariate power series ring in x over Univariate Polynomial Ring in t over Rationals, x + O(x^31)) -julia> T, z = PowerSeriesRing(QQ, 30, "z") +julia> T, z = power_series_ring(QQ, 30, "z") (Univariate power series ring in z over Rationals, z + O(z^31)) julia> a = 1 + z + 3z^2 + O(z^5) @@ -740,6 +740,6 @@ rand(R::SeriesRing, val_range::UnitRange{Int}, v...) ```@repl using AbstractAlgebra # hide -R, x = PowerSeriesRing(ZZ, 10, "x") +R, x = power_series_ring(ZZ, 10, "x") f = rand(R, 3:5, -10:10) ``` diff --git a/docs/src/total_fraction.md b/docs/src/total_fraction.md index 4570cce066..a9b6515c50 100644 --- a/docs/src/total_fraction.md +++ b/docs/src/total_fraction.md @@ -75,7 +75,7 @@ the resulting parent objects to coerce various elements into the ring. **Examples** ```jldoctest -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> S = TotalRingOfFractions(R) @@ -115,7 +115,7 @@ total ring of fractions in question. **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> S = TotalRingOfFractions(R) @@ -164,7 +164,7 @@ the characteristic is not known an exception is raised. **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> S = TotalRingOfFractions(R) @@ -218,7 +218,7 @@ denominator(a::TotFrac) **Examples** ```jldoctest -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> S = TotalRingOfFractions(R) @@ -266,11 +266,11 @@ rand(R::TotFracRing, v...) ```@repl using AbstractAlgebra # hide -R = ResidueRing(ZZ, 12) +R = residue_ring(ZZ, 12) K = TotalRingOfFractions(R) f = rand(K, 0:11) -R, x = PolynomialRing(ZZ, "x") +R, x = polynomial_ring(ZZ, "x") S = TotalRingOfFractions(R) g = rand(S, -1:3, -10:10) ``` diff --git a/docs/src/types.md b/docs/src/types.md index f80a7890fb..261cd67c1f 100644 --- a/docs/src/types.md +++ b/docs/src/types.md @@ -34,7 +34,7 @@ corresponding to the ring $\mathbb{Z}/7\mathbb{Z}$. We then create a new element of this ring by calling the parent object `R`. ```julia -R = ResidueRing(ZZ, 7) +R = residue_ring(ZZ, 7) a = R(3) ``` diff --git a/docs/src/visualizing_types.md b/docs/src/visualizing_types.md index f1da64daaf..752090366d 100644 --- a/docs/src/visualizing_types.md +++ b/docs/src/visualizing_types.md @@ -40,8 +40,8 @@ are defined over. - `Generic.MPoly{T}` (`Generic.MPolyRing{T}`) - `Generic.RelSeries{T}` (`Generic.RelSeriesRing{T}`) - `Generic.AbsSeries{T}` (`Generic.AbsSeriesRing{T}`) - - `Generic.LaurentSeriesRingElem{T}` (`Generic.LaurentSeriesRing{T}`) - - `Generic.LaurentSeriesFieldElem{T}` (`Generic.LaurentSeriesField{T}`) + - `Generic.LaurentSeriesRingElem{T}` (`Generic.laurent_series_ring{T}`) + - `Generic.LaurentSeriesFieldElem{T}` (`Generic.laurent_series_field{T}`) - `Generic.Res{T}` (`Generic.ResRing{T}`) - `Generic.Frac{T}` (`Generic.FracField{T}`) - `Generic.Mat{T}` (`Generic.MatSpace{T}`) diff --git a/src/AbsMSeries.jl b/src/AbsMSeries.jl index 93b48c4760..11ca6ead74 100644 --- a/src/AbsMSeries.jl +++ b/src/AbsMSeries.jl @@ -192,45 +192,45 @@ end ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### -function PowerSeriesRing(R::Ring, prec::Vector{Int}, +function power_series_ring(R::Ring, prec::Vector{Int}, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Symbol - return Generic.PowerSeriesRing(R, prec, s; cached=cached, model=model) + return Generic.power_series_ring(R, prec, s; cached=cached, model=model) end -function PowerSeriesRing(R::Ring, prec::Vector{Int}, +function power_series_ring(R::Ring, prec::Vector{Int}, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Union{Char, AbstractString} sym = [Symbol(v) for v in s] - return Generic.PowerSeriesRing(R, prec, sym; cached=cached, model=model) + return Generic.power_series_ring(R, prec, sym; cached=cached, model=model) end -function PowerSeriesRing(R::Ring, weights::Vector{Int}, prec::Int, +function power_series_ring(R::Ring, weights::Vector{Int}, prec::Int, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Symbol - return Generic.PowerSeriesRing(R, weights, prec, s; cached=cached, model=model) + return Generic.power_series_ring(R, weights, prec, s; cached=cached, model=model) end -function PowerSeriesRing(R::Ring, weights::Vector{Int}, prec::Int, +function power_series_ring(R::Ring, weights::Vector{Int}, prec::Int, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Union{Char, AbstractString} sym = [Symbol(v) for v in s] - return Generic.PowerSeriesRing(R, weights, prec, sym; cached=cached, model=model) + return Generic.power_series_ring(R, weights, prec, sym; cached=cached, model=model) end -function PowerSeriesRing(R::Ring, prec::Int, +function power_series_ring(R::Ring, prec::Int, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Symbol - return Generic.PowerSeriesRing(R, prec, s; cached=cached, model=model) + return Generic.power_series_ring(R, prec, s; cached=cached, model=model) end -function PowerSeriesRing(R::Ring, prec::Int, +function power_series_ring(R::Ring, prec::Int, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Union{Char, AbstractString} sym = [Symbol(v) for v in s] - return Generic.PowerSeriesRing(R, prec, sym; cached=cached, model=model) + return Generic.power_series_ring(R, prec, sym; cached=cached, model=model) end diff --git a/src/AbsSeries.jl b/src/AbsSeries.jl index 230c94fdf7..3c74bd48fe 100644 --- a/src/AbsSeries.jl +++ b/src/AbsSeries.jl @@ -1061,7 +1061,7 @@ function _make_parent(g, p::AbsSeriesElem, cached::Bool) S = parent(p) sym = String(var(S)) max_prec = max_precision(S) - return PowerSeriesRing(R, max_prec, sym; model=:capped_absolute, cached=cached)[1] + return power_series_ring(R, max_prec, sym; model=:capped_absolute, cached=cached)[1] end @doc Markdown.doc""" @@ -1095,7 +1095,7 @@ end ################################################################################ function _change_abs_series_ring(R, Rx, cached) - P, _ = PowerSeriesRing(R, max_precision(Rx), + P, _ = power_series_ring(R, max_precision(Rx), string(var(Rx)), cached = cached, model=:capped_absolute) return P end @@ -1118,7 +1118,7 @@ end ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### diff --git a/src/AbstractAlgebra.jl b/src/AbstractAlgebra.jl index 8828095363..c72ab1ea60 100644 --- a/src/AbstractAlgebra.jl +++ b/src/AbstractAlgebra.jl @@ -19,7 +19,7 @@ import GroupsCore: gens, ngens, order, mul!, istrivial # A list of all symbols external packages should not import from AbstractAlgebra import_exclude = [:import_exclude, :QQ, :ZZ, - :RealField, :NumberField, + :RealField, :number_field, :AbstractAlgebra, :inv, :log, :exp, :sqrt, :div, :divrem, :numerator, :denominator, @@ -580,16 +580,16 @@ function YoungTableau(part::Generic.Partition, fill::Vector{Int}=collect(1:part. Generic.YoungTableau(part, fill) end -function NumberField(a::Generic.Poly{Rational{BigInt}}, s::AbstractString, t = "\$"; cached = true) - return Generic.NumberField(a, Symbol(s), t; cached=cached) +function number_field(a::Generic.Poly{Rational{BigInt}}, s::AbstractString, t = "\$"; cached = true) + return Generic.number_field(a, Symbol(s), t; cached=cached) end -function NumberField(a::Generic.Poly{Rational{BigInt}}, s::Char, t = "\$"; cached = true) - return Generic.NumberField(a, Symbol(s), t; cached=cached) +function number_field(a::Generic.Poly{Rational{BigInt}}, s::Char, t = "\$"; cached = true) + return Generic.number_field(a, Symbol(s), t; cached=cached) end -function NumberField(a::Generic.Poly{Rational{BigInt}}, s::Symbol, t = "\$"; cached = true) - return Generic.NumberField(a, s, t; cached=cached) +function number_field(a::Generic.Poly{Rational{BigInt}}, s::Symbol, t = "\$"; cached = true) + return Generic.number_field(a, s, t; cached=cached) end function FunctionField(p::Generic.Poly{Generic.Rat{T, U}}, s::Symbol; cached::Bool=true) where {T <: FieldElement, U <: Union{PolyElem, MPolyElem}} @@ -627,12 +627,12 @@ export Generic # ############################################################################### -getindex(R::NCRing, s::Union{String, Char, Symbol}) = PolynomialRing(R, s) +getindex(R::NCRing, s::Union{String, Char, Symbol}) = polynomial_ring(R, s) getindex(R::NCRing, s::Union{String, Char, Symbol}, ss::Union{String, Char}...) = - PolynomialRing(R, [s, ss...]) + polynomial_ring(R, [s, ss...]) # syntax x = R["x"]["y"] -getindex(R::Tuple{Union{Ring, NCRing}, Union{PolyElem, NCPolyElem}}, s::Union{String, Char, Symbol}) = PolynomialRing(R[1], s) +getindex(R::Tuple{Union{Ring, NCRing}, Union{PolyElem, NCPolyElem}}, s::Union{String, Char, Symbol}) = polynomial_ring(R[1], s) ############################################################################### # diff --git a/src/Aliases.jl b/src/Aliases.jl index 3825a92af6..2c451a5b80 100644 --- a/src/Aliases.jl +++ b/src/Aliases.jl @@ -37,3 +37,24 @@ @alias iszero_column is_zero_column @alias iszero_row is_zero_row @alias Localization localization + +# +# Some deprecation aliases follow. These use @alias instead of @deprecate +# because there are still packages adding methods for these, which would break +# if we used @deprecate. Once those packages are updated, we can switch to +# using @deprecate +# + +# Deprecated in 0.27.* + +@alias MatrixSpace matrix_space +#@deprecate MatrixSpace(R::Ring, rows::Int, cols::Int; cache::Bool=true) matrix_space(R, rows, cols; cache) + +@alias PolynomialRing polynomial_ring +@alias PowerSeriesRing power_series_ring +@alias LaurentSeriesRing laurent_series_ring +@alias LaurentSeriesField laurent_series_field +@alias FractionField fraction_field +@alias ResidueRing residue_ring +@alias ResidueField residue_field +@alias NumberField number_field diff --git a/src/Fraction.jl b/src/Fraction.jl index 5bf1d69073..b57ea0bbda 100644 --- a/src/Fraction.jl +++ b/src/Fraction.jl @@ -4,7 +4,7 @@ # ############################################################################### -export FractionField, FactoredFractionField +export fraction_field, FactoredFractionField ############################################################################### # @@ -55,7 +55,7 @@ function //(x::T, y::T) where {T <: RingElem} try z.parent = Generic.FracDict[R] catch - z.parent = Generic.FractionField(R) + z.parent = Generic.fraction_field(R) end return z end @@ -940,20 +940,20 @@ rand(S::FracField, v...) = rand(GLOBAL_RNG, S, v...) ############################################################################### # -# FractionField constructor +# fraction_field constructor # ############################################################################### @doc Markdown.doc""" - FractionField(R::Ring; cached=true) + fraction_field(R::Ring; cached=true) Return the parent object of the fraction field over the given base ring $R$. If `cached == true` (the default), the returned parent object is cached so that it will always be returned by a call to the constructor when the same base ring $R$ is supplied. """ -function FractionField(R::Ring; cached=true) - return Generic.FractionField(R; cached=cached) +function fraction_field(R::Ring; cached=true) + return Generic.fraction_field(R; cached=cached) end @doc Markdown.doc""" diff --git a/src/LaurentSeries.jl b/src/LaurentSeries.jl index 31731d69fe..11b87fff19 100644 --- a/src/LaurentSeries.jl +++ b/src/LaurentSeries.jl @@ -5,18 +5,18 @@ # ############################################################################### -export LaurentSeriesField, LaurentSeriesRing, deflate, downscale, exp_gcd, +export laurent_series_field, laurent_series_ring, deflate, downscale, exp_gcd, inflate, upscale ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### @doc Markdown.doc""" - LaurentSeriesRing(R::Ring, prec::Int, s::Union{Char, AbstractString, Symbol}; cached=true) - LaurentSeriesField(R::Field, prec::Int, s::Union{Char, AbstractString; cached=true) + laurent_series_ring(R::Ring, prec::Int, s::Union{Char, AbstractString, Symbol}; cached=true) + laurent_series_field(R::Field, prec::Int, s::Union{Char, AbstractString; cached=true) Return a tuple $(S, x)$ consisting of the parent object `S` of a Laurent series ring over the given base ring and a generator `x` for the Laurent series ring. @@ -27,27 +27,27 @@ object `S` will be cached so that supplying the same base ring, string and precision in future will return the same parent object and generator. If caching of the parent object is not required, `cached` can be set to `false`. """ -function LaurentSeriesRing(R::Ring, prec::Int, s::AbstractString; cached=true) - return LaurentSeriesRing(R, prec, Symbol(s); cached=cached) +function laurent_series_ring(R::Ring, prec::Int, s::AbstractString; cached=true) + return laurent_series_ring(R, prec, Symbol(s); cached=cached) end -function LaurentSeriesRing(R::Ring, prec::Int, s::Symbol; cached=true) - return Generic.LaurentSeriesRing(R, prec, s; cached=cached) +function laurent_series_ring(R::Ring, prec::Int, s::Symbol; cached=true) + return Generic.laurent_series_ring(R, prec, s; cached=cached) end -function LaurentSeriesRing(R::Ring, prec::Int, s::Char; cached=true) - return LaurentSeriesRing(R, prec, Symbol(s); cached=cached) +function laurent_series_ring(R::Ring, prec::Int, s::Char; cached=true) + return laurent_series_ring(R, prec, Symbol(s); cached=cached) end -function LaurentSeriesField(R::Field, prec::Int, s::AbstractString; cached=true) - return LaurentSeriesField(R, prec, Symbol(s); cached=cached) +function laurent_series_field(R::Field, prec::Int, s::AbstractString; cached=true) + return laurent_series_field(R, prec, Symbol(s); cached=cached) end -function LaurentSeriesField(R::Field, prec::Int, s::Symbol; cached=true) - return Generic.LaurentSeriesField(R, prec, s; cached=cached) +function laurent_series_field(R::Field, prec::Int, s::Symbol; cached=true) + return Generic.laurent_series_field(R, prec, s; cached=cached) end -function LaurentSeriesField(R::Field, prec::Int, s::Char; cached=true) - return LaurentSeriesField(R, prec, Symbol(s); cached=cached) +function laurent_series_field(R::Field, prec::Int, s::Char; cached=true) + return laurent_series_field(R, prec, Symbol(s); cached=cached) end diff --git a/src/MPoly.jl b/src/MPoly.jl index 2d6478ab5f..7c7cca35b0 100644 --- a/src/MPoly.jl +++ b/src/MPoly.jl @@ -4,7 +4,7 @@ # ############################################################################### -export MPolyBuildCtx, @PolynomialRing, change_base_ring, +export MPolyBuildCtx, @polynomial_ring, change_base_ring, coefficients_of_univariate, combine_like_terms!, deflation, degrees, derivative, divides, exponent, exponent_vector, exponent_vectors, gens, is_constant, is_degree, is_homogeneous, is_monomial, @@ -1148,7 +1148,7 @@ end ################################################################################ function _change_mpoly_ring(R, Rx, cached) - P, _ = AbstractAlgebra.PolynomialRing(R, map(string, symbols(Rx)), ordering = ordering(Rx), cached = cached) + P, _ = AbstractAlgebra.polynomial_ring(R, map(string, symbols(Rx)), ordering = ordering(Rx), cached = cached) return P end @@ -1278,12 +1278,12 @@ end ############################################################################### # -# PolynomialRing constructor +# polynomial_ring constructor # ############################################################################### @doc Markdown.doc""" - PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{T}; cached::Bool = true, ordering::Symbol = :lex) where T <: Union{String, Char, Symbol} + polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{T}; cached::Bool = true, ordering::Symbol = :lex) where T <: Union{String, Char, Symbol} Given a base ring `R` and an array of strings `s` specifying how the generators (variables) should be printed, return a tuple `T, (x1, x2, ...)` @@ -1294,25 +1294,25 @@ argument `cached` to `false` will prevent the parent object `T` from being cached. `S` is a symbol corresponding to the ordering of the polynomial and can be one of `:lex`, `:deglex` or `:degrevlex`. """ -function PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{String}; +function polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{String}; cached::Bool = true, ordering::Symbol = :lex) - return PolynomialRing(R, [Symbol(v) for v in s]; + return polynomial_ring(R, [Symbol(v) for v in s]; cached=cached, ordering=ordering) end -function PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{Char}; +function polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{Char}; cached::Bool = true, ordering::Symbol = :lex) - return PolynomialRing(R, [Symbol(v) for v in s]; + return polynomial_ring(R, [Symbol(v) for v in s]; cached=cached, ordering=ordering) end -function PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{Symbol}; +function polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool = true, ordering::Symbol = :lex) - return Generic.PolynomialRing(R, s; cached=cached, ordering=ordering) + return Generic.polynomial_ring(R, s; cached=cached, ordering=ordering) end @doc Markdown.doc""" - PolynomialRing(R::Ring, n::Int, s::String; cached::Bool = false, ordering::Symbol = :lex) + polynomial_ring(R::Ring, n::Int, s::String; cached::Bool = false, ordering::Symbol = :lex) Given a string `s` and a number of variables `n` will do the same as the first constructor except that the variables will be @@ -1326,19 +1326,19 @@ the parent object `S` from being cached. The optional named argument `ordering` can be used to specify an ordering. The currently supported options are `:lex`, `:deglex` and `:degrevlex`. """ -function PolynomialRing(R::AbstractAlgebra.Ring, n::Int, s::String; +function polynomial_ring(R::AbstractAlgebra.Ring, n::Int, s::String; cached::Bool = false, ordering::Symbol = :lex) - return PolynomialRing(R, n, Symbol(s); cached=cached, ordering=ordering) + return polynomial_ring(R, n, Symbol(s); cached=cached, ordering=ordering) end -function PolynomialRing(R::AbstractAlgebra.Ring, n::Int, s::Char; +function polynomial_ring(R::AbstractAlgebra.Ring, n::Int, s::Char; cached::Bool = false, ordering::Symbol = :lex) - return PolynomialRing(R, n, Symbol(s); cached=cached, ordering=ordering) + return polynomial_ring(R, n, Symbol(s); cached=cached, ordering=ordering) end -function PolynomialRing(R::AbstractAlgebra.Ring, n::Int, s::Symbol=:x; +function polynomial_ring(R::AbstractAlgebra.Ring, n::Int, s::Symbol=:x; cached::Bool = false, ordering::Symbol = :lex) - return PolynomialRing(R, [Symbol(s, i) for i=1:n], cached = cached, + return polynomial_ring(R, [Symbol(s, i) for i=1:n], cached = cached, ordering = ordering) end @@ -1384,7 +1384,7 @@ function build_variables_strings(args) return names, exprs end -macro PolynomialRing(R, args...) +macro polynomial_ring(R, args...) names, exprs = build_variables_strings(args) all_names = gensym() push!(exprs, :($(esc(all_names)) = String[])) @@ -1394,7 +1394,7 @@ macro PolynomialRing(R, args...) ring1 = gensym() ring2 = gensym() push!(exprs, :($(Expr(:tuple, esc(ring1), esc(ring2))) = - AbstractAlgebra.PolynomialRing($(esc(R)), $(esc(all_names))))) + AbstractAlgebra.polynomial_ring($(esc(R)), $(esc(all_names))))) vars = Symbol[] k = gensym() push!(exprs, :($(esc(k)) = 0)) diff --git a/src/Matrix.jl b/src/Matrix.jl index e404d5ee9d..8df864aa23 100644 --- a/src/Matrix.jl +++ b/src/Matrix.jl @@ -4,7 +4,7 @@ # ############################################################################### -export MatrixSpace, add_column, add_column!, add_row, add_row!, +export matrix_space, add_column, add_column!, add_row, add_row!, block_diagonal_matrix, can_solve, can_solve_left_reduced_triu, can_solve_with_kernel, can_solve_with_solution, can_solve_with_solution_interpolation, @@ -1292,10 +1292,10 @@ Return the transpose of the given matrix. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1351,10 +1351,10 @@ $i$-th and $j$-th rows, respectively. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1397,10 +1397,10 @@ require the matrix to be square. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1437,10 +1437,10 @@ its entries, assuming it exists. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1480,10 +1480,10 @@ Apply the pemutation $P$ to the rows of the matrix $x$ and return the result. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, t = PolynomialRing(QQ, "t") +julia> R, t = polynomial_ring(QQ, "t") (Univariate Polynomial Ring in t over Rationals, t) -julia> S = MatrixSpace(R, 3, 3) +julia> S = matrix_space(R, 3, 3) Matrix Space of 3 rows and 3 columns over Univariate Polynomial Ring in t over Rationals julia> G = SymmetricGroup(3) @@ -2181,13 +2181,13 @@ Return the determinant of the matrix $M$. We assume $M$ is square. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) -julia> S = MatrixSpace(K, 3, 3) +julia> S = matrix_space(K, 3, 3) Matrix Space of 3 rows and 3 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> A = S([K(0) 2a + 3 a^2 + 1; a^2 - 2 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -2556,13 +2556,13 @@ Return the rank of the matrix $M$. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, x = PolynomialRing(QQ, "x") +julia> R, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) -julia> K, a = NumberField(x^3 + 3x + 1, "a") +julia> K, a = number_field(x^3 + 3x + 1, "a") (Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1, x) -julia> S = MatrixSpace(K, 3, 3) +julia> S = matrix_space(K, 3, 3) Matrix Space of 3 rows and 3 columns over Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3 + 3*x + 1 julia> A = S([K(0) 2a + 3 a^2 + 1; a^2 - 2 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -3700,10 +3700,10 @@ function to compute an integral kernel. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S = MatrixSpace(R, 4, 4) +julia> S = matrix_space(R, 4, 4) Matrix Space of 4 rows and 4 columns over Univariate Polynomial Ring in x over Integers julia> M = S([-6*x^2+6*x+12 -12*x^2-21*x-15 -15*x^2+21*x+33 -21*x^2-9*x-9; @@ -4217,13 +4217,13 @@ and the matrix is assumed to be square. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R = ResidueRing(ZZ, 7) +julia> R = residue_ring(ZZ, 7) Residue ring of Integers modulo 7 -julia> S = MatrixSpace(R, 4, 4) +julia> S = matrix_space(R, 4, 4) Matrix Space of 4 rows and 4 columns over Residue ring of Integers modulo 7 -julia> T, x = PolynomialRing(R, "x") +julia> T, x = polynomial_ring(R, "x") (Univariate Polynomial Ring in x over Residue ring of Integers modulo 7, x) julia> M = S([R(1) R(2) R(4) R(3); R(2) R(5) R(1) R(0); @@ -4415,7 +4415,7 @@ of the resulting polynomial must be supplied and the matrix must be square. julia> R = GF(13) Finite field F_13 -julia> T, y = PolynomialRing(R, "y") +julia> T, y = polynomial_ring(R, "y") (Univariate Polynomial Ring in y over Finite field F_13, y) julia> M = R[7 6 1; @@ -6001,10 +6001,10 @@ preserves the minimal and characteristic polynomials of a matrix. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> R = ResidueRing(ZZ, 7) +julia> R = residue_ring(ZZ, 7) Residue ring of Integers modulo 7 -julia> S = MatrixSpace(R, 4, 4) +julia> S = matrix_space(R, 4, 4) Matrix Space of 4 rows and 4 columns over Residue ring of Integers modulo 7 julia> M = S([R(1) R(2) R(4) R(3); R(2) R(5) R(1) R(0); @@ -7004,20 +7004,20 @@ end ############################################################################### # -# MatrixSpace constructor +# matrix_space constructor # ############################################################################### @doc Markdown.doc""" - MatrixSpace(R::NCRing, r::Int, c::Int; cached::Bool = true) + matrix_space(R::NCRing, r::Int, c::Int; cached::Bool = true) Return parent object corresponding to the space of $r\times c$ matrices over the ring $R$. If `cached == true` (the default), the returned parent object is cached so that it can returned by future calls to the constructor with the same dimensions and base ring. """ -function MatrixSpace(R::NCRing, r::Int, c::Int; cached::Bool = true) - return Generic.MatrixSpace(R, r, c, cached=cached) +function matrix_space(R::NCRing, r::Int, c::Int; cached::Bool = true) + return Generic.matrix_space(R, r, c, cached=cached) end ############################################################################### diff --git a/src/NCPoly.jl b/src/NCPoly.jl index cb7f73dae2..606ba257fe 100644 --- a/src/NCPoly.jl +++ b/src/NCPoly.jl @@ -652,12 +652,12 @@ rand(S::NCPolyRing, deg_range, v...) = rand(Random.GLOBAL_RNG, S, deg_range, v.. ############################################################################### # -# PolynomialRing constructor +# polynomial_ring constructor # ############################################################################### @doc Markdown.doc""" - PolynomialRing(R::NCRing, s::Union{AbstractString, Char, Symbol}; cached::Bool = true) + polynomial_ring(R::NCRing, s::Union{AbstractString, Char, Symbol}; cached::Bool = true) Given a base ring `R` and string `s` specifying how the generator (variable) should be printed, return a tuple `S, x` representing the new polynomial @@ -666,16 +666,16 @@ object `S` will depend only on `R` and `x` and will be cached. Setting the optional argument `cached` to `false` will prevent the parent object `S` from being cached. """ -PolynomialRing(R::NCRing, s::Union{AbstractString, Char, Symbol}; cached::Bool = true) +polynomial_ring(R::NCRing, s::Union{AbstractString, Char, Symbol}; cached::Bool = true) -function PolynomialRing(R::NCRing, s::Symbol; cached::Bool = true) - return Generic.PolynomialRing(R, s, cached=cached) +function polynomial_ring(R::NCRing, s::Symbol; cached::Bool = true) + return Generic.polynomial_ring(R, s, cached=cached) end -function PolynomialRing(R::NCRing, s::AbstractString; cached::Bool = true) - return Generic.PolynomialRing(R, Symbol(s), cached=cached) +function polynomial_ring(R::NCRing, s::AbstractString; cached::Bool = true) + return Generic.polynomial_ring(R, Symbol(s), cached=cached) end -function PolynomialRing(R::NCRing, s::Char; cached::Bool = true) - return Generic.PolynomialRing(R, Symbol(s); cached=cached) +function polynomial_ring(R::NCRing, s::Char; cached::Bool = true) + return Generic.polynomial_ring(R, Symbol(s); cached=cached) end diff --git a/src/NCRings.jl b/src/NCRings.jl index ec858c9e87..254a8b1cbd 100644 --- a/src/NCRings.jl +++ b/src/NCRings.jl @@ -165,7 +165,7 @@ Return true if $a$ is invertible, else return false. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> S, x = PolynomialRing(QQ, "x") +julia> S, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> is_unit(x), is_unit(S(1)), is_unit(S(4)) diff --git a/src/NumberField.jl b/src/NumberField.jl index 3b56c74e70..8d2100295c 100644 --- a/src/NumberField.jl +++ b/src/NumberField.jl @@ -1,8 +1,8 @@ ############################################################################### # -# NumberField.jl - Number fields +# number_field.jl - Number fields # ############################################################################### -export NumberField +export number_field diff --git a/src/Poly.jl b/src/Poly.jl index e8918866bb..7468e81777 100644 --- a/src/Poly.jl +++ b/src/Poly.jl @@ -4,7 +4,7 @@ # ############################################################################### -export PolyCoeffs, PolynomialRing, PolyRing, addmul!, characteristic, +export PolyCoeffs, polynomial_ring, PolyRing, addmul!, characteristic, chebyshev_t, chebyshev_u, coefficient_ring, coefficients, compose, constant_coefficient, content, deflate, deflation, degree, derivative, discriminant, divexact, divexact_low, divhigh, divides, evaluate, @@ -3145,7 +3145,7 @@ end ################################################################################ function _change_poly_ring(R, Rx, cached) - P, _ = PolynomialRing(R, string(var(Rx)), cached = cached) + P, _ = polynomial_ring(R, string(var(Rx)), cached = cached) return P end @@ -3445,12 +3445,12 @@ end ############################################################################### # -# PolynomialRing constructor +# polynomial_ring constructor # ############################################################################### @doc Markdown.doc""" - PolynomialRing(R::Ring, s::Union{String, Char, Symbol}; cached::Bool = true) + polynomial_ring(R::Ring, s::Union{String, Char, Symbol}; cached::Bool = true) Given a base ring `R` and string `s` specifying how the generator (variable) should be printed, return a tuple `S, x` representing the new polynomial @@ -3459,18 +3459,18 @@ object `S` will depend only on `R` and `x` and will be cached. Setting the optional argument `cached` to `false` will prevent the parent object `S` from being cached. """ -PolynomialRing(R::Ring, s::Union{AbstractString, Char, Symbol}; cached::Bool = true) +polynomial_ring(R::Ring, s::Union{AbstractString, Char, Symbol}; cached::Bool = true) -function PolynomialRing(R::Ring, s::Symbol; cached::Bool = true) - return Generic.PolynomialRing(R, s; cached=cached) +function polynomial_ring(R::Ring, s::Symbol; cached::Bool = true) + return Generic.polynomial_ring(R, s; cached=cached) end -function PolynomialRing(R::Ring, s::AbstractString; cached::Bool = true) - return PolynomialRing(R, Symbol(s); cached=cached) +function polynomial_ring(R::Ring, s::AbstractString; cached::Bool = true) + return polynomial_ring(R, Symbol(s); cached=cached) end -function PolynomialRing(R::Ring, s::Char; cached::Bool = true) - return PolynomialRing(R, Symbol(s); cached=cached) +function polynomial_ring(R::Ring, s::Char; cached::Bool = true) + return polynomial_ring(R, Symbol(s); cached=cached) end function PolyRing(R::Ring) diff --git a/src/RelSeries.jl b/src/RelSeries.jl index 7e7f3a95f3..8064ce6129 100644 --- a/src/RelSeries.jl +++ b/src/RelSeries.jl @@ -4,7 +4,7 @@ # ############################################################################### -export AbsSeriesRing, RelSeriesRing, PowerSeriesRing, coeff, polcoeff, +export AbsSeriesRing, RelSeriesRing, power_series_ring, coeff, polcoeff, rel_series, rel_series_type, renormalize!, set_length!, set_precision!, set_valuation! @@ -1177,7 +1177,7 @@ end Return the derivative of the power series $f$. ``` -julia> R, x = PowerSeriesRing(QQ, 10, "x") +julia> R, x = power_series_ring(QQ, 10, "x") (Univariate power series ring in x over Rationals, x + O(x^11)) julia> f = 2 + x + 3x^3 @@ -1214,7 +1214,7 @@ end Return the integral of the power series $f$. ``` -julia> R, x = PowerSeriesRing(QQ, 10, "x") +julia> R, x = power_series_ring(QQ, 10, "x") (Univariate power series ring in x over Rationals, x + O(x^11)) julia> f = 2 + x + 3x^3 @@ -1351,7 +1351,7 @@ function _make_parent(g, p::RelSeriesElem, cached::Bool) S = parent(p) sym = String(var(S)) max_prec = max_precision(S) - return PowerSeriesRing(R, max_prec, sym; cached=cached)[1] + return power_series_ring(R, max_prec, sym; cached=cached)[1] end function map_coefficients(g, p::RelSeriesElem{<:RingElement}; @@ -1378,7 +1378,7 @@ end ################################################################################ function _change_rel_series_ring(R, Rx, cached) - P, _ = PowerSeriesRing(R, max_precision(Rx), + P, _ = power_series_ring(R, max_precision(Rx), string(var(Rx)), cached = cached) return P end @@ -1425,12 +1425,12 @@ rand(S::SeriesRing, val_range, v...) = rand(Random.GLOBAL_RNG, S, val_range, v.. ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### @doc Markdown.doc""" - PowerSeriesRing(R::Ring, prec::Int, s::Union{AbstractString, char, Symbol}; cached=true, model=:capped_relative) + power_series_ring(R::Ring, prec::Int, s::Union{AbstractString, char, Symbol}; cached=true, model=:capped_relative) Return a tuple $(S, x)$ consisting of the parent object `S` of a power series ring over the given base ring and a generator `x` for the power series ring. @@ -1443,18 +1443,18 @@ object `S` will be cached so that supplying the same base ring, string and precision in future will return the same parent object and generator. If caching of the parent object is not required, `cached` can be set to `false`. """ -PowerSeriesRing(R::Ring, prec::Int, s::Union{AbstractString, Char, Symbol}; cached=true, model=:capped_relative) +power_series_ring(R::Ring, prec::Int, s::Union{AbstractString, Char, Symbol}; cached=true, model=:capped_relative) -function PowerSeriesRing(R::Ring, prec::Int, s::Symbol; cached=true, model=:capped_relative) - return Generic.PowerSeriesRing(R, prec, s; cached=cached, model=model) +function power_series_ring(R::Ring, prec::Int, s::Symbol; cached=true, model=:capped_relative) + return Generic.power_series_ring(R, prec, s; cached=cached, model=model) end -function PowerSeriesRing(R::Ring, prec::Int, s::Char; cached=true, model=:capped_relative) - return PowerSeriesRing(R, prec, Symbol(s); cached=cached, model=model) +function power_series_ring(R::Ring, prec::Int, s::Char; cached=true, model=:capped_relative) + return power_series_ring(R, prec, Symbol(s); cached=cached, model=model) end -function PowerSeriesRing(R::Ring, prec::Int, s::AbstractString; cached=true, model=:capped_relative) - return PowerSeriesRing(R, prec, Symbol(s); cached=cached, model=model) +function power_series_ring(R::Ring, prec::Int, s::AbstractString; cached=true, model=:capped_relative) + return power_series_ring(R, prec, Symbol(s); cached=cached, model=model) end function AbsSeriesRing(R::Ring, prec::Int) diff --git a/src/Residue.jl b/src/Residue.jl index 690f85ffb6..29b83e625c 100644 --- a/src/Residue.jl +++ b/src/Residue.jl @@ -4,7 +4,7 @@ # ############################################################################### -export ResidueRing, data, modulus, lift, is_zero_divisor +export residue_ring, data, modulus, lift, is_zero_divisor ############################################################################### # @@ -430,12 +430,12 @@ rand(S::ResRing, v...) = rand(Random.GLOBAL_RNG, S, v...) ############################################################################### # -# ResidueRing constructor +# residue_ring constructor # ############################################################################### @doc Markdown.doc""" - ResidueRing(R::Ring, a::RingElement; cached::Bool=true) + residue_ring(R::Ring, a::RingElement; cached::Bool=true) Create the residue ring $R/(a)$ where $a$ is an element of the ring $R$. We require $a \neq 0$. If `cached == true` (the default) then the resulting @@ -443,7 +443,7 @@ residue ring parent object is cached and returned for any subsequent calls to the constructor with the same base ring $R$ and element $a$. A modulus of zero is not supported and throws an exception. """ -function ResidueRing(R::Ring, a::RingElement; cached::Bool = true) +function residue_ring(R::Ring, a::RingElement; cached::Bool = true) # Modulus of zero cannot be supported. E.g. A C library could not be expected to # do matrices over Z/0 using a Z/nZ type. The former is multiprecision, the latter not. iszero(a) && throw(DomainError(a, "Modulus must be nonzero")) @@ -452,7 +452,7 @@ function ResidueRing(R::Ring, a::RingElement; cached::Bool = true) return Generic.ResRing{T}(R(a), cached) end -function ResidueRing(R::PolyRing, a::RingElement; cached::Bool = true) +function residue_ring(R::PolyRing, a::RingElement; cached::Bool = true) iszero(a) && throw(DomainError(a, "Modulus must be nonzero")) !is_unit(leading_coefficient(a)) && throw(DomainError(a, "Non-invertible leading coefficient")) T = elem_type(R) @@ -463,13 +463,13 @@ end @doc Markdown.doc""" quo(R::Ring, a::RingElement; cached::Bool = true) -Returns `S, f` where `S = ResidueRing(R, a)` and `f` is the +Returns `S, f` where `S = residue_ring(R, a)` and `f` is the projection map from `R` to `S`. This map is supplied as a map with section where the section is the lift of an element of the residue field back to the ring `R`. """ function quo(R::Ring, a::RingElement; cached::Bool = true) - S = ResidueRing(R, a; cached=cached) + S = residue_ring(R, a; cached=cached) f = map_with_section_from_func(x->S(x), x->lift(x), R, S) return S, f end diff --git a/src/ResidueField.jl b/src/ResidueField.jl index e3113ad511..d7bd0ea410 100644 --- a/src/ResidueField.jl +++ b/src/ResidueField.jl @@ -1,10 +1,10 @@ ############################################################################### # -# ResidueField.jl : residue fields (modulo a principal ideal) +# residue_field.jl : residue fields (modulo a principal ideal) # ############################################################################### -export ResidueField +export residue_field ############################################################################### # @@ -477,19 +477,19 @@ rand(S::ResField, v...) = rand(Random.GLOBAL_RNG, S, v...) ############################################################################### # -# ResidueField constructor +# residue_field constructor # ############################################################################### @doc Markdown.doc""" - ResidueField(R::Ring, a::RingElement; cached::Bool = true) + residue_field(R::Ring, a::RingElement; cached::Bool = true) Create the residue ring $R/(a)$ where $a$ is an element of the ring $R$. We require $a \neq 0$. If `cached == true` (the default) then the resulting residue ring parent object is cached and returned for any subsequent calls to the constructor with the same base ring $R$ and element $a$. """ -function ResidueField(R::Ring, a::RingElement; cached::Bool = true) +function residue_field(R::Ring, a::RingElement; cached::Bool = true) iszero(a) && throw(DivideError()) T = elem_type(R) @@ -499,13 +499,13 @@ end @doc Markdown.doc""" quo(::Type{Field}, R::Ring, a::RingElement; cached::Bool = true) -Returns `S, f` where `S = ResidueField(R, a)` and `f` is the +Returns `S, f` where `S = residue_field(R, a)` and `f` is the projection map from `R` to `S`. This map is supplied as a map with section where the section is the lift of an element of the residue field back to the ring `R`. """ function quo(::Type{Field}, R::Ring, a::RingElement; cached::Bool = true) - S = ResidueField(R, a; cached=cached) + S = residue_field(R, a; cached=cached) f = map_with_section_from_func(x->S(x), x->lift(x), R, S) return S, f end diff --git a/src/Rings.jl b/src/Rings.jl index 1605172b31..4e41d684e4 100644 --- a/src/Rings.jl +++ b/src/Rings.jl @@ -135,7 +135,7 @@ omitted. """ function Base.sqrt(a::FieldElem; check::Bool=true) R = parent(a) - R, t = PolynomialRing(R, "t", cached = false) + R, t = polynomial_ring(R, "t", cached = false) f = factor(t^2 - a) for (p, e) in f if !check || degree(p) == 1 diff --git a/src/algorithms/MPolyFactor.jl b/src/algorithms/MPolyFactor.jl index 8eeb182e4c..7ddabd1a01 100644 --- a/src/algorithms/MPolyFactor.jl +++ b/src/algorithms/MPolyFactor.jl @@ -246,7 +246,7 @@ function pfracinit( end # univariate ring for gcdx - S, x = PolynomialRing(K, "x") + S, x = polynomial_ring(K, "x") sub = [k == mainvar ? x : S(1) for k in 1:nvars(R)] for j in 0:l @@ -791,7 +791,7 @@ end function mfactor_irred_univar(a::E, var::Int) where E R = parent(a) K = base_ring(R) - Kx, _ = PolynomialRing(K, "x") + Kx, _ = polynomial_ring(K, "x") F = factor(to_univar(a, var, Kx)) res = E[] ok = true @@ -873,7 +873,7 @@ function hlift_bivar_combine( xdeg = degree(a, xvar) ydeg = degree(a, yvar) - Ky, y = PolynomialRing(K, "x") + Ky, y = polynomial_ring(K, "x") yalpha = gen(R, yvar) - R(alpha) yalphapow = yalpha^(ydeg + 1) @@ -986,7 +986,7 @@ function lcc_kaltofen_step!( R = parent(Af.unit) r = length(Au) @assert r == length(divs) - Kx, _ = PolynomialRing(base_ring(R), string(gen(R,v))) + Kx, _ = polynomial_ring(base_ring(R), string(gen(R,v))) Auf = [collect(factor_squarefree(to_univar(Au[i], v, Kx)).fac) for i in 1:r] diff --git a/src/fundamental_interface.jl b/src/fundamental_interface.jl index 9b4bc879ce..5ceef2fcdc 100644 --- a/src/fundamental_interface.jl +++ b/src/fundamental_interface.jl @@ -25,7 +25,7 @@ julia> G = SymmetricGroup(5); g = Perm([3,4,5,2,1]) julia> parent(g) == G true -julia> S, x = LaurentSeriesRing(ZZ, 3, "x") +julia> S, x = laurent_series_ring(ZZ, 3, "x") (Laurent series ring in x over Integers, x + O(x^4)) julia> parent(x) == S @@ -43,7 +43,7 @@ Given a parent object (or its type), return the type of its elements. # Example ```jldoctest; setup = :(using AbstractAlgebra) -julia> S, x = PowerSeriesRing(QQ, 2, "x") +julia> S, x = power_series_ring(QQ, 2, "x") (Univariate power series ring in x over Rationals, x + O(x^3)) julia> elem_type(S) == typeof(x) @@ -61,10 +61,10 @@ Given an element (or its type), return the type of its parent object. # Example ```jldoctest; setup = :(using AbstractAlgebra) -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) -julia> S = MatrixSpace(R, 2, 2) +julia> S = matrix_space(R, 2, 2) Matrix Space of 2 rows and 2 columns over Univariate Polynomial Ring in x over Integers julia> a = rand(S, 0:1, 0:1); @@ -83,7 +83,7 @@ Return base ring $R$ of given element or parent $a$. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> S, x = PolynomialRing(QQ, "x") +julia> S, x = polynomial_ring(QQ, "x") (Univariate Polynomial Ring in x over Rationals, x) julia> base_ring(S) == QQ @@ -112,7 +112,7 @@ be either an element or parent. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> S = MatrixSpace(ZZ, 2, 2) +julia> S = matrix_space(ZZ, 2, 2) Matrix Space of 2 rows and 2 columns over Integers julia> one(S) @@ -149,7 +149,7 @@ julia> zero(S) [0//1 0//1] [0//1 0//1] -julia> R, x = PolynomialRing(ZZ, "x") +julia> R, x = polynomial_ring(ZZ, "x") (Univariate Polynomial Ring in x over Integers, x) julia> zero(x^3 + 2) @@ -171,7 +171,7 @@ Return true if $a$ is the multiplicative identity, else return false. # Examples ```jldoctest; setup = :(using AbstractAlgebra) -julia> S = MatrixSpace(ZZ, 2, 2); T = MatrixSpace(ZZ, 2, 3); U = MatrixSpace(ZZ, 3, 2); +julia> S = matrix_space(ZZ, 2, 2); T = matrix_space(ZZ, 2, 3); U = matrix_space(ZZ, 3, 2); julia> isone(S([1 0; 0 1])) true diff --git a/src/generic/AbsMSeries.jl b/src/generic/AbsMSeries.jl index d4b83f9965..85c74605fe 100644 --- a/src/generic/AbsMSeries.jl +++ b/src/generic/AbsMSeries.jl @@ -708,17 +708,17 @@ end ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### -function PowerSeriesRing(R::AbstractAlgebra.Ring, prec::Vector{Int}, +function power_series_ring(R::AbstractAlgebra.Ring, prec::Vector{Int}, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Symbol str = [String(a) for a in s] U = elem_type(R) - S, _ = AbstractAlgebra.PolynomialRing(R, str) + S, _ = AbstractAlgebra.polynomial_ring(R, str) V = elem_type(S) if model == :capped_absolute @@ -730,13 +730,13 @@ function PowerSeriesRing(R::AbstractAlgebra.Ring, prec::Vector{Int}, return tuple(parent_obj, gens(parent_obj)) end -function PowerSeriesRing(R::AbstractAlgebra.Ring, weights::Vector{Int}, prec::Int, +function power_series_ring(R::AbstractAlgebra.Ring, weights::Vector{Int}, prec::Int, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Symbol str = [String(a) for a in s] U = elem_type(R) - S, _ = AbstractAlgebra.PolynomialRing(R, str) + S, _ = AbstractAlgebra.polynomial_ring(R, str) V = elem_type(S) if model == :capped_absolute @@ -748,9 +748,9 @@ function PowerSeriesRing(R::AbstractAlgebra.Ring, weights::Vector{Int}, prec::In return tuple(parent_obj, gens(parent_obj)) end -function PowerSeriesRing(R::AbstractAlgebra.Ring, prec::Int, +function power_series_ring(R::AbstractAlgebra.Ring, prec::Int, s::Vector{T}; cached=true, model=:capped_absolute) where T <: Symbol prec_vec = [prec for v in s] - return PowerSeriesRing(R, prec_vec, s; cached=cached, model=model) + return power_series_ring(R, prec_vec, s; cached=cached, model=model) end diff --git a/src/generic/Fraction.jl b/src/generic/Fraction.jl index d85f1ae361..bc4c422a0e 100644 --- a/src/generic/Fraction.jl +++ b/src/generic/Fraction.jl @@ -163,11 +163,11 @@ end ############################################################################### # -# FractionField constructor +# fraction_field constructor # ############################################################################### -function FractionField(R::AbstractAlgebra.Ring; cached=true) +function fraction_field(R::AbstractAlgebra.Ring; cached=true) T = elem_type(R) return FracField{T}(R, cached) diff --git a/src/generic/GenericTypes.jl b/src/generic/GenericTypes.jl index 7f41e73788..b585ec68a3 100644 --- a/src/generic/GenericTypes.jl +++ b/src/generic/GenericTypes.jl @@ -415,7 +415,7 @@ mutable struct UnivPolyRing{T <: RingElement, U <: AbstractAlgebra.MPolyElem{T}} function UnivPolyRing{T, U}(R::Ring, ord::Symbol, cached::Bool=true) where {T <: RingElement, U <: AbstractAlgebra.MPolyElem{T}} return get_cached!(UnivPolyID, (R, ord, U), cached) do new{T, U}(R, Vector{Symbol}(undef, 0), ord, - PolynomialRing(R, Vector{Symbol}(undef, 0); cached=cached, ordering=ord)[1]) + polynomial_ring(R, Vector{Symbol}(undef, 0); cached=cached, ordering=ord)[1]) end::UnivPolyRing{T, U} end end @@ -696,19 +696,19 @@ end ############################################################################### # -# LaurentSeriesRing / LarentSeriesRingElem +# laurent_series_ring / LarentSeriesRingElem # ############################################################################### -mutable struct LaurentSeriesRing{T <: RingElement} <: AbstractAlgebra.Ring +mutable struct laurent_series_ring{T <: RingElement} <: AbstractAlgebra.Ring base_ring::Ring prec_max::Int S::Symbol - function LaurentSeriesRing{T}(R::Ring, prec::Int, s::Symbol, cached::Bool = true) where T <: RingElement + function laurent_series_ring{T}(R::Ring, prec::Int, s::Symbol, cached::Bool = true) where T <: RingElement return get_cached!(LaurentSeriesID, (R, prec, s), cached) do new{T}(R, prec, s) - end::LaurentSeriesRing{T} + end::laurent_series_ring{T} end end @@ -720,7 +720,7 @@ mutable struct LaurentSeriesRingElem{T <: RingElement} <: AbstractAlgebra.RingEl prec::Int val::Int scale::Int - parent::LaurentSeriesRing{T} + parent::laurent_series_ring{T} function LaurentSeriesRingElem{T}(a::Vector{T}, length::Int, prec::Int, val::Int, scale::Int) where T <: RingElement new{T}(a, length, prec, val, scale) @@ -729,19 +729,19 @@ end ############################################################################### # -# LaurentSeriesField / LarentSeriesFieldElem +# laurent_series_field / LarentSeriesFieldElem # ############################################################################### -mutable struct LaurentSeriesField{T <: FieldElement} <: AbstractAlgebra.Field +mutable struct laurent_series_field{T <: FieldElement} <: AbstractAlgebra.Field base_ring::Field prec_max::Int S::Symbol - function LaurentSeriesField{T}(R::Field, prec::Int, s::Symbol, cached::Bool = true) where T <: FieldElement + function laurent_series_field{T}(R::Field, prec::Int, s::Symbol, cached::Bool = true) where T <: FieldElement return get_cached!(LaurentSeriesID, (R, prec, s), cached) do new{T}(R, prec, s) - end::LaurentSeriesField{T} + end::laurent_series_field{T} end end @@ -751,7 +751,7 @@ mutable struct LaurentSeriesFieldElem{T <: FieldElement} <: AbstractAlgebra.Fiel prec::Int val::Int scale::Int - parent::LaurentSeriesField{T} + parent::laurent_series_field{T} function LaurentSeriesFieldElem{T}(a::Vector{T}, length::Int, prec::Int, val::Int, scale::Int) where T <: FieldElement new{T}(a, length, prec, val, scale) @@ -769,7 +769,7 @@ const LaurentSeriesElem{T} = Union{LaurentSeriesRingElem{T}, LaurentSeriesFieldE mutable struct PuiseuxSeriesRing{T <: RingElement} <: AbstractAlgebra.Ring laurent_ring::Ring - function PuiseuxSeriesRing{T}(R::LaurentSeriesRing{T}, cached::Bool = true) where T <: RingElement + function PuiseuxSeriesRing{T}(R::laurent_series_ring{T}, cached::Bool = true) where T <: RingElement return get_cached!(PuiseuxSeriesID, R, cached) do new{T}(R) end::PuiseuxSeriesRing{T} @@ -797,7 +797,7 @@ end mutable struct PuiseuxSeriesField{T <: FieldElement} <: AbstractAlgebra.Field laurent_ring::Field - function PuiseuxSeriesField{T}(R::LaurentSeriesField{T}, cached::Bool = true) where T <: FieldElement + function PuiseuxSeriesField{T}(R::laurent_series_field{T}, cached::Bool = true) where T <: FieldElement return get_cached!(PuiseuxSeriesFieldID, R, cached) do new{T}(R) end::PuiseuxSeriesField{T} diff --git a/src/generic/Ideal.jl b/src/generic/Ideal.jl index 98ce7ba829..42af7a1e1c 100644 --- a/src/generic/Ideal.jl +++ b/src/generic/Ideal.jl @@ -2171,7 +2171,7 @@ function intersection(I::Ideal{T}, J::Ideal{T}) where {U <: RingElement, T <: Ab R = base_ring(S) # coefficient ring # create ring with additional variable "t" with higher precedence tsym = gensym() - Sup, Supv = AbstractAlgebra.PolynomialRing(R, vcat(tsym, symbols(S)); cached=false, ordering=:degrevlex) + Sup, Supv = AbstractAlgebra.polynomial_ring(R, vcat(tsym, symbols(S)); cached=false, ordering=:degrevlex) G1 = gens(I) G2 = gens(J) ISup = Ideal(Sup, elem_type(Sup)[f(Supv[2:end]...) for f in G1]) @@ -2194,7 +2194,7 @@ function intersection(I::Ideal{T}, J::Ideal{T}) where {U <: RingElement, T <: Ab R = base_ring(S) # coefficient ring # create ring with additional variable "t" with higher precedence tsym = gensym() - Sup, Supv = AbstractAlgebra.PolynomialRing(R, vcat(tsym, symbols(S)); cached=false, ordering=ordering(S)) + Sup, Supv = AbstractAlgebra.polynomial_ring(R, vcat(tsym, symbols(S)); cached=false, ordering=ordering(S)) G1 = gens(I) G2 = gens(J) ISup = Ideal(Sup, elem_type(Sup)[f(Supv[2:end]...) for f in G1]) diff --git a/src/generic/LaurentMPoly.jl b/src/generic/LaurentMPoly.jl index b1488ff68a..ea10fa3055 100644 --- a/src/generic/LaurentMPoly.jl +++ b/src/generic/LaurentMPoly.jl @@ -633,7 +633,7 @@ end ############################################################################### function LaurentPolynomialRing(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool = true) - P, x = AbstractAlgebra.PolynomialRing(R, s, cached = cached) + P, x = AbstractAlgebra.polynomial_ring(R, s, cached = cached) R = LaurentMPolyWrapRing(P, cached) R, map(p -> LaurentMPolyWrap(R, p), x) end diff --git a/src/generic/LaurentPoly.jl b/src/generic/LaurentPoly.jl index 73d154371f..145e50924f 100644 --- a/src/generic/LaurentPoly.jl +++ b/src/generic/LaurentPoly.jl @@ -514,7 +514,7 @@ end ############################################################################### function LaurentPolynomialRing(R::AbstractAlgebra.Ring, s::Symbol; cached::Bool = true) - P, x = AbstractAlgebra.PolynomialRing(R, s, cached = cached) + P, x = AbstractAlgebra.polynomial_ring(R, s, cached = cached) R = LaurentPolyWrapRing(P, cached) R, LaurentPolyWrap(R, x) end diff --git a/src/generic/LaurentSeries.jl b/src/generic/LaurentSeries.jl index a0240236f0..808bf1a07d 100644 --- a/src/generic/LaurentSeries.jl +++ b/src/generic/LaurentSeries.jl @@ -23,19 +23,19 @@ function O(a::LaurentSeriesElem{T}) where T <: RingElement return parent(a)(Array{T}(undef, 0), 0, val, val, 1) end -parent_type(::Type{T}) where {S <: RingElement, T <: LaurentSeriesRingElem{S}} = LaurentSeriesRing{S} +parent_type(::Type{T}) where {S <: RingElement, T <: LaurentSeriesRingElem{S}} = laurent_series_ring{S} -parent_type(::Type{T}) where {S <: FieldElement, T <: LaurentSeriesFieldElem{S}} = LaurentSeriesField{S} +parent_type(::Type{T}) where {S <: FieldElement, T <: LaurentSeriesFieldElem{S}} = laurent_series_field{S} parent(a::LaurentSeriesElem) = a.parent -elem_type(::Type{T}) where {S <: RingElement, T <: LaurentSeriesRing{S}} = LaurentSeriesRingElem{S} +elem_type(::Type{T}) where {S <: RingElement, T <: laurent_series_ring{S}} = LaurentSeriesRingElem{S} -elem_type(::Type{T}) where {S <: FieldElement, T <: LaurentSeriesField{S}} = LaurentSeriesFieldElem{S} +elem_type(::Type{T}) where {S <: FieldElement, T <: laurent_series_field{S}} = LaurentSeriesFieldElem{S} -base_ring(R::LaurentSeriesRing{T}) where T <: RingElement = R.base_ring::parent_type(T) +base_ring(R::laurent_series_ring{T}) where T <: RingElement = R.base_ring::parent_type(T) -base_ring(R::LaurentSeriesField{T}) where T <: FieldElement = R.base_ring::parent_type(T) +base_ring(R::laurent_series_field{T}) where T <: FieldElement = R.base_ring::parent_type(T) base_ring(a::LaurentSeriesElem) = base_ring(parent(a)) @@ -46,20 +46,20 @@ end is_exact_type(a::Type{T}) where T <: LaurentSeriesElem = false @doc Markdown.doc""" - var(a::LaurentSeriesRing) + var(a::laurent_series_ring) Return the internal name of the generator of the power series ring. Note that this is returned as a `Symbol` not a `String`. """ -var(a::LaurentSeriesRing) = a.S +var(a::laurent_series_ring) = a.S @doc Markdown.doc""" - var(a::LaurentSeriesField) + var(a::laurent_series_field) Return the internal name of the generator of the power series ring. Note that this is returned as a `Symbol` not a `String`. """ -var(a::LaurentSeriesField) = a.S +var(a::laurent_series_field) = a.S function check_parent(a::LaurentSeriesElem, b::LaurentSeriesElem, throw::Bool = true) b = parent(a) != parent(b) @@ -115,20 +115,20 @@ Return the scale factor of the polynomial underlying the given power series. scale(a::LaurentSeriesElem) = a.scale @doc Markdown.doc""" - max_precision(R::LaurentSeriesRing) + max_precision(R::laurent_series_ring) Return the maximum relative precision of power series in the given power series ring. """ -max_precision(R::LaurentSeriesRing) = R.prec_max +max_precision(R::laurent_series_ring) = R.prec_max @doc Markdown.doc""" - max_precision(R::LaurentSeriesField) + max_precision(R::laurent_series_field) Return the maximum relative precision of power series in the given power series ring. """ -max_precision(R::LaurentSeriesField) = R.prec_max +max_precision(R::laurent_series_field) = R.prec_max @doc Markdown.doc""" exp_gcd(a::Generic.LaurentSeriesElem) @@ -282,32 +282,32 @@ function upscale(a::LaurentSeriesElem{T}, n::Int) where T <: RingElement return z end -zero(R::LaurentSeriesRing) = R(0) +zero(R::laurent_series_ring) = R(0) -zero(R::LaurentSeriesField) = R(0) +zero(R::laurent_series_field) = R(0) -one(R::LaurentSeriesField) = R(1) +one(R::laurent_series_field) = R(1) -one(R::LaurentSeriesRing) = R(1) +one(R::laurent_series_ring) = R(1) @doc Markdown.doc""" - gen(R::LaurentSeriesRing) + gen(R::laurent_series_ring) Return the generator of the power series ring, i.e. $x + O(x^{n + 1})$ where $n$ is the maximum precision of the power series ring $R$. """ -function gen(R::LaurentSeriesRing) +function gen(R::laurent_series_ring) S = base_ring(R) return R([one(S)], 1, max_precision(R) + 1, 1, 1) end @doc Markdown.doc""" - gen(R::LaurentSeriesField) + gen(R::laurent_series_field) Return the generator of the power series ring, i.e. $x + O(x^{n + 1})$ where $n$ is the maximum precision of the power series ring $R$. """ -function gen(R::LaurentSeriesField) +function gen(R::laurent_series_field) S = base_ring(R) return R([one(S)], 1, max_precision(R) + 1, 1, 1) end @@ -369,7 +369,7 @@ function renormalize!(z::LaurentSeriesElem) return nothing end -function characteristic(a::LaurentSeriesRing{T}) where T <: RingElement +function characteristic(a::laurent_series_ring{T}) where T <: RingElement return characteristic(base_ring(a)) end @@ -391,7 +391,7 @@ function similar(x::LaurentSeriesElem, R::Ring, max_prec::Int, # steal parent in case it is not cached p.parent = parent(x) else - p.parent = Generic.LaurentSeriesRing{TT}(R, max_prec, s, cached) + p.parent = Generic.laurent_series_ring{TT}(R, max_prec, s, cached) end return p end @@ -408,7 +408,7 @@ function similar(x::LaurentSeriesElem, R::Field, max_prec::Int, # steal parent in case it is not cached p.parent = parent(x) else - p.parent = Generic.LaurentSeriesField{TT}(R, max_prec, s, cached) + p.parent = Generic.laurent_series_field{TT}(R, max_prec, s, cached) end return p end @@ -493,7 +493,7 @@ function laurent_series(R::Ring, arr::Vector{T}, len::Int, prec::Int, val::Int, coeffs = T == Any && length(arr) == 0 ? elem_type(R)[] : map(R, arr) p = Generic.LaurentSeriesRingElem{TT}(coeffs, len, prec, val, scale) # Default is supposed to return a Generic Laurent series - p.parent = Generic.LaurentSeriesRing{TT}(R, max_precision, Symbol(var), cached) + p.parent = Generic.laurent_series_ring{TT}(R, max_precision, Symbol(var), cached) return p end @@ -504,7 +504,7 @@ function laurent_series(R::Field, arr::Vector{T}, len::Int, prec::Int, val::Int, coeffs = T == Any && length(arr) == 0 ? elem_type(R)[] : map(R, arr) p = Generic.LaurentSeriesFieldElem{TT}(coeffs, len, prec, val, scale) # Default is supposed to return a Generic Laurent series - p.parent = Generic.LaurentSeriesField{TT}(R, max_precision, Symbol(var), cached) + p.parent = Generic.laurent_series_field{TT}(R, max_precision, Symbol(var), cached) return p end @@ -551,12 +551,12 @@ function Base.show(io::IO, a::LaurentSeriesElem) print(io, AbstractAlgebra.obj_to_string(a, context = io)) end -function show(io::IO, a::LaurentSeriesRing) +function show(io::IO, a::laurent_series_ring) print(io, "Laurent series ring in ", var(a), " over ") print(IOContext(io, :compact => true), base_ring(a)) end -function show(io::IO, a::LaurentSeriesField) +function show(io::IO, a::laurent_series_field) print(io, "Laurent series field in ", var(a), " over ") print(IOContext(io, :compact => true), base_ring(a)) end @@ -572,7 +572,7 @@ function _make_parent(g, p::LaurentSeriesElem, cached::Bool) S = parent(p) sym = String(var(S)) max_prec = max_precision(S) - return AbstractAlgebra.LaurentSeriesRing(R, max_prec, sym; cached=cached)[1] + return AbstractAlgebra.laurent_series_ring(R, max_prec, sym; cached=cached)[1] end function map_coefficients(g, p::LaurentSeriesElem{<:RingElement}; @@ -600,7 +600,7 @@ end ################################################################################ function _change_laurent_series_ring(R, Rx, cached) - P, _ = AbstractAlgebra.LaurentSeriesRing(R, max_precision(Rx), + P, _ = AbstractAlgebra.laurent_series_ring(R, max_precision(Rx), string(var(Rx)), cached = cached) return P end @@ -1776,7 +1776,7 @@ end # ############################################################################### -const LaurentSeriesRingOrField = Union{LaurentSeriesRing,LaurentSeriesField} +const LaurentSeriesRingOrField = Union{laurent_series_ring,laurent_series_field} RandomExtensions.maketype(S::LaurentSeriesRingOrField, ::UnitRange{Int}, _) = elem_type(S) @@ -1834,27 +1834,27 @@ end # ############################################################################### -function (R::LaurentSeriesRing{T})(b::RingElement) where {T <: RingElement} +function (R::laurent_series_ring{T})(b::RingElement) where {T <: RingElement} return R(base_ring(R)(b)) end -function (R::LaurentSeriesField{T})(b::RingElement) where {T <: FieldElement} +function (R::laurent_series_field{T})(b::RingElement) where {T <: FieldElement} return R(base_ring(R)(b)) end -function (R::LaurentSeriesRing{T})() where {T <: RingElement} +function (R::laurent_series_ring{T})() where {T <: RingElement} z = LaurentSeriesRingElem{T}(Array{T}(undef, 0), 0, R.prec_max, R.prec_max, 1) z.parent = R return z end -function (R::LaurentSeriesField{T})() where {T <: FieldElement} +function (R::laurent_series_field{T})() where {T <: FieldElement} z = LaurentSeriesFieldElem{T}(Array{T}(undef, 0), 0, R.prec_max, R.prec_max, 1) z.parent = R return z end -function (R::LaurentSeriesRing{T})(b::Union{Integer, Rational, AbstractFloat}) where {T <: RingElement} +function (R::laurent_series_ring{T})(b::Union{Integer, Rational, AbstractFloat}) where {T <: RingElement} if b == 0 z = LaurentSeriesRingElem{T}(Array{T}(undef, 0), 0, R.prec_max, R.prec_max, 1) else @@ -1864,7 +1864,7 @@ function (R::LaurentSeriesRing{T})(b::Union{Integer, Rational, AbstractFloat}) w return z end -function (R::LaurentSeriesField{T})(b::Union{Rational, AbstractFloat}) where {T <: FieldElement} +function (R::laurent_series_field{T})(b::Union{Rational, AbstractFloat}) where {T <: FieldElement} if b == 0 z = LaurentSeriesFieldElem{T}(Array{T}(undef, 0), 0, R.prec_max, R.prec_max, 1) else @@ -1874,7 +1874,7 @@ function (R::LaurentSeriesField{T})(b::Union{Rational, AbstractFloat}) where {T return z end -function (R::LaurentSeriesRing{T})(b::T) where {T <: RingElem} +function (R::laurent_series_ring{T})(b::T) where {T <: RingElem} parent(b) != base_ring(R) && error("Unable to coerce to power series") if iszero(b) z = LaurentSeriesRingElem{T}(Array{T}(undef, 0), 0, R.prec_max, R.prec_max, 1) @@ -1885,7 +1885,7 @@ function (R::LaurentSeriesRing{T})(b::T) where {T <: RingElem} return z end -function (R::LaurentSeriesField{T})(b::T) where {T <: FieldElem} +function (R::laurent_series_field{T})(b::T) where {T <: FieldElem} parent(b) != base_ring(R) && error("Unable to coerce to power series") if iszero(b) z = LaurentSeriesFieldElem{T}(Array{T}(undef, 0), 0, R.prec_max, R.prec_max, 1) @@ -1896,17 +1896,17 @@ function (R::LaurentSeriesField{T})(b::T) where {T <: FieldElem} return z end -function (R::LaurentSeriesRing{T})(b::LaurentSeriesElem{T}) where {T <: RingElement} +function (R::laurent_series_ring{T})(b::LaurentSeriesElem{T}) where {T <: RingElement} parent(b) != R && error("Unable to coerce power series") return b end -function (R::LaurentSeriesField{T})(b::LaurentSeriesElem{T}) where {T <: FieldElement} +function (R::laurent_series_field{T})(b::LaurentSeriesElem{T}) where {T <: FieldElement} parent(b) != R && error("Unable to coerce power series") return b end -function (R::LaurentSeriesRing{T})(b::Vector{T}, len::Int, prec::Int, val::Int, scale::Int, rescale::Bool=true) where {T <: RingElement} +function (R::laurent_series_ring{T})(b::Vector{T}, len::Int, prec::Int, val::Int, scale::Int, rescale::Bool=true) where {T <: RingElement} if length(b) > 0 parent(b[1]) != base_ring(R) && error("Unable to coerce to power series") end @@ -1918,7 +1918,7 @@ function (R::LaurentSeriesRing{T})(b::Vector{T}, len::Int, prec::Int, val::Int, return z end -function (R::LaurentSeriesField{T})(b::Vector{T}, len::Int, prec::Int, val::Int, scale::Int, rescale::Bool=true) where {T <: RingElement} +function (R::laurent_series_field{T})(b::Vector{T}, len::Int, prec::Int, val::Int, scale::Int, rescale::Bool=true) where {T <: RingElement} if length(b) > 0 parent(b[1]) != base_ring(R) && error("Unable to coerce to power series") end @@ -1932,30 +1932,30 @@ end ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### -function LaurentSeriesRing(R::AbstractAlgebra.Ring, prec::Int, s::Symbol; cached=true) +function laurent_series_ring(R::AbstractAlgebra.Ring, prec::Int, s::Symbol; cached=true) T = elem_type(R) - parent_obj = LaurentSeriesRing{T}(R, prec, s, cached) + parent_obj = laurent_series_ring{T}(R, prec, s, cached) return parent_obj, gen(parent_obj) end -function LaurentSeriesRing(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cached=true) +function laurent_series_ring(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cached=true) T = elem_type(R) - parent_obj = LaurentSeriesField{T}(R, prec, s, cached) + parent_obj = laurent_series_field{T}(R, prec, s, cached) return parent_obj, gen(parent_obj) end -function LaurentSeriesField(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cached=true) +function laurent_series_field(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cached=true) T = elem_type(R) - parent_obj = LaurentSeriesField{T}(R, prec, s, cached) + parent_obj = laurent_series_field{T}(R, prec, s, cached) return parent_obj, gen(parent_obj) end diff --git a/src/generic/MPoly.jl b/src/generic/MPoly.jl index 02386479e1..513ae8a214 100644 --- a/src/generic/MPoly.jl +++ b/src/generic/MPoly.jl @@ -4130,11 +4130,11 @@ end ############################################################################### # -# PolynomialRing constructor +# polynomial_ring constructor # ############################################################################### -function PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool = true, ordering::Symbol = :lex) +function polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool = true, ordering::Symbol = :lex) T = elem_type(R) N = (ordering == :deglex || ordering == :degrevlex) ? length(s) + 1 : length(s) parent_obj = MPolyRing{T}(R, s, ordering, N, cached) @@ -4142,7 +4142,7 @@ function PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool return tuple(parent_obj, gens(parent_obj)) end -function PolynomialRing(R::AbstractAlgebra.Ring, s::Vector{String}; cached::Bool = true, ordering::Symbol = :lex) - return PolynomialRing(R, [Symbol(v) for v in s]; cached=cached, ordering=ordering) +function polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{String}; cached::Bool = true, ordering::Symbol = :lex) + return polynomial_ring(R, [Symbol(v) for v in s]; cached=cached, ordering=ordering) end diff --git a/src/generic/Matrix.jl b/src/generic/Matrix.jl index f109b1f698..448e544962 100644 --- a/src/generic/Matrix.jl +++ b/src/generic/Matrix.jl @@ -223,11 +223,11 @@ end ############################################################################### # -# MatrixSpace constructor +# matrix_space constructor # ############################################################################### -function MatrixSpace(R::AbstractAlgebra.NCRing, r::Int, c::Int; cached::Bool = true) +function matrix_space(R::AbstractAlgebra.NCRing, r::Int, c::Int; cached::Bool = true) T = elem_type(R) return MatSpace{T}(R, r, c, cached) end diff --git a/src/generic/NCPoly.jl b/src/generic/NCPoly.jl index 18d77f90af..76e4adae9f 100644 --- a/src/generic/NCPoly.jl +++ b/src/generic/NCPoly.jl @@ -261,11 +261,11 @@ end ############################################################################### # -# PolynomialRing constructor +# polynomial_ring constructor # ############################################################################### -function PolynomialRing(R::AbstractAlgebra.NCRing, s::Symbol; cached::Bool = true) +function polynomial_ring(R::AbstractAlgebra.NCRing, s::Symbol; cached::Bool = true) T = elem_type(R) parent_obj = NCPolyRing{T}(R, s, cached) diff --git a/src/generic/NumberField.jl b/src/generic/NumberField.jl index 2d94d4a40a..707bcdc00f 100644 --- a/src/generic/NumberField.jl +++ b/src/generic/NumberField.jl @@ -1,6 +1,6 @@ ############################################################################### # -# NumberField.jl - Generic number fields (mainly for test code) +# number_field.jl - Generic number fields (mainly for test code) # ############################################################################### @@ -32,13 +32,13 @@ end ############################################################################### # -# NumberField constructor (mainly for test code) +# number_field constructor (mainly for test code) # ############################################################################### -function NumberField(a::Poly{Rational{BigInt}}, s::Symbol, t = "\$"; cached = true) +function number_field(a::Poly{Rational{BigInt}}, s::Symbol, t = "\$"; cached = true) S = parent(a) - R = ResidueField(S, a, cached=cached) + R = residue_field(S, a, cached=cached) x = gen(S) return R, R(x) end diff --git a/src/generic/Poly.jl b/src/generic/Poly.jl index 60e7ef8b1d..cdee767d08 100644 --- a/src/generic/Poly.jl +++ b/src/generic/Poly.jl @@ -417,11 +417,11 @@ end ############################################################################### # -# PolynomialRing constructor +# polynomial_ring constructor # ############################################################################### -function PolynomialRing(R::AbstractAlgebra.Ring, s::Symbol; cached::Bool = true) +function polynomial_ring(R::AbstractAlgebra.Ring, s::Symbol; cached::Bool = true) T = elem_type(R) parent_obj = PolyRing{T}(R, s, cached) diff --git a/src/generic/PuiseuxSeries.jl b/src/generic/PuiseuxSeries.jl index d0171c730b..0aaddd7875 100644 --- a/src/generic/PuiseuxSeries.jl +++ b/src/generic/PuiseuxSeries.jl @@ -13,16 +13,16 @@ @doc Markdown.doc""" laurent_ring(R::PuiseuxSeriesRing{T}) where T <: RingElement -Return the `LaurentSeriesRing` underlying the given `PuiseuxSeriesRing`. +Return the `laurent_series_ring` underlying the given `PuiseuxSeriesRing`. """ -laurent_ring(R::PuiseuxSeriesRing{T}) where T <: RingElement = R.laurent_ring::LaurentSeriesRing{T} +laurent_ring(R::PuiseuxSeriesRing{T}) where T <: RingElement = R.laurent_ring::laurent_series_ring{T} @doc Markdown.doc""" laurent_ring(R::PuiseuxSeriesField{T}) where T <: FieldElement -Return the `LaurentSeriesField` underlying the given `PuiseuxSeriesField`. +Return the `laurent_series_field` underlying the given `PuiseuxSeriesField`. """ -laurent_ring(R::PuiseuxSeriesField{T}) where T <: FieldElement = R.laurent_ring::LaurentSeriesField{T} +laurent_ring(R::PuiseuxSeriesField{T}) where T <: FieldElement = R.laurent_ring::laurent_series_field{T} @doc Markdown.doc""" O(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement @@ -868,7 +868,7 @@ end function PuiseuxSeriesRing(R::AbstractAlgebra.Ring, prec::Int, s::Symbol; cached=true) - S, x = AbstractAlgebra.LaurentSeriesRing(R, prec, s; cached=cached) + S, x = AbstractAlgebra.laurent_series_ring(R, prec, s; cached=cached) T = elem_type(R) parent_obj = PuiseuxSeriesRing{T}(S, cached) @@ -877,7 +877,7 @@ function PuiseuxSeriesRing(R::AbstractAlgebra.Ring, prec::Int, s::Symbol; cached end function PuiseuxSeriesRing(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cached= true) - S, x = AbstractAlgebra.LaurentSeriesField(R, prec, s; cached=cached) + S, x = AbstractAlgebra.laurent_series_field(R, prec, s; cached=cached) T = elem_type(R) parent_obj = PuiseuxSeriesField{T}(S, cached) @@ -886,7 +886,7 @@ function PuiseuxSeriesRing(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cache end function PuiseuxSeriesField(R::AbstractAlgebra.Field, prec::Int, s::Symbol; cached = true) - S, x = AbstractAlgebra.LaurentSeriesField(R, prec, s; cached=cached) + S, x = AbstractAlgebra.laurent_series_field(R, prec, s; cached=cached) T = elem_type(R) parent_obj = PuiseuxSeriesField{T}(S, cached) diff --git a/src/generic/RationalFunctionField.jl b/src/generic/RationalFunctionField.jl index 99872d916c..61387bddfa 100644 --- a/src/generic/RationalFunctionField.jl +++ b/src/generic/RationalFunctionField.jl @@ -547,7 +547,7 @@ function (a::RationalFunctionField{T, U})(n::U, d::U) where {T <: FieldElement, try r.parent = FracDict[R] catch - r.parent = FractionField(R) + r.parent = fraction_field(R) end return a(r) end @@ -584,11 +584,11 @@ end function RationalFunctionField(k::Field, s::Symbol; cached=true) T = elem_type(k) - R, x = AbstractAlgebra.PolynomialRing(k, s, cached=cached) + R, x = AbstractAlgebra.polynomial_ring(k, s, cached=cached) U = elem_type(R) - S = FractionField(R) + S = fraction_field(R) g = S(x) t = Rat{T, U}(g) @@ -602,11 +602,11 @@ end function RationalFunctionField(k::Field, s::Vector{Symbol}; cached=true) T = elem_type(k) - R, x = AbstractAlgebra.PolynomialRing(k, s, cached=cached) + R, x = AbstractAlgebra.polynomial_ring(k, s, cached=cached) U = elem_type(R) - S = FractionField(R) + S = fraction_field(R) g = [S(xi) for xi in x] t = [Rat{T, U}(gi) for gi in g] diff --git a/src/generic/RelSeries.jl b/src/generic/RelSeries.jl index 1e8bf51f86..2e2ad7296e 100644 --- a/src/generic/RelSeries.jl +++ b/src/generic/RelSeries.jl @@ -395,11 +395,11 @@ end ############################################################################### # -# PowerSeriesRing constructor +# power_series_ring constructor # ############################################################################### -function PowerSeriesRing(R::AbstractAlgebra.Ring, prec::Int, s::Symbol; cached=true, model=:capped_relative) +function power_series_ring(R::AbstractAlgebra.Ring, prec::Int, s::Symbol; cached=true, model=:capped_relative) T = elem_type(R) if model == :capped_relative diff --git a/src/generic/ResidueField.jl b/src/generic/ResidueField.jl index cf444ea0ae..18080bc1fc 100644 --- a/src/generic/ResidueField.jl +++ b/src/generic/ResidueField.jl @@ -1,6 +1,6 @@ ############################################################################### # -# ResidueField.jl : generic residue fields (modulo a principal ideal) +# residue_field.jl : generic residue fields (modulo a principal ideal) # ############################################################################### diff --git a/src/generic/UnivPoly.jl b/src/generic/UnivPoly.jl index 8484a1389b..b85285ae65 100644 --- a/src/generic/UnivPoly.jl +++ b/src/generic/UnivPoly.jl @@ -254,7 +254,7 @@ function gen(S::UnivPolyRing{T, U}, s::Symbol) where {T <: RingElement, U <: Abs i = findfirst(x->x==s, S.S) if typeof(i) == Nothing push!(S.S, s) - S.mpoly_ring = PolynomialRing(base_ring(S), S.S; cached=true, ordering=S.ord)[1] + S.mpoly_ring = polynomial_ring(base_ring(S), S.S; cached=true, ordering=S.ord)[1] i = length(S.S) end return UnivPoly{T, U}(gen(mpoly_ring(S), i), S) @@ -908,7 +908,7 @@ end ################################################################################ function _change_univ_poly_ring(R, Rx, cached) - P, _ = AbstractAlgebra.PolynomialRing(R, map(string, symbols(Rx)), ordering = ordering(Rx), cached = cached) + P, _ = AbstractAlgebra.polynomial_ring(R, map(string, symbols(Rx)), ordering = ordering(Rx), cached = cached) S = AbstractAlgebra.UniversalPolynomialRing(R; ordering=ordering(Rx), cached=cached) S.S = deepcopy(symbols(Rx)) S.mpoly_ring = P diff --git a/src/julia/Rational.jl b/src/julia/Rational.jl index 0a4b35cffe..169e723bd8 100644 --- a/src/julia/Rational.jl +++ b/src/julia/Rational.jl @@ -378,8 +378,8 @@ end ############################################################################### # -# FractionField constructor +# fraction_field constructor # ############################################################################### -FractionField(R::Integers{T}) where T <: Integer = Rationals{T}() +fraction_field(R::Integers{T}) where T <: Integer = Rationals{T}() diff --git a/test/Benchmark-test.jl b/test/Benchmark-test.jl index 93e9f5e99f..a2dc604d1b 100644 --- a/test/Benchmark-test.jl +++ b/test/Benchmark-test.jl @@ -1,8 +1,8 @@ @testset "Benchmark.fateman" begin - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") - U, t = PolynomialRing(T, "t") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") + U, t = polynomial_ring(T, "t") p = (x + y + z + t + 1)^10 @@ -12,11 +12,11 @@ end @testset "Benchmark.pearce" begin - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") - U, t = PolynomialRing(T, "t") - V, u = PolynomialRing(U, "u") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") + U, t = polynomial_ring(T, "t") + V, u = polynomial_ring(U, "u") f = (x + y + 2z^2 + 3t^3 + 5u^5 + 1)^7 g = (u + t + 2z^2 + 3y^3 + 5x^5 + 1)^7 diff --git a/test/Factor-test.jl b/test/Factor-test.jl index 75cc74ddff..ae43a4fe9e 100644 --- a/test/Factor-test.jl +++ b/test/Factor-test.jl @@ -12,7 +12,7 @@ end @test string(Fac{BigInt}()) isa String - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) f = Fac(x, Dict(x*y => 1, x + y => 1)) @test evaluate(f) == x * (x + y) * (x*y) diff --git a/test/NCRings-test.jl b/test/NCRings-test.jl index 7a8382500b..9107297539 100644 --- a/test/NCRings-test.jl +++ b/test/NCRings-test.jl @@ -4,7 +4,7 @@ include("generic/FreeAssAlgebra-test.jl") @testset "NCRings.oftype" begin F = GF(3) - Fx, x = PolynomialRing(F, "x") + Fx, x = polynomial_ring(F, "x") z = oftype(x, 3) @test z == Fx(3) @test parent(z) === Fx @@ -16,12 +16,12 @@ end A = MatrixAlgebra(ZZ, rand(1:9)) a = rand(A, 1:9) - B, _ = PolynomialRing(A, "y") + B, _ = polynomial_ring(A, "y") b = rand(B, 1:9, 1:9) # matrices n = rand(1:9) - C = MatrixSpace(ZZ, n, n) + C = matrix_space(ZZ, n, n) c = rand(C, 1:9) # commutative rings @@ -29,7 +29,7 @@ end e = rand(big.(-9:9)) f = rand(1:9)//rand(1:9) - G, _ = PolynomialRing(ZZ, "x") + G, _ = polynomial_ring(ZZ, "x") g = rand(G, 1:9, 1:9) @testset "$T" for (x, T) in (x => string(nameof(typeof(x))) for x in (a, b, c, d, e, f, g)) @@ -52,6 +52,6 @@ end end # powers must error out on non-square matrices - M = MatrixSpace(ZZ, 2, rand(3:9)) + M = matrix_space(ZZ, 2, rand(3:9)) @test_throws DomainError powers(rand(M, 1:9), rand(1:9)) end diff --git a/test/PrettyPrinting-test.jl b/test/PrettyPrinting-test.jl index e40a0ba386..01cfc90706 100644 --- a/test/PrettyPrinting-test.jl +++ b/test/PrettyPrinting-test.jl @@ -261,7 +261,7 @@ "\\left(\\begin{array}{cc}\na & b \\\\\nc \\\\\nd & e\n\\end{array}\\right)" - R, (a, b, c) = PolynomialRing(QQ, ["a", "b", "c"]) + R, (a, b, c) = polynomial_ring(QQ, ["a", "b", "c"]) p = a + b^2 + c^3 @test sprint(show, p) == "a + b^2 + c^3" @test sprint(show, p, context = :compact => true) == "a + b^2 + c^3" @@ -304,7 +304,7 @@ "x^{20} & x^{20} y\n"* "\\end{array}" - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) @test AbstractAlgebra.obj_to_string_wrt_times(x^2) == "x^2" @test AbstractAlgebra.obj_to_string_wrt_times(x*y) == "(x*y)" @test AbstractAlgebra.obj_to_string_wrt_times(x + y) == "(x + y)" diff --git a/test/Rings-conformance-tests.jl b/test/Rings-conformance-tests.jl index a71e10d2aa..ea1bea517b 100644 --- a/test/Rings-conformance-tests.jl +++ b/test/Rings-conformance-tests.jl @@ -567,11 +567,11 @@ end function test_Ring_interface_recursive(R::AbstractAlgebra.Ring; reps = 50) test_Ring_interface(R; reps = reps) - Rx, _ = PolynomialRing(R, "x") + Rx, _ = polynomial_ring(R, "x") test_Poly_interface(Rx, reps = 2 + fld(reps, 2)) S = MatrixAlgebra(R, rand(0:3)) test_MatAlgebra_interface(S, reps = 2 + fld(reps, 2)) - S = MatrixSpace(R, rand(0:3), rand(0:3)) + S = matrix_space(R, rand(0:3), rand(0:3)) test_MatSpace_interface(S, reps = 2 + fld(reps, 2)) end diff --git a/test/algorithms/MPolyEvaluate-test.jl b/test/algorithms/MPolyEvaluate-test.jl index 65fad9b0c0..615e7ca9c5 100644 --- a/test/algorithms/MPolyEvaluate-test.jl +++ b/test/algorithms/MPolyEvaluate-test.jl @@ -33,7 +33,7 @@ end end @testset "MPolyEvaluate.ZZ(QQ)" begin - R, (x, y, z, t) = PolynomialRing(ZZ, ["x", "y", "z", "t"], ordering = :degrevlex) + R, (x, y, z, t) = polynomial_ring(ZZ, ["x", "y", "z", "t"], ordering = :degrevlex) test_evaluate(zero(R), [QQ(), QQ(), QQ(), QQ()]) test_evaluate(one(R), [QQ(), QQ(), QQ(), QQ()]) for i in 1:100 diff --git a/test/algorithms/MPolyFactor-test.jl b/test/algorithms/MPolyFactor-test.jl index fa68778ad7..423d7ade8e 100644 --- a/test/algorithms/MPolyFactor-test.jl +++ b/test/algorithms/MPolyFactor-test.jl @@ -2,7 +2,7 @@ # not much to test because we would need working univariate factorization @testset "hlift_have_lcs" begin - R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]) + R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) fac = [y*x^2+z, (z+1)*x^3+x*y+z, (y*z+1)*x^2+1] @@ -16,7 +16,7 @@ @testset "hlift_bivar_combine" begin - R, (x, y) = PolynomialRing(QQ, ["x", "y"]) + R, (x, y) = polynomial_ring(QQ, ["x", "y"]) p = y*(y*x+1)*((y+1)*x+y)*((y+2)*x+y) diff --git a/test/generic/AbsMSeries-test.jl b/test/generic/AbsMSeries-test.jl index c617d1b5a7..41fd7976ea 100644 --- a/test/generic/AbsMSeries-test.jl +++ b/test/generic/AbsMSeries-test.jl @@ -1,9 +1,9 @@ @testset "Generic.AbsMSeries.constructors" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(QQ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(QQ, prec, ["x$(i)" for i in 1:nvars]) f = rand(R, 0:10, -10:10) @@ -33,15 +33,15 @@ @test R(p, prec) isa Generic.AbsMSeries - R, gens = PowerSeriesRing(S, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(S, prec, ["x$(i)" for i in 1:nvars]) @test R(ZZ(2)) isa Generic.AbsMSeries @test R(x) isa Generic.AbsMSeries end - R1, (x1, y1) = PowerSeriesRing(ZZ, [3, 3], ["x", "y"]) - R2, (x2, y2) = PowerSeriesRing(ZZ, 3, ["x", "y"]) + R1, (x1, y1) = power_series_ring(ZZ, [3, 3], ["x", "y"]) + R2, (x2, y2) = power_series_ring(ZZ, 3, ["x", "y"]) @test R1 === R2 @@ -50,7 +50,7 @@ for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:40) - R, gens = PowerSeriesRing(QQ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(QQ, weights, prec, ["x$(i)" for i in 1:nvars]) f = rand(R, 0:10, -10:10) @@ -75,7 +75,7 @@ @test R(p, [0 for i in 1:nvars]) isa Generic.AbsMSeries - R, gens = PowerSeriesRing(S, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(S, weights, prec, ["x$(i)" for i in 1:nvars]) @test R(ZZ(2)) isa Generic.AbsMSeries @@ -84,7 +84,7 @@ end @testset "Generic.AbsMSeries.printing" begin - R, (x, y) = PowerSeriesRing(ZZ, [5, 3], ["x", "y"]) + R, (x, y) = power_series_ring(ZZ, [5, 3], ["x", "y"]) @test string(zero(R)) == "O(y^3) + O(x^5)" @test string(one(R)) == "1 + O(y^3) + O(x^5)" @@ -94,7 +94,7 @@ end # weighted - R, (x, y) = PowerSeriesRing(ZZ, [2, 3], 10, ["x", "y"]) + R, (x, y) = power_series_ring(ZZ, [2, 3], 10, ["x", "y"]) @test string(zero(R)) == "O(10)" @test string(one(R)) == "1 + O(10)" @@ -104,7 +104,7 @@ end end @testset "Generic.AbsMSeries.manipulation" begin - R, (x, y) = PowerSeriesRing(ZZ, [5, 3], ["x", "y"]) + R, (x, y) = power_series_ring(ZZ, [5, 3], ["x", "y"]) f = x^2 + 2x*y + y + 1 + O(x^3) + O(y^2) @@ -164,14 +164,14 @@ end @test characteristic(R) == 0 - S = ResidueRing(ZZ, 7) - R, (x, y) = PowerSeriesRing(S, [2, 3], ["x", "y"]) + S = residue_ring(ZZ, 7) + R, (x, y) = power_series_ring(S, [2, 3], ["x", "y"]) @test characteristic(R) == 7 # weighted - R, (x, y) = PowerSeriesRing(ZZ, [2, 3], 10, ["x", "y"]) + R, (x, y) = power_series_ring(ZZ, [2, 3], 10, ["x", "y"]) f = x^2 + 2x*y + y + 1 @@ -219,8 +219,8 @@ end @test characteristic(R) == 0 - S = ResidueRing(ZZ, 7) - R, (x, y) = PowerSeriesRing(S, [2, 3], 10, ["x", "y"]) + S = residue_ring(ZZ, 7) + R, (x, y) = power_series_ring(S, [2, 3], 10, ["x", "y"]) @test characteristic(R) == 7 end @@ -228,7 +228,7 @@ end @testset "Generic.AbsMSeries.truncation" begin for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:10, -10:10) @@ -249,7 +249,7 @@ end @testset "Generic.AbsMSeries.unary_ops" begin for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:10, -10:10) @@ -264,7 +264,7 @@ end for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:10, -10:10) @@ -278,7 +278,7 @@ end @testset "Generic.AbsMSeries.binary_ops" begin for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:12, -10:10) @@ -301,7 +301,7 @@ end for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:12, -10:10) @@ -321,11 +321,11 @@ end end @testset "Generic.AbsMSeries.adhoc_binary_ops" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:12, -10:10) @@ -346,7 +346,7 @@ end end prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(S, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(S, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:12, -1:2, -10:10) @@ -369,7 +369,7 @@ end for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:12, -10:10) @@ -391,7 +391,7 @@ end weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(S, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(S, weights, prec, ["x$(i)" for i in 1:nvars]) for iters = 1:100 f = rand(R, 0:12, -1:2, -10:10) @@ -413,7 +413,7 @@ end @testset "Generic.AbsMSeries.powering" begin for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:100 f = rand(R, 0:12, -10:10) @@ -434,7 +434,7 @@ end for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:100 f = rand(R, 0:12, -10:10) @@ -454,7 +454,7 @@ end @testset "Generic.AbsMSeries.comparison" begin for nvars in 1:5 prec = [rand(0:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:100 f = rand(R, 0:12, -10:10) @@ -475,7 +475,7 @@ end for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:100 f = rand(R, 0:12, -10:10) @@ -489,7 +489,7 @@ end @testset "Generic.AbsMSeries.adhoc_comparison" begin for nvars in 1:5 prec = [rand(1:10) for i in 1:nvars] - R, gens = PowerSeriesRing(ZZ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:100 c = rand(ZZ, -10:10) @@ -509,7 +509,7 @@ end for nvars in 1:5 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(ZZ, weights, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:100 c = rand(ZZ, -10:10) @@ -528,7 +528,7 @@ end @testset "Generic.AbsMSeries.inversion" begin for nvars in 1:4 prec = [rand(1:8) for i in 1:nvars] - R, gens = PowerSeriesRing(QQ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(QQ, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:20*nvars f = rand(R, 0:8, -10:10) @@ -543,7 +543,7 @@ end for nvars in 1:4 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(QQ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(QQ, weights, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:20*nvars f = rand(R, 0:8, -10:10) if is_unit(f) @@ -556,7 +556,7 @@ end @testset "Generic.AbsMSeries.exact_division" begin for nvars in 1:4 prec = [rand(1:8) for i in 1:nvars] - R, gens = PowerSeriesRing(QQ, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(QQ, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:20*nvars f = rand(R, 0:8, -10:10) @@ -572,7 +572,7 @@ end for nvars in 1:4 weights = [rand(1:4) for i in 1:nvars] prec = rand(0:20) - R, gens = PowerSeriesRing(QQ, weights, prec, ["x$(i)" for i in 1:nvars]) + R, gens = power_series_ring(QQ, weights, prec, ["x$(i)" for i in 1:nvars]) for iter = 1:20*nvars f = rand(R, 0:8, -10:10) @@ -585,7 +585,7 @@ end end @testset "Generic.AbsMSeries.evaluation" begin - R, (x, y) = PowerSeriesRing(ZZ, [10, 10], ["x", "y"]) + R, (x, y) = power_series_ring(ZZ, [10, 10], ["x", "y"]) f = x^2 + y @@ -607,7 +607,7 @@ end # weighted - R, (x, y) = PowerSeriesRing(ZZ, [2, 3], 30, ["x", "y"]) + R, (x, y) = power_series_ring(ZZ, [2, 3], 30, ["x", "y"]) f = x^2 + y diff --git a/test/generic/AbsSeries-test.jl b/test/generic/AbsSeries-test.jl index c51b2ecc40..8eadc42ec4 100644 --- a/test/generic/AbsSeries-test.jl +++ b/test/generic/AbsSeries-test.jl @@ -28,10 +28,10 @@ end @test S1 !== S2 @test isa(S1, Generic.AbsSeriesRing) - R, x = PowerSeriesRing(ZZ, 30, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) - S, t = PolynomialRing(QQ, "t") - T, y = PowerSeriesRing(S, 30, "y", model=:capped_absolute) + S, t = polynomial_ring(QQ, "t") + T, y = power_series_ring(S, 30, "y", model=:capped_absolute) @test elem_type(R) == Generic.AbsSeries{BigInt} @test elem_type(Generic.AbsSeriesRing{BigInt}) == Generic.AbsSeries{BigInt} @@ -92,16 +92,16 @@ end @test x in keys(Dict(x => 1)) @test !(y in keys(Dict(x => 1))) - R, x = PowerSeriesRing(ZZ, 30, "x", model=:capped_absolute) - S, x = PowerSeriesRing(ZZ, 30, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) + S, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) @test R === S - S, x = PowerSeriesRing(ZZ, 30, "x", model=:capped_absolute, cached = false) + S, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute, cached = false) @test R !== S end @testset "Generic.AbsSeries.manipulation" begin - R, t = PolynomialRing(QQ, "t") - S, x = PowerSeriesRing(R, 30, "x", model=:capped_absolute) + R, t = polynomial_ring(QQ, "t") + S, x = power_series_ring(R, 30, "x", model=:capped_absolute) @test max_precision(S) == 30 @@ -139,14 +139,14 @@ end @test characteristic(R) == 0 - T = ResidueRing(ZZ, 7) - U, y = PowerSeriesRing(T, 10, "y", model=:capped_absolute) + T = residue_ring(ZZ, 7) + U, y = power_series_ring(T, 10, "y", model=:capped_absolute) @test modulus(T) == 7 end @testset "Generic.AbsSeries.similar" begin - R, x = PowerSeriesRing(ZZ, 10, "x"; model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x"; model=:capped_absolute) for iters = 1:10 f = rand(R, 0:10, -10:10) @@ -239,7 +239,7 @@ end @testset "Generic.AbsSeries.unary_ops" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -10:10) @@ -248,7 +248,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -1:1) @@ -257,8 +257,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, 0:5) @@ -269,7 +269,7 @@ end @testset "Generic.AbsSeries.binary_ops" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:100 f = rand(R, 0:12, -10:10) g = rand(R, 0:12, -10:10) @@ -285,7 +285,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:100 f = rand(R, 0:12, -1:1) g = rand(R, 0:12, -1:1) @@ -300,8 +300,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:100 f = rand(R, 0:12, 0:5) g = rand(R, 0:12, 0:5) @@ -318,7 +318,7 @@ end @testset "Generic.AbsSeries.adhoc_binary_ops" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:500 f = rand(R, 0:12, -10:10) c1 = rand(ZZ, -10:10) @@ -338,7 +338,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:500 f = rand(R, 0:12, -1:1) c1 = rand(ZZ, -10:10) @@ -358,8 +358,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = PowerSeriesRing(R, 10, "x", model=:capped_absolute) + R = residue_ring(ZZ, 6) + S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:500 f = rand(S, 0:12, 0:5) c1 = rand(ZZ, -10:10) @@ -386,7 +386,7 @@ end # Generic tower R, x = ZZ["x"] - S, y = PowerSeriesRing(R, 10, "y", model=:capped_absolute) + S, y = power_series_ring(R, 10, "y", model=:capped_absolute) for iter = 1:100 f = rand(S, 0:12, -1:5, -10:10) c1 = rand(ZZ, -10:10) @@ -408,7 +408,7 @@ end @testset "Generic.AbsSeries.comparison" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:500 f = rand(R, 0:12, -10:10) g = deepcopy(f) @@ -424,7 +424,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:500 f = rand(R, 0:12, -1:1) g = deepcopy(f) @@ -440,8 +440,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = PowerSeriesRing(R, 10, "x", model=:capped_absolute) + R = residue_ring(ZZ, 6) + S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:500 f = rand(S, 0:12, 0:5) g = deepcopy(f) @@ -459,7 +459,7 @@ end @testset "Generic.AbsSeries.adhoc_comparison" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:500 f = R() while f == 0 @@ -481,7 +481,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:500 f = R() while isapprox(f, R()) @@ -503,8 +503,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = PowerSeriesRing(R, 10, "x", model=:capped_absolute) + R = residue_ring(ZZ, 6) + S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:500 f = S() while f == 0 @@ -532,7 +532,7 @@ end # Generic tower R, x = ZZ["x"] - S, y = PowerSeriesRing(R, 10, "y", model=:capped_absolute) + S, y = power_series_ring(R, 10, "y", model=:capped_absolute) for iter = 1:100 f = S() while f == 0 @@ -556,7 +556,7 @@ end @testset "Generic.AbsSeries.powering" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:100 f = rand(R, 0:12, -10:10) @@ -572,7 +572,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:100 f = rand(R, 0:12, -1:1) @@ -591,8 +591,8 @@ end for iter = 1:100 n = rand(2:26) - Zn = ResidueRing(ZZ, n) - R, x = PowerSeriesRing(Zn, 10, "x", model=:capped_absolute) + Zn = residue_ring(ZZ, n) + R, x = power_series_ring(Zn, 10, "x", model=:capped_absolute) f = rand(R, 0:12, 0:n - 1) r2 = R(1) @@ -609,7 +609,7 @@ end @testset "Generic.AbsSeries.shift" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -10:10) s = rand(0:12) @@ -629,7 +629,7 @@ end @test_throws DomainError shift_right(f, -rand(2:100)) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -1:1) s = rand(0:12) @@ -649,8 +649,8 @@ end @test_throws DomainError shift_right(f, -rand(2:100)) # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, 0:5) s = rand(0:12) @@ -672,7 +672,7 @@ end @testset "Generic.AbsSeries.truncation" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -10:10) s = rand(0:12) @@ -689,7 +689,7 @@ end @test_throws DomainError truncate(f, -rand(2:100)) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -1:1) s = rand(0:12) @@ -706,8 +706,8 @@ end @test_throws DomainError truncate(f, -rand(2:100)) # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, 0:5) s = rand(0:12) @@ -727,7 +727,7 @@ end @testset "Generic.AbsSeries.inversion" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = R() while !is_unit(f) @@ -739,7 +739,7 @@ end # Exact field for prec = 1:10 - R, x = PowerSeriesRing(QQ, prec, "x"; model=:capped_absolute) + R, x = power_series_ring(QQ, prec, "x"; model=:capped_absolute) for iter = 1:30 f = R() while valuation(f) != 0 @@ -751,7 +751,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f = R() while coeff(f, 0) == 0 @@ -762,8 +762,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 f = R() while !is_unit(f) @@ -776,7 +776,7 @@ end @testset "Generic.AbsSeries.compose" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -789,7 +789,7 @@ end @test compose(R(), g) == R() end - S, y = PowerSeriesRing(ZZ, 10, "y", model=:capped_absolute) + S, y = power_series_ring(ZZ, 10, "y", model=:capped_absolute) for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -801,7 +801,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -814,7 +814,7 @@ end @test isapprox(compose(R(), g), R()) end - S, y = PowerSeriesRing(RealField, 10, "y", model=:capped_absolute) + S, y = power_series_ring(RealField, 10, "y", model=:capped_absolute) for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -825,8 +825,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -839,7 +839,7 @@ end @test compose(R(), g) == R() end - S, y = PowerSeriesRing(T, 10, "y", model=:capped_absolute) + S, y = power_series_ring(T, 10, "y", model=:capped_absolute) for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -853,7 +853,7 @@ end @testset "Generic.AbsSeries.square_root" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:10, -10:10) g = f^2 @@ -880,7 +880,7 @@ end @test_throws ErrorException sqrt(f) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:10, -1:1) g = f^2 @@ -905,9 +905,9 @@ end # Characteristic p field for p in [2, 7, 19, 65537, ZZ(2), ZZ(7), ZZ(19), ZZ(65537)] - R = ResidueField(ZZ, p) + R = residue_field(ZZ, p) - S, x = PowerSeriesRing(R, 10, "x", model=:capped_absolute) + S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:10 f = rand(S, 0:10, 0:Int(p)) @@ -934,10 +934,10 @@ end end end - R = ResidueField(ZZ, 2) - T, y = PolynomialRing(R, "x") + R = residue_field(ZZ, 2) + T, y = polynomial_ring(R, "x") - S, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + S, x = power_series_ring(T, 10, "x", model=:capped_absolute) f = 1 + y^2*x^2 + (y^2 + y + 1)*x^4 + O(x^10) @@ -954,7 +954,7 @@ end @testset "Generic.AbsSeries.exact_division" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 s = rand(0:9) f = rand(R, s:s, -10:10) @@ -970,7 +970,7 @@ end end # Exact field - R, x = PowerSeriesRing(QQ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(QQ, 10, "x", model=:capped_absolute) for iter = 1:300 s = rand(0:9) f = rand(R, s:s, -10:10) @@ -986,7 +986,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 s = rand(0:9) f = rand(R, s:s, -1:1) @@ -1002,8 +1002,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 s = rand(0:9) f = rand(R, s:s, 0:5) @@ -1021,7 +1021,7 @@ end @testset "Generic.AbsSeries.adhoc_exact_division" begin # Exact field - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -10:10) c = ZZ() @@ -1033,7 +1033,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + R, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:12, -1:1) c = RealField() @@ -1045,8 +1045,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x", model=:capped_absolute) + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:0, 0:5) c = T() @@ -1060,7 +1060,7 @@ end @testset "Generic.AbsSeries.derivative_integral" begin # Exact field - S, x = PowerSeriesRing(QQ, 10, "x"; model=:capped_absolute) + S, x = power_series_ring(QQ, 10, "x"; model=:capped_absolute) for iter = 1:100 f = rand(S, 0:10, -10:10) @@ -1072,7 +1072,7 @@ end end # Inexact field - S, x = PowerSeriesRing(RealField, 10, "x"; model=:capped_absolute) + S, x = power_series_ring(RealField, 10, "x"; model=:capped_absolute) for iter = 1:100 f = rand(S, 0:10, -10:10) @@ -1086,7 +1086,7 @@ end @testset "Generic.AbsSeries.special_functions" begin # Exact field - S, x = PowerSeriesRing(QQ, 10, "x", model=:capped_absolute) + S, x = power_series_ring(QQ, 10, "x", model=:capped_absolute) for iter = 1:100 @test exp(x + O(x^iter)) == exp(x + O(x^(iter - 1))) @@ -1114,7 +1114,7 @@ end end # Inexact field - S, x = PowerSeriesRing(RealField, 10, "x", model=:capped_absolute) + S, x = power_series_ring(RealField, 10, "x", model=:capped_absolute) for iter = 1:100 @test isapprox(exp(x + O(x^iter)), exp(x + O(x^(iter - 1)))) @@ -1143,8 +1143,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 143) - S, x = PowerSeriesRing(R, 10, "x", model=:capped_absolute) + R = residue_ring(ZZ, 143) + S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:10 @test exp(x + O(x^iter)) == exp(x + O(x^(iter - 1))) @@ -1165,7 +1165,7 @@ end end @testset "Generic.AbsSeries.change_base_ring" begin - Zx, x = PowerSeriesRing(ZZ, 10, "x"; model=:capped_absolute) + Zx, x = power_series_ring(ZZ, 10, "x"; model=:capped_absolute) @test 1 == map_coefficients(sqrt, x^0) p = Zx([i for i in 1:10], 10, 11) q = Zx([i for i in 10:-1:1], 10, 11) @@ -1190,13 +1190,13 @@ end end F = GF(11) - P, y = PowerSeriesRing(F, 10, "x"; model=:capped_absolute) + P, y = power_series_ring(F, 10, "x"; model=:capped_absolute) @test map_coefficients(t -> F(t) + 2, f) == 3y^2 + 5y^3 + 4y^6 end @testset "Generic.AbsSeries.unsafe_operators" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x", model=:capped_absolute) + R, x = power_series_ring(ZZ, 10, "x", model=:capped_absolute) for iter = 1:300 f = rand(R, 0:9, -10:10) diff --git a/test/generic/FactoredFraction-test.jl b/test/generic/FactoredFraction-test.jl index 31b6b9aa19..f3db236058 100644 --- a/test/generic/FactoredFraction-test.jl +++ b/test/generic/FactoredFraction-test.jl @@ -30,7 +30,7 @@ end @test divexact(ZZ(1), FF(2, 3)) == 3//2 @test !iszero(gcd(FF(2//3), FF(4//5))) - Zx, x = PolynomialRing(ZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") F = FactoredFractionField(Zx) @test F(2//3) == F(2, 3) @@ -56,19 +56,19 @@ end end @testset "Generic.FactoredFrac.ZZ.evaluate" begin - Zx, x = PolynomialRing(ZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") F = FactoredFractionField(Zx) x = F(x) @test evaluate(x//(x+1), 2//3) == 2//5 - Zxy, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + Zxy, (x, y) = polynomial_ring(ZZ, ["x", "y"]) F = FactoredFractionField(Zxy) (x, y) = (F(x), F(y)) @test evaluate(x//(x+y)^2, [1//3, 1//2]) == 12//25 end @testset "Generic.FactoredFrac.ZZ.valuation" begin - Zxy, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + Zxy, (x, y) = polynomial_ring(ZZ, ["x", "y"]) F = FactoredFractionField(Zxy) (X, Y) = (F(x), F(y)) @test remove(X//(X+Y)^2, x) == (1, 1//(X+Y)^2) @@ -165,7 +165,7 @@ end end @testset "Generic.FactoredFrac.ZZx" begin - Zx, x = PolynomialRing(ZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") F = FactoredFractionField(Zx) x = F(x) a = divexact(x + 1, (x + 2)^2) + x @@ -175,7 +175,7 @@ end end @testset "Generic.FactoredFrac.ZZxyz" begin - Zxyz, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"]) + Zxyz, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]) F = FactoredFractionField(Zxyz) (x, y, z) = (F(x), F(y), F(z)) @test (inv(x+y) + inv(x+y+z))*(x+y)*(x+y+z) == 2*x+2*y+z @@ -183,7 +183,7 @@ end end @testset "Generic.FactoredFrac.constructors" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") T = FactoredFractionField(S) @test FactoredFractionField(S, cached = true) === FactoredFractionField(S, cached = true) @@ -214,7 +214,7 @@ end @test characteristic(T) == 0 - TT = FactoredFractionField(PolynomialRing(QQ, "x")[1]) + TT = FactoredFractionField(polynomial_ring(QQ, "x")[1]) a = TT(1) b = T(2) @@ -226,7 +226,7 @@ end end @testset "Generic.FactoredFrac.printing" begin - S, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]) + S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) F = FactoredFractionField(S) (x, y, z) = (F(x), F(y), F(z)) @@ -240,7 +240,7 @@ end end @testset "Generic.FactoredFrac.derivative" begin - S, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + S, (x, y) = polynomial_ring(ZZ, ["x", "y"]) F = FactoredFractionField(S) (X, Y) = (F(x), F(y)) diff --git a/test/generic/Fraction-test.jl b/test/generic/Fraction-test.jl index 753fdefc47..79daebe283 100644 --- a/test/generic/Fraction-test.jl +++ b/test/generic/Fraction-test.jl @@ -1,9 +1,9 @@ @testset "Generic.Frac.constructors" begin - S, x = PolynomialRing(ZZ, "x") - T = FractionField(S) + S, x = polynomial_ring(ZZ, "x") + T = fraction_field(S) - @test FractionField(S, cached = true) === FractionField(S, cached = true) - @test FractionField(S, cached = false) !== FractionField(S, cached = true) + @test fraction_field(S, cached = true) === fraction_field(S, cached = true) + @test fraction_field(S, cached = false) !== fraction_field(S, cached = true) @test elem_type(T) == Generic.Frac{elem_type(S)} @test elem_type(Generic.FracField{elem_type(S)}) == Generic.Frac{elem_type(S)} @@ -41,7 +41,7 @@ @test isa(T(x + 2, x + 1)//T(x, x + 2), Generic.Frac) - TT = FractionField(PolynomialRing(QQ, "x")[1]) + TT = fraction_field(polynomial_ring(QQ, "x")[1]) a = TT(1) b = T(2) @@ -53,7 +53,7 @@ end @testset "Generic.Frac.printing" begin - S, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]) + S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) @test string((x+y)//z) == "(x + y)//z" @test string(x//y//z) == "x//(y*z)" @@ -61,15 +61,15 @@ end @testset "Generic.Frac.rand" begin - S, x = PolynomialRing(ZZ, "x") - K = FractionField(S) + S, x = polynomial_ring(ZZ, "x") + K = fraction_field(S) test_rand(K, -1:3, -3:3) end @testset "Generic.Frac.manipulation" begin - R = FractionField(ZZ) - S, x = PolynomialRing(ZZ, "x") + R = fraction_field(ZZ) + S, x = polynomial_ring(ZZ, "x") @test denominator((x + 1)//(-x^2 + 1)) == x - 1 @@ -91,14 +91,14 @@ end end @testset "Generic.Frac.unary_ops" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") @test -((x + 1)//(-x^2 + 1)) == 1//(x - 1) end @testset "Generic.Frac.binary_ops" begin - S, x = PolynomialRing(ZZ, "x") - K = FractionField(S) + S, x = polynomial_ring(ZZ, "x") + K = fraction_field(S) for iter = 1:100 a = rand(K, -1:3, -3:3) @@ -113,7 +113,7 @@ end end @testset "Generic.Frac.adhoc_binary" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = (-x + 1)//(2x^2 + 3) b = (x + 1)//(-x^2 + 1) @@ -144,7 +144,7 @@ end end @testset "Generic.Frac.comparison" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = -((x + 1)//(-x^2 + 1)) @@ -154,7 +154,7 @@ end end @testset "Generic.Frac.adhoc_comparison" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = 1//(x - 1) @@ -172,7 +172,7 @@ end end @testset "Generic.Frac.powering" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = (x + 1)//(-x^2 + 1) @@ -180,7 +180,7 @@ end end @testset "Generic.Frac.inversion" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = (x + 1)//(-x^2 + 1) @@ -188,8 +188,8 @@ end end @testset "Generic.Frac.exact_division" begin - S, x = PolynomialRing(ZZ, "x") - K = FractionField(S) + S, x = polynomial_ring(ZZ, "x") + K = fraction_field(S) for iter = 1:100 a = K(); b = K(); c = K() @@ -210,7 +210,7 @@ end end @testset "Generic.Frac.adhoc_exact_division" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = (-x + 1)//(2x^2 + 3) b = (x + 1)//(-x^2 + 1) @@ -225,8 +225,8 @@ end end @testset "Generic.Frac.divides" begin - R, x = PolynomialRing(ZZ, "x") - S = FractionField(R) + R, x = polynomial_ring(ZZ, "x") + S = fraction_field(R) for i in 1:1000 a = rand(S, -1:5, -10:10) @@ -241,15 +241,15 @@ end end @testset "Generic.Frac.evaluate" begin - R = ResidueRing(ZZ, 5) - S, x = PolynomialRing(R, "x") + R = residue_ring(ZZ, 5) + S, x = polynomial_ring(R, "x") f = (x^2 + 2)//(x + 1) @test evaluate(f, 1) == R(4) @test evaluate(f, R(1)) == R(4) - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) f = (x^2 + y)//(y + 2) @@ -258,19 +258,19 @@ end end @testset "Generic.Frac.derivative" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") f = (x^2 + 1)//2x @test derivative(f) == (x^2 - 1)//2x^2 - R, (x, ) = PolynomialRing(QQ, ["x"]) + R, (x, ) = polynomial_ring(QQ, ["x"]) f = (x^2 + 1)//2x @test derivative(f, x) == (x^2 - 1)//2x^2 - R, (x, y) = PolynomialRing(QQ, ["x", "y"]) + R, (x, y) = polynomial_ring(QQ, ["x", "y"]) f = (x^2 + x*y + y^2)//(x + y) @@ -280,8 +280,8 @@ end end @testset "Generic.Frac.square_root" begin - R, x = PolynomialRing(QQ, "x") - S = FractionField(R) + R, x = polynomial_ring(QQ, "x") + S = fraction_field(R) for i = 1:100 a = rand(S, -1:5, -10:10) @@ -311,7 +311,7 @@ end end @testset "Generic.Frac.gcd" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") a = (x + 1)//(-x^2 + 1) - x//(2x + 1) @@ -331,8 +331,8 @@ if @isdefined QQFieldElem end @testset "Generic.Frac.promotion" begin - S, x = PolynomialRing(QQ, "x") - F = FractionField(S) + S, x = polynomial_ring(QQ, "x") + F = fraction_field(S) T = elem_type(F) @test AbstractAlgebra.promote_rule(T, T) == T end diff --git a/test/generic/FreeAssAlgebra-test.jl b/test/generic/FreeAssAlgebra-test.jl index 241aaa8ce1..db2ec84f8f 100644 --- a/test/generic/FreeAssAlgebra-test.jl +++ b/test/generic/FreeAssAlgebra-test.jl @@ -109,7 +109,7 @@ @test collect(exponent_words(varlist[1] + 1)) == [Int[1], Int[]] @test isone(varlist[1]^0) - _, varlist = PolynomialRing(QQ, var_names) + _, varlist = polynomial_ring(QQ, var_names) y = varlist[1] @test x in [x, y] @test x in [y, x] @@ -124,8 +124,8 @@ function test_elem(R::Generic.FreeAssAlgebra{elem_type(ZZ)}) end @testset "Generic.FreeAssAlgebra.change_base_ring" begin - F5 = ResidueRing(ZZ, 5) - R, varsR = PolynomialRing(F5, ["x"]) + F5 = residue_ring(ZZ, 5) + R, varsR = polynomial_ring(F5, ["x"]) S, varsS = FreeAssociativeAlgebra(R, ["y"]) f = x -> x^2 + F5(3) @test map_coefficients(f, varsR[1] * varsS[1]) == f(varsR[1]) * varsS[1] @@ -135,7 +135,7 @@ end R, t = ZZ["t"] Rx, varsRx = FreeAssociativeAlgebra(R, var_names) - S, _ = PolynomialRing(R, ["y", "z"]) + S, _ = polynomial_ring(R, ["y", "z"]) Sx, varsSx = FreeAssociativeAlgebra(S, var_names) @test typeof(change_base_ring(R, Rx(0))) == typeof(Rx(0)) @@ -187,7 +187,7 @@ end end @testset "Generic.FreeAssAlgebra.is_unit" begin - R, (x,) = FreeAssociativeAlgebra(ResidueRing(ZZ, 4), ["x"]) + R, (x,) = FreeAssociativeAlgebra(residue_ring(ZZ, 4), ["x"]) @test !is_unit(x) @test !is_unit(2*x) diff --git a/test/generic/FreeModule-test.jl b/test/generic/FreeModule-test.jl index fdc88e7e00..501e8a56fe 100644 --- a/test/generic/FreeModule-test.jl +++ b/test/generic/FreeModule-test.jl @@ -1,5 +1,5 @@ @testset "Generic.FreeModule.constructors" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") M = FreeModule(R, 5) @test FreeModule(R, 5, cached = true) === FreeModule(R, 5, cached = true) @@ -21,14 +21,14 @@ end @testset "Generic.FreeModule.manipulation" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") M = FreeModule(R, 5) @test rank(M) == 5 end @testset "Generic.FreeModule.unary_ops" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:10 M = FreeModule(R, 3) @@ -52,7 +52,7 @@ end end @testset "Generic.FreeModule.binary_ops" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:10 M = FreeModule(R, 3) @@ -76,7 +76,7 @@ end end @testset "Generic.FreeModule.adhoc_binary" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:10 M = FreeModule(R, 3) @@ -107,7 +107,7 @@ end end @testset "Generic.FreeModule.hash" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") M = FreeModule(R, 5) # ensure hash works diff --git a/test/generic/FunctionField-test.jl b/test/generic/FunctionField-test.jl index 0ce5347e58..874270c0e9 100644 --- a/test/generic/FunctionField-test.jl +++ b/test/generic/FunctionField-test.jl @@ -848,7 +848,7 @@ end for i = 1:length(P1) S, y = FunctionField(P1[i], "y") - St, t = PolynomialRing(S, "t", cached = false) + St, t = polynomial_ring(S, "t", cached = false) @test t + y == y + t @test t * y == y * t @test t + 1 == 1 + t diff --git a/test/generic/Ideal-test.jl b/test/generic/Ideal-test.jl index 467d567e60..86df663917 100644 --- a/test/generic/Ideal-test.jl +++ b/test/generic/Ideal-test.jl @@ -124,7 +124,7 @@ end end @testset "Generic.Ideal.ideal_reduction(multivariate)" begin - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) for V in [ [-10*x^2*y - 2, 4*x^2*y^2], @@ -173,7 +173,7 @@ end @test testit(R, V) end - R, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"]; ordering=:degrevlex) + R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]; ordering=:degrevlex) for i = 1:100 n = rand(0:2) @@ -186,7 +186,7 @@ end end @testset "Generic.Ideal.ideal_reduction(univariate)" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -229,7 +229,7 @@ end @testset "Generic.Ideal.ideal_reduction(Fp[x])" begin Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) @@ -251,7 +251,7 @@ end @testset "Generic.Ideal.comparison" begin # multivariate - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) # random examples for i = 1:100 @@ -267,7 +267,7 @@ end end # univariate - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -279,7 +279,7 @@ end # Fp[x] Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) @@ -301,7 +301,7 @@ end @testset "Generic.Ideal.containment" begin # multivariate - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) # random examples for i = 1:100 @@ -323,7 +323,7 @@ end end # univariate - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -339,7 +339,7 @@ end # Fp[x] Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) @@ -374,7 +374,7 @@ end @testset "Generic.Ideal.addition" begin # multivariate - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) # random examples for i = 1:100 @@ -397,7 +397,7 @@ end end # univariate - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -414,7 +414,7 @@ end # Fp[x] Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) @@ -446,7 +446,7 @@ end @testset "Generic.Ideal.multiplication" begin # multivariate - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) # random examples for i = 1:50 @@ -473,7 +473,7 @@ end end # univariate - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -492,7 +492,7 @@ end # Fp[x] Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) @@ -528,7 +528,7 @@ end @testset "Generic.Ideal.adhoc_multiplication" begin # multivariate - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) # random examples for i = 1:100 @@ -548,7 +548,7 @@ end end # univariate - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -568,7 +568,7 @@ end # Fp[x] Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) @@ -598,7 +598,7 @@ end @testset "Generic.Ideal.intersection" begin # multivariate - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]; ordering=:degrevlex) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]; ordering=:degrevlex) # random examples for i = 1:50 @@ -623,7 +623,7 @@ end end # univariate - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:300 n = rand(0:5) @@ -642,7 +642,7 @@ end # Fp[x] Fp = GF(31) - R, x = PolynomialRing(Fp, "x") + R, x = polynomial_ring(Fp, "x") for i = 1:300 n = rand(0:10) diff --git a/test/generic/LaurentMPoly-test.jl b/test/generic/LaurentMPoly-test.jl index e7d6b288af..c2291559cb 100644 --- a/test/generic/LaurentMPoly-test.jl +++ b/test/generic/LaurentMPoly-test.jl @@ -19,7 +19,7 @@ end test_Ring_interface(L) test_Ring_interface_recursive(L) - L, (x, y) = LaurentPolynomialRing(ResidueRing(ZZ, ZZ(6)), ["x", "y"]) + L, (x, y) = LaurentPolynomialRing(residue_ring(ZZ, ZZ(6)), ["x", "y"]) test_Ring_interface(L) end @@ -38,7 +38,7 @@ end @test L != LaurentPolynomialRing(GF(5), [:x, :y], cached = false)[1] # only works because of the caching - R, (X, Y) = PolynomialRing(coefficient_ring(L), symbols(L)) + R, (X, Y) = polynomial_ring(coefficient_ring(L), symbols(L)) @test one(L) == L(one(R)) @test x == L(X) @test y == L(Y) @@ -46,7 +46,7 @@ end end @testset "Generic.LaurentMPoly.is_unit" begin - R, (x,) = LaurentPolynomialRing(ResidueRing(ZZ, 6), ["x"]) + R, (x,) = LaurentPolynomialRing(residue_ring(ZZ, 6), ["x"]) @test is_unit(x) @test !is_unit(2*x) diff --git a/test/generic/LaurentPoly-test.jl b/test/generic/LaurentPoly-test.jl index b7311333e2..dfab822878 100644 --- a/test/generic/LaurentPoly-test.jl +++ b/test/generic/LaurentPoly-test.jl @@ -18,7 +18,7 @@ end L0, y0 = LaurentPolynomialRing(zz, "y0") for R in (ZZ, GF(5)) - P, _ = PolynomialRing(R, "x0") + P, _ = polynomial_ring(R, "x0") L, y = LaurentPolynomialRing(R, "y") @test LaurentPolynomialRing(R, "y", cached = true)[1] === @@ -27,7 +27,7 @@ end @test LaurentPolynomialRing(R, "y", cached = true)[1] !== LaurentPolynomialRing(R, "y", cached = false)[1] - P2, _ = PolynomialRing(R, "x0", cached = false) + P2, _ = polynomial_ring(R, "x0", cached = false) @test LaurentPolynomialRing(P, "y")[1] === LaurentPolynomialRing(P, "y")[1] @@ -233,7 +233,7 @@ end end @testset "Generic.LaurentMPoly.is_unit" begin - R, x = LaurentPolynomialRing(ResidueRing(ZZ, 6), "x") + R, x = LaurentPolynomialRing(residue_ring(ZZ, 6), "x") @test is_unit(x) @test !is_unit(2*x) @@ -246,7 +246,7 @@ end end @testset "coercion" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") L, x1 = LaurentPolynomialRing(ZZ, "x") @test L(x) == x1 @test L(x+x^2) == x1+x1^2 @@ -292,7 +292,7 @@ end @test y*y*y*y*y*y*f*f == y^6 * f^2 # with polynomials as base ring - P, x = PolynomialRing(ZZ, "x") + P, x = polynomial_ring(ZZ, "x") L, y = LaurentPolynomialRing(P, "y") @test parent(x*y) == L @test parent(y*x) == L @@ -305,7 +305,7 @@ end # as base ring of polynomials L, y = LaurentPolynomialRing(ZZ, "y") - P, x = PolynomialRing(L, "x") + P, x = polynomial_ring(L, "x") @test parent(x*y) == P @test parent(y*x) == P @@ -485,7 +485,7 @@ end @test sprint(show, "text/plain", L) == "Univariate Laurent Polynomial Ring in y over Integers" p = y^1; p.mindeg = -3 @test sprint(show, "text/plain", p) == "y^-2" - R, z = PolynomialRing(L, "z") + R, z = polynomial_ring(L, "z") @test sprint(show, "text/plain", (y^2)*z) == "y^2*z" @test sprint(show, "text/plain", 3*(y^0)*z) == "3*z" @test sprint(show, "text/plain", -y*z + (-y*z^2)) == "-y*z^2 - y*z" @@ -498,7 +498,7 @@ end test_EuclideanRing_interface(L) test_Ring_interface_recursive(L) - L, y = LaurentPolynomialRing(ResidueRing(ZZ, ZZ(6)), "y") + L, y = LaurentPolynomialRing(residue_ring(ZZ, ZZ(6)), "y") test_Ring_interface(L) end end diff --git a/test/generic/LaurentSeries-test.jl b/test/generic/LaurentSeries-test.jl index 0a6dc4b9a5..ebcb14cf8c 100644 --- a/test/generic/LaurentSeries-test.jl +++ b/test/generic/LaurentSeries-test.jl @@ -17,31 +17,31 @@ # algos differ, and 7 can often stand in for 5/6 if the algorithm supports it. @testset "Generic.LaurentSeries.constructors" begin - R, x = LaurentSeriesRing(ZZ, 30, "x") + R, x = laurent_series_ring(ZZ, 30, "x") - @test LaurentSeriesRing(ZZ, 30, "x", cached = true)[1] === LaurentSeriesRing(ZZ, 30, "x", cached = true)[1] - @test LaurentSeriesRing(ZZ, 30, "x", cached = false)[1] !== LaurentSeriesRing(ZZ, 30, "x", cached = true)[1] + @test laurent_series_ring(ZZ, 30, "x", cached = true)[1] === laurent_series_ring(ZZ, 30, "x", cached = true)[1] + @test laurent_series_ring(ZZ, 30, "x", cached = false)[1] !== laurent_series_ring(ZZ, 30, "x", cached = true)[1] - S, t = PolynomialRing(QQ, "t") - T, y = LaurentSeriesRing(S, 30, "y") + S, t = polynomial_ring(QQ, "t") + T, y = laurent_series_ring(S, 30, "y") - U, z = LaurentSeriesField(QQ, 30, "z") + U, z = laurent_series_field(QQ, 30, "z") @test elem_type(R) == Generic.LaurentSeriesRingElem{BigInt} - @test elem_type(Generic.LaurentSeriesRing{BigInt}) == Generic.LaurentSeriesRingElem{BigInt} - @test parent_type(Generic.LaurentSeriesRingElem{BigInt}) == Generic.LaurentSeriesRing{BigInt} + @test elem_type(Generic.laurent_series_ring{BigInt}) == Generic.LaurentSeriesRingElem{BigInt} + @test parent_type(Generic.LaurentSeriesRingElem{BigInt}) == Generic.laurent_series_ring{BigInt} @test elem_type(T) == Generic.LaurentSeriesRingElem{elem_type(S)} - @test elem_type(Generic.LaurentSeriesRing{elem_type(S)}) == Generic.LaurentSeriesRingElem{elem_type(S)} - @test parent_type(Generic.LaurentSeriesRingElem{elem_type(S)}) == Generic.LaurentSeriesRing{elem_type(S)} + @test elem_type(Generic.laurent_series_ring{elem_type(S)}) == Generic.LaurentSeriesRingElem{elem_type(S)} + @test parent_type(Generic.LaurentSeriesRingElem{elem_type(S)}) == Generic.laurent_series_ring{elem_type(S)} @test elem_type(U) == Generic.LaurentSeriesFieldElem{Rational{BigInt}} - @test elem_type(Generic.LaurentSeriesField{Rational{BigInt}}) == Generic.LaurentSeriesFieldElem{Rational{BigInt}} - @test parent_type(Generic.LaurentSeriesFieldElem{Rational{BigInt}}) == Generic.LaurentSeriesField{Rational{BigInt}} + @test elem_type(Generic.laurent_series_field{Rational{BigInt}}) == Generic.LaurentSeriesFieldElem{Rational{BigInt}} + @test parent_type(Generic.LaurentSeriesFieldElem{Rational{BigInt}}) == Generic.laurent_series_field{Rational{BigInt}} - @test isa(R, Generic.LaurentSeriesRing) - @test isa(T, Generic.LaurentSeriesRing) - @test isa(U, Generic.LaurentSeriesField) + @test isa(R, Generic.laurent_series_ring) + @test isa(T, Generic.laurent_series_ring) + @test isa(U, Generic.laurent_series_field) a1 = x^3 + 2x + 1 a2 = (t^2 + 1)*y^2 + (t + 3)*y + O(y^4) @@ -101,28 +101,28 @@ @test x in keys(Dict(x => 1)) @test !(y in keys(Dict(x => 1))) - R, x = LaurentSeriesRing(ZZ, 30, "x") - RR, x = LaurentSeriesRing(ZZ, 30, "x") + R, x = laurent_series_ring(ZZ, 30, "x") + RR, x = laurent_series_ring(ZZ, 30, "x") @test R === RR - RR, x = LaurentSeriesRing(ZZ, 30, "x", cached = false) + RR, x = laurent_series_ring(ZZ, 30, "x", cached = false) @test R !== RR end @testset "Generic.LaurentSeries.rand" begin - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") test_rand(R, -12:12, -10:10) test_rand(R, -12:12, make(ZZ, -10:10)) - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") test_rand(R, -12:12, -1:1) test_rand(R, -12:12, make(RealField, -1:1)) end @testset "Generic.LaurentSeries.manipulation" begin - R, t = PolynomialRing(QQ, "t") - S, x = LaurentSeriesRing(R, 30, "x") + R, t = polynomial_ring(QQ, "t") + S, x = laurent_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -164,14 +164,14 @@ end @test characteristic(S) == 0 - T = ResidueRing(ZZ, 7) - U, y = LaurentSeriesRing(T, 10, "y") + T = residue_ring(ZZ, 7) + U, y = laurent_series_ring(T, 10, "y") @test modulus(T) == 7 end @testset "Generic.LaurentSeries.similar" begin - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iters = 1:10 f = rand(R, 0:10, -10:10) @@ -231,7 +231,7 @@ end end @testset "Generic.LaurentSeries.change_base_ring" begin - Zx, x = LaurentSeriesRing(ZZ, 10, "x") + Zx, x = laurent_series_ring(ZZ, 10, "x") @test 1 == map_coefficients(sqrt, x^0) p = Zx(BigInt[i for i in 1:10], 10, 11, 5, 1) q = Zx(BigInt[i for i in 10:-1:1], 10, 11, 5, 1) @@ -256,7 +256,7 @@ end end F = GF(11) - P, y = LaurentSeriesRing(F, 10, "x") + P, y = laurent_series_ring(F, 10, "x") @test map_coefficients(t -> F(t) + 2, f) == 3y^2 + 5y^3 + 4y^6 end @@ -306,7 +306,7 @@ end @testset "Generic.LaurentSeries.unary_ops" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, -12:12, -10:10) @@ -315,7 +315,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 f = rand(R, -12:12, -1:1) @@ -324,8 +324,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, -12:12, 0:5) @@ -336,7 +336,7 @@ end @testset "Generic.LaurentSeries.binary_ops" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:100 f = rand(R, -12:12, -10:10) g = rand(R, -12:12, -10:10) @@ -352,7 +352,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:100 f = rand(R, -12:12, -1:1) g = rand(R, -12:12, -1:1) @@ -367,8 +367,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:100 f = rand(R, -12:12, 0:5) g = rand(R, -12:12, 0:5) @@ -383,7 +383,7 @@ end end # Regression test for bug #484 - R, x = LaurentSeriesRing(QQ, 20,"x") + R, x = laurent_series_ring(QQ, 20,"x") a = sum(n*x^n for n in 1:17) b = 83 + 43*x^10 + O(x^20) c = a + b @@ -395,7 +395,7 @@ end @testset "Generic.LaurentSeries.inplace_binary_ops" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:100 f = rand(R, -12:12, -10:10) g = rand(R, -12:12, -10:10) @@ -408,7 +408,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:100 f = rand(R, -12:12, -1:1) g = rand(R, -12:12, -1:1) @@ -421,8 +421,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:100 f = rand(R, -12:12, 0:5) g = rand(R, -12:12, 0:5) @@ -437,7 +437,7 @@ end @testset "Generic.LaurentSeries.adhoc_binary_ops" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:500 f = rand(R, -12:12, -10:10) c1 = rand(ZZ, -10:10) @@ -457,7 +457,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:500 f = rand(R, -12:12, -1:1) c1 = rand(ZZ, -10:10) @@ -477,8 +477,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = LaurentSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 6) + S, x = laurent_series_ring(R, 10, "x") for iter = 1:500 f = rand(S, -12:12, 0:5) c1 = rand(ZZ, -10:10) @@ -505,7 +505,7 @@ end # Generic tower R, x = ZZ["x"] - S, y = LaurentSeriesRing(R, 10, "y") + S, y = laurent_series_ring(R, 10, "y") for iter = 1:100 f = rand(S, -12:12, 0:5, -10:10) c1 = rand(ZZ, -10:10) @@ -527,7 +527,7 @@ end @testset "Generic.LaurentSeries.comparison" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:500 f = rand(R, -12:12, -10:10) g = deepcopy(f) @@ -543,7 +543,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:500 f = rand(R, -12:12, -1:1) g = deepcopy(f) @@ -559,8 +559,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = LaurentSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 6) + S, x = laurent_series_ring(R, 10, "x") for iter = 1:500 f = rand(S, -12:12, 0:5) g = deepcopy(f) @@ -578,7 +578,7 @@ end @testset "Generic.LaurentSeries.adhoc_comparison" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:500 f = R() while f == 0 @@ -600,7 +600,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:500 f = R() while isapprox(f, R()) @@ -622,8 +622,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = LaurentSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 6) + S, x = laurent_series_ring(R, 10, "x") for iter = 1:500 f = S() while f == 0 @@ -651,7 +651,7 @@ end # Generic tower R, x = ZZ["x"] - S, y = LaurentSeriesRing(R, 10, "y") + S, y = laurent_series_ring(R, 10, "y") for iter = 1:100 f = S() while f == 0 @@ -675,7 +675,7 @@ end @testset "Generic.LaurentSeries.powering" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:100 f = rand(R, -12:12, -10:10) @@ -691,7 +691,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:100 f = rand(R, -12:12, -1:1) @@ -710,8 +710,8 @@ end for iter = 1:100 n = rand(2:26) - Zn = ResidueRing(ZZ, n) - R, x = LaurentSeriesRing(Zn, 10, "x") + Zn = residue_ring(ZZ, n) + R, x = laurent_series_ring(Zn, 10, "x") f = rand(R, -12:12, 0:n - 1) r2 = R(1) @@ -726,8 +726,8 @@ end end # regression test (see #967) - Zn = ResidueRing(ZZ, 4) - R, x = LaurentSeriesRing(Zn, 5, "x") + Zn = residue_ring(ZZ, 4) + R, x = laurent_series_ring(Zn, 5, "x") f = 2*x^6 + O(x^11) @test isequal(f*f, f^2) @@ -736,7 +736,7 @@ end @testset "Generic.LaurentSeries.shift" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, -12:12, -10:10) s = rand(0:12) @@ -747,7 +747,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 f = rand(R, -12:12, -1:1) s = rand(0:12) @@ -758,8 +758,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, -12:12, 0:5) s = rand(0:12) @@ -772,7 +772,7 @@ end @testset "Generic.LaurentSeries.truncation" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, -12:12, -10:10) s = rand(-12:12) @@ -783,7 +783,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 f = rand(R, -12:12, -1:1) s = rand(-12:12) @@ -794,8 +794,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, -12:12, 0:5) s = rand(-12:12) @@ -808,7 +808,7 @@ end @testset "Generic.LaurentSeries.inversion" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = R() while iszero(f) || !is_unit(polcoeff(f, 0)) @@ -819,7 +819,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 f = R() while iszero(f) @@ -830,8 +830,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:300 f = R() while iszero(f) || !is_unit(polcoeff(f, 0)) @@ -844,7 +844,7 @@ end @testset "Generic.LaurentSeries.square_root" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, -12:12, -10:10) g = f^2 @@ -871,7 +871,7 @@ end @test_throws ErrorException sqrt(f) # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 f = rand(R, -12:12, -1:1) g = f^2 @@ -896,9 +896,9 @@ end # Characteristic p field for p in [2, 7, 19, 65537, ZZ(7), ZZ(19), ZZ(65537)] - R = ResidueField(ZZ, p) + R = residue_field(ZZ, p) - S, x = LaurentSeriesField(R, 10, "x") + S, x = laurent_series_field(R, 10, "x") for iter = 1:10 f = rand(S, 0:10, 0:Int(p)) @@ -925,10 +925,10 @@ end end end - R = ResidueField(ZZ, 2) - T, y = PolynomialRing(R, "x") + R = residue_field(ZZ, 2) + T, y = polynomial_ring(R, "x") - S, x = LaurentSeriesRing(T, 10, "x") + S, x = laurent_series_ring(T, 10, "x") f = 1 + y^2*x^2 + (y^2 + y + 1)*x^4 + O(x^10) @@ -949,7 +949,7 @@ end @testset "Generic.LaurentSeries.exact_division" begin # Exact ring - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, -12:12, -10:10) g = rand(R, -12:12, -10:10) @@ -961,7 +961,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 s = rand(0:12) f = rand(R, -12:12, -1:1) @@ -974,8 +974,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 3, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 3, "x") for iter = 1:3000 f = rand(R, -12:12, 0:5) g = rand(R, -12:12, 0:5) @@ -989,7 +989,7 @@ end @testset "Generic.LaurentSeries.adhoc_exact_division" begin # Exact field - R, x = LaurentSeriesRing(ZZ, 10, "x") + R, x = laurent_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, -12:12, -10:10) c = ZZ() @@ -1001,7 +1001,7 @@ end end # Inexact field - R, x = LaurentSeriesField(RealField, 10, "x") + R, x = laurent_series_field(RealField, 10, "x") for iter = 1:300 f = rand(R, -12:12, -1:1) c = RealField() @@ -1013,8 +1013,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = LaurentSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = laurent_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, -12:12, 0:5) c = T() @@ -1028,7 +1028,7 @@ end @testset "Generic.LaurentSeries.derivative_integral" begin # Exact field - S, x = LaurentSeriesRing(QQ, 10, "x") + S, x = laurent_series_ring(QQ, 10, "x") for iter = 1:100 f = rand(S, -10:10, -10:10) @@ -1040,7 +1040,7 @@ end end # Inexact field - S, x = LaurentSeriesRing(RealField, 10, "x") + S, x = laurent_series_ring(RealField, 10, "x") for iter = 1:100 f = rand(S, -10:10, -10:10) @@ -1054,7 +1054,7 @@ end @testset "Generic.LaurentSeries.special_functions" begin # Exact field - S, x = LaurentSeriesRing(QQ, 10, "x") + S, x = laurent_series_ring(QQ, 10, "x") for iter = 1:100 @test exp(x + O(x^iter)) == exp(x + O(x^(iter - 1))) @@ -1082,7 +1082,7 @@ end end # Inexact field - S, x = LaurentSeriesField(RealField, 10, "x") + S, x = laurent_series_field(RealField, 10, "x") for iter = 1:100 @test isapprox(exp(x + O(x^iter)), exp(x + O(x^(iter - 1)))) @@ -1114,8 +1114,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 143) - S, x = LaurentSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 143) + S, x = laurent_series_ring(R, 10, "x") for iter = 1:10 @test exp(x + O(x^iter)) == exp(x + O(x^(iter - 1))) diff --git a/test/generic/MPoly-test.jl b/test/generic/MPoly-test.jl index 3b5a52a51a..e09d5ee443 100644 --- a/test/generic/MPoly-test.jl +++ b/test/generic/MPoly-test.jl @@ -5,12 +5,12 @@ var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) - @test PolynomialRing(R, var_names, ordering = ord, cached = true)[1] === PolynomialRing(R, var_names, ordering = ord, cached = true)[1] - @test PolynomialRing(R, var_names, ordering = ord, cached = false)[1] !== PolynomialRing(R, var_names, ordering = ord, cached = true)[1] - @test PolynomialRing(R, num_vars, "x", ordering = ord, cached = true)[1] === PolynomialRing(R, var_names, ordering = ord, cached = true)[1] - @test PolynomialRing(R, num_vars, ordering = ord, cached = true)[1] === PolynomialRing(R, var_names, ordering = ord, cached = true)[1] + @test polynomial_ring(R, var_names, ordering = ord, cached = true)[1] === polynomial_ring(R, var_names, ordering = ord, cached = true)[1] + @test polynomial_ring(R, var_names, ordering = ord, cached = false)[1] !== polynomial_ring(R, var_names, ordering = ord, cached = true)[1] + @test polynomial_ring(R, num_vars, "x", ordering = ord, cached = true)[1] === polynomial_ring(R, var_names, ordering = ord, cached = true)[1] + @test polynomial_ring(R, num_vars, ordering = ord, cached = true)[1] === polynomial_ring(R, var_names, ordering = ord, cached = true)[1] @test elem_type(S) == Generic.MPoly{elem_type(R)} @test elem_type(Generic.MPolyRing{elem_type(R)}) == Generic.MPoly{elem_type(R)} @@ -83,7 +83,7 @@ @test f1 == f3 - _, varlist = PolynomialRing(QQ, var_names) + _, varlist = polynomial_ring(QQ, var_names) y = varlist[1] @test x in [x, y] @test x in [y, x] @@ -135,7 +135,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) g = gens(S) C = Generic.geobucket(S) @@ -156,7 +156,7 @@ end ord = rand_ordering(rng) @test ord in [:lex, :deglex, :degrevlex] - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) test_rand(S, 0:5, 0:100, 0:0, -100:100) end @@ -170,7 +170,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) g = gens(S) @test !is_gen(S(1)) @@ -293,7 +293,7 @@ end for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 @test is_homogeneous(zero(S)) @@ -305,7 +305,7 @@ end end end - R, (x, ) = PolynomialRing(ZZ, ["x"]) + R, (x, ) = polynomial_ring(ZZ, ["x"]) @test is_univariate(R) @test is_univariate(x) @@ -313,7 +313,7 @@ end @test is_univariate(R(1)) @test is_univariate(x^3 + 3x) - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) @test !is_univariate(R) @test is_univariate(x) @@ -330,7 +330,7 @@ end end @testset "Generic.MPoly.is_unit" begin - R, (x,) = PolynomialRing(ResidueRing(ZZ, 4), ["x"]) + R, (x,) = polynomial_ring(residue_ring(ZZ, 4), ["x"]) @test !is_unit(x) @test !is_unit(2*x) @@ -349,7 +349,7 @@ end for iter = 1:5 ord = rand_ordering() - S, (x, y, z) = PolynomialRing(R, ["x", "y", "z"]; ordering=ord) + S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; ordering=ord) f = -8*x^5*y^3*z^5+9*x^5*y^2*z^3-8*x^4*y^5*z^4-10*x^4*y^3*z^2+8*x^3*y^2*z-10*x*y^3* z^4-4*x*y-10*x*z^2+8*y^2*z^5-9*y^2*z^3 @@ -369,7 +369,7 @@ end ord = rand_ordering() var_names = ["x$j" for j in 1:num_vars] - R, vars_R = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; ordering=ord) f = rand(R, 5:10, 1:10, -100:100) g = rand(R, 5:10, 1:10, -100:100) @@ -392,7 +392,7 @@ end for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -413,7 +413,7 @@ end for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 f = zero(S) @@ -440,7 +440,7 @@ end end end - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) @test constant_coefficient(R()) == 0 @test constant_coefficient(2x + 1) == 1 @@ -466,7 +466,7 @@ end degrees = [] for nord = 1:20 ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) p = zero(S) for j = 1:nterms p += prod(varlist[i]^exps[i,j] for i = 1:nvars) @@ -485,7 +485,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:5, 0:100, 0:0, -100:100) @@ -502,7 +502,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:5, 0:100, 0:0, -100:100) @@ -527,7 +527,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:100 f = rand(S, 0:5, 0:100, 0:0, -100:100) @@ -568,7 +568,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:100 d = rand(-100:100) @@ -591,7 +591,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:5, 0:100, 0:0, -100:100) @@ -611,7 +611,7 @@ end end # Over field of nonzero characteristic - R, (x, y, z, t) = PolynomialRing(GF(2), ["x", "y", "z", "t"]) + R, (x, y, z, t) = polynomial_ring(GF(2), ["x", "y", "z", "t"]) f = 1 + x + y + z + t @test zero(R)^0 == one(R) @@ -622,7 +622,7 @@ end # Over non-exact field F = RealField - R, u = PolynomialRing(F, 3) + R, u = polynomial_ring(F, 3) x = F(0.77)*u[1] + F(0.77)*one(F)*u[2] + F(0.63)*u[3] @test x^5 == x*x*x*x*x end @@ -634,7 +634,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 f = S(0) @@ -667,7 +667,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:5, 0:100, -100:100) @@ -698,12 +698,12 @@ end # Field of characteristic p for p in [2, 7, 13, 65537, ZZ(2), ZZ(7), ZZ(37), ZZ(65537)] - R = ResidueField(ZZ, p) + R = residue_field(ZZ, p) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:5, 0:100, 0:Int(p)) @@ -740,7 +740,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 f = S(0) @@ -768,7 +768,7 @@ end end - S, varlist = PolynomialRing(QQ, var_names, ordering = ord) + S, varlist = polynomial_ring(QQ, var_names, ordering = ord) v = varlist[1+Int(round(rand() * (num_vars-1)))] @test divrem(v, 2*v) == (1//2, 0) end @@ -781,7 +781,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) @test divrem(varlist[1], elem_type(S)[]) == (elem_type(S)[], varlist[1]) @@ -829,7 +829,7 @@ end for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 p = rand(S, 0:4, 0:5, -10:10) @@ -870,7 +870,7 @@ end for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -889,7 +889,7 @@ end for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(ZZ, var_names, ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -916,7 +916,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:50 f = rand(S, 0:5, 0:100, 0:0, -100:100) @@ -955,7 +955,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:50 f = rand(S, 0:5, 0:100, 0:0, 0:0, -100:100) @@ -977,7 +977,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:10 eval_num = rand(0:num_vars) @@ -1071,7 +1071,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:50 f = rand(S, 0:5, 0:100, -100:100) @@ -1116,7 +1116,7 @@ end # Test ordering is correct, see issue #184 for iter = 1:10 ord = rand_ordering() - R, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"], ordering = ord) + R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"], ordering = ord) f = x*y^2*z^3 @@ -1126,7 +1126,7 @@ end # Individual tests - R, (x, y) = PolynomialRing(ZZ, ["x", "y"]) + R, (x, y) = polynomial_ring(ZZ, ["x", "y"]) f = 2x^2*y^2 + 3x + y + 1 @@ -1144,12 +1144,12 @@ end @test f(x + y, 2y - x) == 2*x^4 - 4*x^3*y - 6*x^2*y^2 + 8*x*y^3 + 2*x + 8*y^4 + 5*y + 1 - S, z = PolynomialRing(R, "z") + S, z = polynomial_ring(R, "z") @test evaluate(f, [z + 1, z - 1]) == 2*z^4 - 4*z^2 + 4*z + 5 @test f(z + 1, z - 1) == 2*z^4 - 4*z^2 + 4*z + 5 - R, (x, y, z) = PolynomialRing(ZZ, ["x", "y", "z"]) + R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]) f = x^2*y^2 + 2x*z + 3y*z + z + 1 @@ -1161,8 +1161,8 @@ end @test evaluate(f, [x, y], [x + z, x - z]) == x^4 - 2*x^2*z^2 + 5*x*z + z^4 - z^2 + z + 1 - S, t = PolynomialRing(R, "t") - T, (x1, y1, z1) = PolynomialRing(QQ, ["x", "y", "z"]) + S, t = polynomial_ring(R, "t") + T, (x1, y1, z1) = polynomial_ring(QQ, ["x", "y", "z"]) f1 = x1^2*y1^2 + 2x1*z1 + 3y1*z1 + z1 + 1 @test evaluate(f, [2, 3], [t + 1, t - 1]) == @@ -1187,7 +1187,7 @@ end @test f(M1, ZZ(2), 3) == S([56 52; 78 134]) K = RealField - R, (x, y) = PolynomialRing(K, ["x", "y"]) + R, (x, y) = polynomial_ring(K, ["x", "y"]) @test evaluate(x + y, [K(1), K(1)]) isa BigFloat end @@ -1198,7 +1198,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = PolynomialRing(R, var_names, ordering = ord) + S, varlist = polynomial_ring(R, var_names, ordering = ord) for iter = 1:100 f = S() @@ -1234,7 +1234,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars = polynomial_ring(ZZ, var_names; ordering=ord) j = 1 for v in vars @@ -1255,9 +1255,9 @@ end end @testset "Generic.MPoly.change_base_ring" begin - F2 = ResidueRing(ZZ, 2) - R, varsR = PolynomialRing(F2, ["x"]) - S, varsS = PolynomialRing(R, ["y"]) + F2 = residue_ring(ZZ, 2) + R, varsR = polynomial_ring(F2, ["x"]) + S, varsS = polynomial_ring(R, ["y"]) f = x -> x^2 @test map_coefficients(f, varsR[1] * varsS[1]) == f(varsR[1]) * varsS[1] @@ -1265,9 +1265,9 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars = polynomial_ring(ZZ, var_names; ordering=ord) - F2x, varss = PolynomialRing(F2, var_names; ordering = ord) + F2x, varss = polynomial_ring(F2, var_names; ordering = ord) @test typeof(AbstractAlgebra.Generic.change_base_ring(ZZ, R(1))) == AbstractAlgebra.Generic.MPoly{typeof(ZZ(1))} @test typeof(AbstractAlgebra.Generic.change_base_ring(ZZ, R(0))) == AbstractAlgebra.Generic.MPoly{typeof(ZZ(0))} @@ -1293,7 +1293,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; ordering=ord) for iter in 1:10 f = rand(R, 5:10, 1:10, -100:100) @@ -1307,7 +1307,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; ordering=ord) for iter in 1:10 f = R() @@ -1341,7 +1341,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; ordering=ord) for iter in 1:10 f = R() @@ -1413,10 +1413,10 @@ end var_names = ["x$j" for j in 1:num_vars] - R, vars_R = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; ordering=ord) x = rand(vars_R) - R_univ, x_univ = PolynomialRing(ZZ, "x") + R_univ, x_univ = polynomial_ring(ZZ, "x") @test zero(R_univ) == to_univariate(R_univ, zero(R)) @test one(R_univ) == to_univariate(R_univ, one(R)) @@ -1439,7 +1439,7 @@ end ord = rand_ordering() var_names = ["x$j" for j in 1:num_vars] - R, vars_R = PolynomialRing(ZZ, var_names; ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; ordering=ord) @test length(AbstractAlgebra.Generic.coefficients_of_univariate(zero(R), true)) == 0 @test length(AbstractAlgebra.Generic.coefficients_of_univariate(zero(R), false)) == 0 @@ -1469,7 +1469,7 @@ end maxdeg = 20 # :deglex ordering - R, (x,y,z) = AbstractAlgebra.Generic.PolynomialRing(AbstractAlgebra.Generic.ZZ, ["x", "y", "z"], ordering=:lex) + R, (x,y,z) = AbstractAlgebra.Generic.polynomial_ring(AbstractAlgebra.Generic.ZZ, ["x", "y", "z"], ordering=:lex) # Monomials of degree 2 @test isless(z^2, y*z) == true @test isless(y*z, y^2) == true @@ -1480,7 +1480,7 @@ end for n_vars = 1:maxdeg A = unique(sortslices(reshape(map(Int,map(round, rand(n_vars * n_mpolys) * maxval)), (n_mpolys, n_vars)), dims=1),dims=1) var_names = ["x$j" for j in 1:n_vars] - R, varsR = AbstractAlgebra.Generic.PolynomialRing(AbstractAlgebra.Generic.ZZ, var_names, ordering=:lex) + R, varsR = AbstractAlgebra.Generic.polynomial_ring(AbstractAlgebra.Generic.ZZ, var_names, ordering=:lex) for i in 1:size(A)[1]-1 f = R([base_ring(R)(1)], [A[i,:]]) g = R([base_ring(R)(1)], [A[i+1,:]]) @@ -1489,7 +1489,7 @@ end end # :deglex ordering - R, (x,y,z) = AbstractAlgebra.Generic.PolynomialRing(AbstractAlgebra.Generic.ZZ, ["x", "y", "z"], ordering=:deglex) + R, (x,y,z) = AbstractAlgebra.Generic.polynomial_ring(AbstractAlgebra.Generic.ZZ, ["x", "y", "z"], ordering=:deglex) @test isless(z^2, y*z) == true @test isless(y*z, x*z) == true @@ -1500,7 +1500,7 @@ end for n_vars=1:maxdeg A = reshape(map(Int,map(round, rand(n_vars * n_mpolys) * maxval)), (n_mpolys, n_vars)) var_names = ["x$j" for j in 1:n_vars] - R, varsR = AbstractAlgebra.Generic.PolynomialRing(AbstractAlgebra.Generic.ZZ, var_names, ordering=:deglex) + R, varsR = AbstractAlgebra.Generic.polynomial_ring(AbstractAlgebra.Generic.ZZ, var_names, ordering=:deglex) for i in 1:size(A)[1]-1 f = R([base_ring(R)(1)], [A[i,:]]) @@ -1524,7 +1524,7 @@ end end # :degrevlex ordering - R, (x,y,z) = AbstractAlgebra.Generic.PolynomialRing(AbstractAlgebra.Generic.ZZ, ["x", "y", "z"], ordering=:degrevlex) + R, (x,y,z) = AbstractAlgebra.Generic.polynomial_ring(AbstractAlgebra.Generic.ZZ, ["x", "y", "z"], ordering=:degrevlex) # Monomials of degree 2 @test isless(z^2, y*z) == true @test isless(y*z, x*z) == true @@ -1534,7 +1534,7 @@ end for n_vars = 1:maxdeg A = reshape(map(Int,map(round, rand(n_vars * n_mpolys) * maxval)), (n_mpolys, n_vars)) var_names = ["x$j" for j in 1:n_vars] - R, varsR = AbstractAlgebra.Generic.PolynomialRing(AbstractAlgebra.Generic.ZZ, var_names, ordering=:degrevlex) + R, varsR = AbstractAlgebra.Generic.polynomial_ring(AbstractAlgebra.Generic.ZZ, var_names, ordering=:degrevlex) for i in 1:size(A)[1]-1 f = R([base_ring(R)(1)], [A[i,:]]) g = R([base_ring(R)(1)], [A[i+1,:]]) @@ -1560,6 +1560,6 @@ end end @testset "Generic.MPoly.equality" begin - R, _ = PolynomialRing(ZZ, Symbol[]) + R, _ = polynomial_ring(ZZ, Symbol[]) @test R(1) != R(2) end diff --git a/test/generic/Matrix-test.jl b/test/generic/Matrix-test.jl index 949636af8e..112ed36460 100644 --- a/test/generic/Matrix-test.jl +++ b/test/generic/Matrix-test.jl @@ -3,7 +3,7 @@ const RINGS = Dict( "exact field" => (GF(7), ()), "inexact ring" => (RealField["t"][1], (0:200, -1000:1000)), "inexact field" => (RealField, (-1000:1000,)), - "non-integral domain" => (ResidueRing(ZZ, 6), (0:5,)), + "non-integral domain" => (residue_ring(ZZ, 6), (0:5,)), "fraction field" => (QQ, (-1000:1000,)), ) @@ -82,7 +82,7 @@ AbstractAlgebra.parent_type(::Type{F2Matrix}) = F2MatSpace AbstractAlgebra.base_ring(::F2MatSpace) = F2() AbstractAlgebra.dense_matrix_type(::Type{F2}) = F2Matrix AbstractAlgebra.parent(a::F2Matrix) = F2MatSpace(nrows(a), ncols(a)) -AbstractAlgebra.MatrixSpace(::F2, r::Int, c::Int) = F2MatSpace(r, c) +AbstractAlgebra.matrix_space(::F2, r::Int, c::Int) = F2MatSpace(r, c) AbstractAlgebra.nrows(a::F2Matrix) = nrows(a.m) AbstractAlgebra.ncols(a::F2Matrix) = ncols(a.m) @@ -115,12 +115,12 @@ function AbstractAlgebra.matrix(R::F2, r::Int, c::Int, mat::AbstractMatrix{F2Ele end @testset "Generic.Mat.constructors" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") - S = MatrixSpace(R, 3, 3) + S = matrix_space(R, 3, 3) - @test MatrixSpace(R, 3, 3, cached = false) !== MatrixSpace(R, 3, 3, cached = false) - @test MatrixSpace(R, 3, 3, cached = true) === MatrixSpace(R, 3, 3, cached = true) + @test matrix_space(R, 3, 3, cached = false) !== matrix_space(R, 3, 3, cached = false) + @test matrix_space(R, 3, 3, cached = true) === matrix_space(R, 3, 3, cached = true) @test elem_type(S) == Generic.MatSpaceElem{elem_type(R)} @test elem_type(Generic.MatSpace{elem_type(R)}) == Generic.MatSpaceElem{elem_type(R)} @@ -271,12 +271,12 @@ end # Test creation from AbstractArray without setindex! A = MyTestMatrix(BigInt(3), 2) - S = MatrixSpace(ZZ, 2, 2) + S = matrix_space(ZZ, 2, 2) @test isa(S(A), Generic.MatSpaceElem{BigInt}) # Test original matrix not modified - S = MatrixSpace(QQ, 2, 2) + S = matrix_space(QQ, 2, 2) a = Rational{BigInt}(1) A = [a a; a a] M = S(A) @@ -307,7 +307,7 @@ end # Test constructors over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) @test isa(S, MatSpace) @@ -431,7 +431,7 @@ end # test over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @@ -445,8 +445,8 @@ end end @testset "Generic.Mat.manipulation" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) B = S([R(2) R(3) R(1); t t + 1 t + 2; R(-1) t^2 t^3]) @@ -538,7 +538,7 @@ end @test length(m0) == 0 @test isempty(m0) - M45 = MatrixSpace(R, 4, 5) + M45 = matrix_space(R, 4, 5) for m45 in [rand(M45, -1:9, -9:9), rand(rng, M45, -1:9, -9:9), randmat_triu(M45, -1:9, -9:9), @@ -563,7 +563,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @@ -588,8 +588,8 @@ end end @testset "Generic.Mat.unary_ops" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) B = S([-t - 1 (-t) -R(1); -t^2 (-t) (-t); -R(-2) (-t - 2) (-t^2 - t - 1)]) @@ -597,7 +597,7 @@ end @test -A == B # Exact ring - S = MatrixSpace(ZZ, rand(0:9), rand(0:9)) + S = matrix_space(ZZ, rand(0:9), rand(0:9)) A = rand(S, -1000:1000) @test iszero(A + (-A)) @@ -605,7 +605,7 @@ end @test -A == S(-A.entries) # Exact field - S = MatrixSpace(GF(7), rand(0:9), rand(0:9)) + S = matrix_space(GF(7), rand(0:9), rand(0:9)) A = rand(S) @test iszero(A + (-A)) @@ -613,7 +613,7 @@ end @test -A == S(-A.entries) # Inexact ring - S = MatrixSpace(RealField["t"][1], rand(0:9), rand(0:9)) + S = matrix_space(RealField["t"][1], rand(0:9), rand(0:9)) A = rand(S, 0:200, -1000:1000) @test iszero(A + (-A)) @@ -621,7 +621,7 @@ end @test -A == S(-A.entries) # Inexact field - S = MatrixSpace(RealField, rand(0:9), rand(0:9)) + S = matrix_space(RealField, rand(0:9), rand(0:9)) A = rand(S, -1000:1000) @test iszero(A + (-A)) @@ -629,7 +629,7 @@ end @test -A == S(-A.entries) # Non-integral domain - S = MatrixSpace(ResidueRing(ZZ, 6), rand(0:9), rand(0:9)) + S = matrix_space(residue_ring(ZZ, 6), rand(0:9), rand(0:9)) A = rand(S, 0:5) @test iszero(A + (-A)) @@ -643,7 +643,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @@ -651,14 +651,14 @@ end end @testset "Generic.Mat.getindex" begin - S = MatrixSpace(ZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) B = @inferred A[1:2, 1:2] @test typeof(B) == typeof(A) - @test B == MatrixSpace(ZZ, 2, 2)([1 2; 4 5]) + @test B == matrix_space(ZZ, 2, 2)([1 2; 4 5]) B[1, 1] = 10 @test A == S([1 2 3; 4 5 6; 7 8 9]) @@ -666,10 +666,10 @@ end C = @inferred B[1:2, 1:2] @test typeof(C) == typeof(A) - @test C == MatrixSpace(ZZ, 2, 2)([10 2; 4 5]) + @test C == matrix_space(ZZ, 2, 2)([10 2; 4 5]) C[1, 1] = 20 - @test B == MatrixSpace(ZZ, 2, 2)([10 2; 4 5]) + @test B == matrix_space(ZZ, 2, 2)([10 2; 4 5]) @test A == S([1 2 3; 4 5 6; 7 8 9]) D = @inferred A[:, 2:3] @@ -682,7 +682,7 @@ end @test D == @inferred D[:, :] # bounds check - S = MatrixSpace(ZZ, rand(1:9), 0) + S = matrix_space(ZZ, rand(1:9), 0) A = S() @test isempty(A) rows = UnitRange(extrema(rand(axes(A)[1], 2))...) @@ -690,7 +690,7 @@ end @test size(A[rows, :]) == (length(rows), 0) @test_throws BoundsError A[1:10, :] - S = MatrixSpace(ZZ, 0, rand(1:9)) + S = matrix_space(ZZ, 0, rand(1:9)) A = S() @test isempty(A) cols = UnitRange(extrema(rand(axes(A)[2], 2))...) @@ -698,7 +698,7 @@ end @test size(A[:, cols]) == (0, length(cols)) @test_throws BoundsError A[:, 1:10] - S = MatrixSpace(ZZ, 0, 0) + S = matrix_space(ZZ, 0, 0) A = S() @test isempty(A) # A[:, :] must be a valid indexing @@ -730,7 +730,7 @@ end # Exact ring R = ZZ - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1000:1000) ((i, j), (k, l)) = extrema.(rand.(axes(A), 2)) @@ -748,7 +748,7 @@ end # Exact field R = GF(7) - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S) ((i, j), (k, l)) = extrema.(rand.(axes(A), 2)) @@ -766,7 +766,7 @@ end # Inexact ring R = RealField["t"][1] - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, 0:200, -1000:1000) ((i, j), (k, l)) = extrema.(rand.(axes(A), 2)) @@ -784,7 +784,7 @@ end # Inexact field R = RealField - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1000:1000) ((i, j), (k, l)) = extrema.(rand.(axes(A), 2)) @@ -799,8 +799,8 @@ end @test A[rows, cols] == matrix(R, A.entries[rows, cols]) # Non-integral domain - R = ResidueRing(ZZ, 6) - S = MatrixSpace(R, rand(1:9), rand(1:9)) + R = residue_ring(ZZ, 6) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, 0:5) ((i, j), (k, l)) = extrema.(rand.(axes(A), 2)) @@ -816,7 +816,7 @@ end # Fraction field R = QQ - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1000:1000) ((i, j), (k, l)) = extrema.(rand.(axes(A), 2)) @@ -882,9 +882,9 @@ end end end - S = MatrixSpace(ZZ, 9, 9) + S = matrix_space(ZZ, 9, 9) (r, c) = (rand(1:9), rand(1:9)) - T = MatrixSpace(ZZ, r, c) + T = matrix_space(ZZ, r, c) a = rand(S, -100:100) b = rand(T, -100:100) startr = rand(1:(9-r+1)) @@ -897,10 +897,10 @@ end for i in 1:10 n = rand(1:9) m = rand(1:9) - S = MatrixSpace(ZZ, n, m) + S = matrix_space(ZZ, n, m) a = rand(S, -100:100) (r, c) = (rand(1:n), rand(1:m)) - T = MatrixSpace(zz, r, c) + T = matrix_space(zz, r, c) b = rand(T, -2:2) startr = rand(1:(n-r+1)) endr = startr + r - 1 @@ -933,7 +933,7 @@ end for R in [zz, ZZ] lr = r isa Colon ? nrows(a) : length(r) lc = c isa Colon ? ncols(a) : length(c) - T = MatrixSpace(zz, lr, lc) + T = matrix_space(zz, lr, lc) b = rand(T, -2:2) aa = deepcopy(a) a[r, c] = b @@ -952,7 +952,7 @@ end for R in [zz, ZZ] lr = r isa Colon ? nrows(a) : length(r) lc = c isa Colon ? ncols(a) : length(c) - T = MatrixSpace(zz, lr, lc) + T = matrix_space(zz, lr, lc) _b = rand(T, -2:2) b = vec(Matrix(_b)) a[r, c] = b @@ -968,7 +968,7 @@ end for R in [zz, ZZ] lr = r isa Colon ? nrows(a) : length(r) lc = c isa Colon ? ncols(a) : length(c) - T = MatrixSpace(zz, lr, lc) + T = matrix_space(zz, lr, lc) _b = rand(T, -2:2) b = vec(Matrix(_b)) a[r, c] = b @@ -981,8 +981,8 @@ end end @testset "Generic.Mat.binary_ops" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) B = S([R(2) R(3) R(1); t t + 1 t + 2; R(-1) t^2 t^3]) @@ -996,9 +996,9 @@ end # Exact ring R = ZZ - for S in (MatrixSpace(R, rand(1:9), rand(1:9)), + for S in (matrix_space(R, rand(1:9), rand(1:9)), let n = rand(1:9) - MatrixSpace(R, n, n) + matrix_space(R, n, n) end) A = rand(S, -1000:1000) @@ -1015,9 +1015,9 @@ end # Exact field R = GF(7) - for S in (MatrixSpace(R, rand(1:9), rand(1:9)), + for S in (matrix_space(R, rand(1:9), rand(1:9)), let n = rand(1:9) - MatrixSpace(R, n, n) + matrix_space(R, n, n) end) A = rand(S) @@ -1034,9 +1034,9 @@ end # Inexact ring R = RealField["t"][1] - for S in (MatrixSpace(R, rand(1:9), rand(1:9)), + for S in (matrix_space(R, rand(1:9), rand(1:9)), let n = rand(1:9) - MatrixSpace(R, n, n) + matrix_space(R, n, n) end) A = rand(S, -1:20, -100:100) @@ -1053,9 +1053,9 @@ end # Inexact field R = RealField - for S in (MatrixSpace(R, rand(1:9), rand(1:9)), + for S in (matrix_space(R, rand(1:9), rand(1:9)), let n = rand(1:9) - MatrixSpace(R, n, n) + matrix_space(R, n, n) end) A = rand(S, -1000:1000) @@ -1070,11 +1070,11 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) - for S in (MatrixSpace(R, rand(1:9), rand(1:9)), + for S in (matrix_space(R, rand(1:9), rand(1:9)), let n = rand(1:9) - MatrixSpace(R, n, n) + matrix_space(R, n, n) end) A = rand(S, 0:5) @@ -1091,9 +1091,9 @@ end # Fraction field R = QQ - for S in (MatrixSpace(R, rand(1:9), rand(1:9)), + for S in (matrix_space(R, rand(1:9), rand(1:9)), let n = rand(1:9) - MatrixSpace(R, n, n) + matrix_space(R, n, n) end) A = rand(S, -1000:1000) @@ -1110,7 +1110,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) N = rand(S, -10:10) @@ -1125,8 +1125,8 @@ end add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(CartesianIndices(M))] @testset "Generic.Mat.adhoc_binary" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1145,7 +1145,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca # Exact ring R = ZZ - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1000:1000) @@ -1159,7 +1159,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca end function _test_matrix_vector_prod(R, randargs...) - A = rand(MatrixSpace(R, 3, 2), randargs...) + A = rand(matrix_space(R, 3, 2), randargs...) v = elem_type(R)[rand(R, randargs...) for i in 1:2] @test A*v == [A[i,1]*v[1] + A[i,2]*v[2] for i in 1:nrows(A)] v = elem_type(R)[rand(R, randargs...) for i in 1:3] @@ -1171,13 +1171,13 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca v = elem_type(R)[rand(R, randargs...) for i in 1:2] @test v*A == [v[1]*A[1,i] + v[2]*A[2,i] for i in 1:ncols(A)] - A = rand(MatrixSpace(R, 0, 2), randargs...) + A = rand(matrix_space(R, 0, 2), randargs...) v = elem_type(R)[rand(R, randargs...) for i in 1:2] @test A*v == elem_type(R)[] v = elem_type(R)[] @test v*A == [zero(R) for i in 1:ncols(A)] - A = rand(MatrixSpace(R, 2, 0), randargs...) + A = rand(matrix_space(R, 2, 0), randargs...) v = elem_type(R)[] @test A*v == [zero(R) for i in 1:nrows(A)] v = elem_type(R)[rand(R, randargs...) for i in 1:2] @@ -1188,7 +1188,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca # Exact field R = GF(7) - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S) @@ -1205,7 +1205,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca # Inexact ring R = RealField["t"][1] - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1:200, -1000:1000) @@ -1222,7 +1222,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca # Inexact field R = RealField - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1000:1000) @@ -1238,8 +1238,8 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca _test_matrix_vector_prod(R, -1000:1000) # Non-integral domain - R = ResidueRing(ZZ, 6) - S = MatrixSpace(R, rand(1:9), rand(1:9)) + R = residue_ring(ZZ, 6) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, 0:5) @@ -1256,7 +1256,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca # Fraction field R = QQ - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) A = rand(S, -1000:1000) @@ -1274,7 +1274,7 @@ add_diag(M::Matrix, x) = [i != j ? M[i, j] : M[i, j] + x for (i, j) in Tuple.(Ca # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) N = rand(S, -10:10) @@ -1307,8 +1307,8 @@ end @testset "Generic.Mat.promotion" begin m = [1 2; 3 4] - F = ResidueField(ZZ, 3) - R, t = PolynomialRing(F, "t") + F = residue_field(ZZ, 3) + R, t = polynomial_ring(F, "t") A = matrix(R, m) B = matrix(F, m) @@ -1337,8 +1337,8 @@ end # vector * matrix m = [1 2; 3 4] - F = ResidueField(ZZ, 3) - R, t = PolynomialRing(F, "t") + F = residue_field(ZZ, 3) + R, t = polynomial_ring(F, "t") A = matrix(R, m) B = matrix(F, m) v = [one(F), 2*one(F)] @@ -1354,8 +1354,8 @@ end end @testset "Generic.Mat.permutation" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1365,7 +1365,7 @@ end @test A == inv(P)*(P*A) @testset "$name" for (name, (R, randparams)) in RINGS - S = MatrixSpace(R, rand(1:9), rand(0:9)) + S = matrix_space(R, rand(1:9), rand(0:9)) A = rand(S, randparams...) T = SymmetricGroup(nrows(A)) P = rand(T) @@ -1380,8 +1380,8 @@ end end @testset "Generic.Mat.comparison" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) B = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1391,7 +1391,7 @@ end @test A != one(S) @testset "$name" for (name, (R, randparams)) in RINGS - S = MatrixSpace(R, rand(1:9), rand(1:9)) + S = matrix_space(R, rand(1:9), rand(1:9)) seed = rand(1:999) Random.seed!(rng, seed) @@ -1423,7 +1423,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) N = deepcopy(M) @@ -1437,8 +1437,8 @@ end end @testset "Generic.Mat.adhoc_comparison" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1456,7 +1456,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) @test S(5) == 5 @test 5 == S(5) @@ -1470,8 +1470,8 @@ end end @testset "Generic.Mat.powering" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1479,7 +1479,7 @@ end @test A^0 == one(S) - S = MatrixSpace(QQ, 2, 2) + S = matrix_space(QQ, 2, 2) A = S(Rational{BigInt}[2 3; 7 -4]) @@ -1488,7 +1488,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @@ -1499,8 +1499,8 @@ end end @testset "Generic.Mat.adhoc_exact_division" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1510,7 +1510,7 @@ end @test divexact((1 + t)*A, 1 + t) == A Qx, x = QQ["x"] - Qxy, y = PolynomialRing(Qx, "y") + Qxy, y = polynomial_ring(Qx, "y") @test divexact(Qxy[2 0; 0 2], Qx(2)) == identity_matrix(Qxy, 2) @test divexact(Qxy[2 0; 0 2], Qx(2), check = false) == identity_matrix(Qxy, 2) @test divexact_left(Qxy[2 0; 0 2], Qx(2)) == identity_matrix(Qxy, 2) @@ -1520,10 +1520,10 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - U, x = PolynomialRing(R, "x") + U, x = polynomial_ring(R, "x") - S = MatrixSpace(R, 2, 2) - T = MatrixSpace(U, 2, 2) + S = matrix_space(R, 2, 2) + T = matrix_space(U, 2, 2) for i = 1:50 M = rand(S, -10:10) @@ -1550,7 +1550,7 @@ end end @testset "Generic.Mat.is_symmetric" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") @test !is_symmetric(matrix(R, [t + 1 t R(1); t^2 t t])) @test is_symmetric(matrix(R, [t + 1 t R(1); t t^2 t; R(1) t R(5)])) @test !is_symmetric(matrix(R, [t + 1 t R(1); t + 1 t^2 t; R(1) t R(5)])) @@ -1561,7 +1561,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @@ -1579,14 +1579,14 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @test is_skew_symmetric(M - transpose(M)) end @testset "Generic.Mat.transpose" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") arr = [t + 1 t R(1); t^2 t t] A = matrix(R, arr) B = matrix(R, permutedims(arr, [2, 1])) @@ -1607,8 +1607,8 @@ end end @testset "Generic.Mat.gram" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1616,8 +1616,8 @@ end end @testset "Generic.Mat.tr" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1625,8 +1625,8 @@ end end @testset "Generic.Mat.content" begin - R, t = PolynomialRing(QQ, "t") - S = MatrixSpace(R, 3, 3) + R, t = polynomial_ring(QQ, "t") + S = matrix_space(R, 3, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -1641,7 +1641,7 @@ end m = rand(0:100) n = rand(0:100) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) + S = matrix_space(R, m, n) A = randmat_with_rank(S, rank) r, P, L, U = lu(A) @@ -1656,7 +1656,7 @@ end m = rand(0:30) n = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) + S = matrix_space(R, m, n) A = randmat_with_rank(S, rank, -10:10) r, P, L, U = lu(A) @@ -1666,9 +1666,9 @@ end # Extra tests - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") - S = MatrixSpace(K, 3, 3) + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") + S = matrix_space(K, 3, 3) A = S([a + 1 2a + 3 a^2 + 1; 2a^2 - 1 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -1691,8 +1691,8 @@ end @test r == 2 @test P*A == L*U - R, z = PolynomialRing(ZZ, "z") - F = FractionField(R) + R, z = polynomial_ring(ZZ, "z") + F = fraction_field(R) A = matrix(F, 3, 3, [0, 0, 11, 78*z^3-102*z^2+48*z+12, 92, -16*z^2+80*z-149, -377*z^3+493*z^2-232*z-58, -448, 80*z^2-385*z+719]) @@ -1711,7 +1711,7 @@ end n = rand(0:20) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) + S = matrix_space(R, m, n) A = S() for i = 1:m for j = 1:n @@ -1722,7 +1722,7 @@ end r, d, P, L, U = fflu(A) R2 = parent(1//one(R)) - V = MatrixSpace(R2, m, m) + V = matrix_space(R2, m, m) D = V() if m >= 1 D[1, 1] = 1//L[1, 1] @@ -1739,9 +1739,9 @@ end # Other tests - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") - S = MatrixSpace(K, 3, 3) + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") + S = matrix_space(K, 3, 3) A = S([a + 1 2a + 3 a^2 + 1; 2a^2 - 1 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -1792,42 +1792,42 @@ end end @testset "Generic.Mat.det" begin - S, x = PolynomialRing(ResidueRing(ZZ, 1009*2003), "x") + S, x = polynomial_ring(residue_ring(ZZ, 1009*2003), "x") for dim = 0:5 - R = MatrixSpace(S, dim, dim) + R = matrix_space(S, dim, dim) M = rand(R, -1:5, -100:100) @test det(M) == AbstractAlgebra.det_clow(M) end - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") for dim = 0:5 - R = MatrixSpace(S, dim, dim) + R = matrix_space(S, dim, dim) M = rand(R, -1:3, -20:20) @test det(M) == AbstractAlgebra.det_clow(M) end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") for dim = 0:7 - S = MatrixSpace(K, dim, dim) + S = matrix_space(K, dim, dim) M = rand(S, -100:100) @test det(M) == AbstractAlgebra.det_clow(M) end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") for dim = 0:5 - T = MatrixSpace(S, dim, dim) + T = matrix_space(S, dim, dim) M = rand(T, 0:2, -1:2, -10:10) @test det(M) == AbstractAlgebra.det_clow(M) @@ -1835,9 +1835,9 @@ end end @testset "Generic.Mat.minors" begin - S, z = PolynomialRing(ZZ,"z") + S, z = polynomial_ring(ZZ,"z") n = 5 - R = MatrixSpace(S, n, n) + R = matrix_space(S, n, n) for r = 0:n M = randmat_with_rank(R, r, 0:3, 0:3) @test [1] == minors(M, 0) @@ -1852,7 +1852,7 @@ end end @testset "Generic.Mat.exterior_power" begin - S, z = PolynomialRing(ZZ,"z") + S, z = polynomial_ring(ZZ,"z") n = 5 A = matrix(S, 3, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9]) @test exterior_power(A, 3) == diagonal_matrix(det(A), 1) @@ -1864,7 +1864,7 @@ end @testset "Generic.Mat.pfaffian" begin n = 5 - R, x = PolynomialRing(QQ, ["x$i" for i in 1:binomial(n, 2)]) + R, x = polynomial_ring(QQ, ["x$i" for i in 1:binomial(n, 2)]) pf = [R(1), R(), x[1], R(), x[1]*x[6] - x[2]*x[5] + x[3]*x[4], R()] for dim in 0:5 idx = 0 @@ -1879,15 +1879,15 @@ end end # do a big matrix which uses BFL - R = MatrixSpace(QQ, 12, 12) + R = matrix_space(QQ, 12, 12) M = rand(R, -5:5) M = transpose(M) - M @test det(M) == pfaffian(M)^2 - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") n = 5 for dim = 0:n - R = MatrixSpace(S, dim, dim) + R = matrix_space(S, dim, dim) M = rand(R, -1:5, -5:5) M = transpose(M) - M @test [1] == pfaffians(M, 0) @@ -1903,8 +1903,8 @@ end end @testset "Generic.Mat.rank" begin - S = ResidueRing(ZZ, 20011*10007) - R = MatrixSpace(S, 5, 5) + S = residue_ring(ZZ, 20011*10007) + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -100:100) @@ -1925,14 +1925,14 @@ end end end - S, z = PolynomialRing(ZZ, "z") - R = MatrixSpace(S, 4, 4) + S, z = polynomial_ring(ZZ, "z") + R = matrix_space(S, 4, 4) M = R([S(-2) S(0) S(5) S(3); 5*z^2+5*z-5 S(0) S(-z^2+z) 5*z^2+5*z+1; 2*z-1 S(0) z^2+3*z+2 S(-4*z); 3*z-5 S(0) S(-5*z+5) S(1)]) @test rank(M) == 3 - R = MatrixSpace(S, 5, 5) + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -1:3, -20:20) @@ -1940,15 +1940,15 @@ end @test rank(M) == i end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") - S = MatrixSpace(K, 3, 3) + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") + S = matrix_space(K, 3, 3) M = S([a a^2 + 2*a - 1 2*a^2 - 1*a; 2*a+2 2*a^2 + 2*a (-2*a^2 - 2*a); (-a) (-a^2) a^2]) @test rank(M) == 2 - S = MatrixSpace(K, 5, 5) + S = matrix_space(K, 5, 5) for i = 0:5 M = randmat_with_rank(S, i, -100:100) @@ -1956,9 +1956,9 @@ end @test rank(M) == i end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T = MatrixSpace(S, 3, 3) + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T = matrix_space(S, 3, 3) M = T([(2*x^2)*y^2+(-2*x^2-2*x)*y+(-x^2+2*x) S(0) (-x^2-2)*y^2+(x^2+2*x+2)*y+(2*x^2-x-1); (-x)*y^2+(-x^2+x-1)*y+(x^2-2*x+2) S(0) (2*x^2+x-1)*y^2+(-2*x^2-2*x-2)*y+(x^2-x); @@ -1966,7 +1966,7 @@ end @test rank(M) == 2 - T = MatrixSpace(S, 5, 5) + T = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(T, i, 0:2, -1:2, -20:20) @@ -1984,9 +1984,9 @@ end n = rand(0:30) k = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank, -20:20) if n > 0 && rand(0:1) == 0 col = rand(1:n) @@ -2014,9 +2014,9 @@ end n = rand(0:30) k = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank, -20:20) B = rand(T, -20:20) flag1, X, d = Generic.can_solve_with_solution_fflu(A, B) @@ -2035,9 +2035,9 @@ end n = rand(0:30) k = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank) # randomly zero a column if n > 0 && rand(0:1) == 0 @@ -2062,9 +2062,9 @@ end n = rand(0:30) k = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank, -20:20) X2 = rand(U, -20:20) B = A*X2 @@ -2073,8 +2073,8 @@ end end for dim = 0:5 - S = MatrixSpace(R, dim, dim) - U = MatrixSpace(R, dim, rand(1:5)) + S = matrix_space(R, dim, dim) + U = matrix_space(R, dim, rand(1:5)) M = randmat_with_rank(S, dim, -100:100) b = rand(U, -100:100) @@ -2084,12 +2084,12 @@ end @test flag && M*x == b end - S, y = PolynomialRing(ZZ, "y") - K = FractionField(S) + S, y = polynomial_ring(ZZ, "y") + K = fraction_field(S) for dim = 0:5 - R = MatrixSpace(S, dim, dim) - U = MatrixSpace(S, dim, rand(1:5)) + R = matrix_space(S, dim, dim) + U = matrix_space(S, dim, rand(1:5)) M = randmat_with_rank(R, dim, -1:5, -100:100) b = rand(U, 0:5, -100:100); @@ -2112,9 +2112,9 @@ end n = rand(0:20) k = rand(0:20) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank, -10:10) X2 = rand(U, -10:10) B = A*X2 @@ -2137,9 +2137,9 @@ end n = rand(0:30) k = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank, -20:20) X2 = rand(U, -20:20) B = A*X2 @@ -2156,9 +2156,9 @@ end n = rand(0:30) k = rand(0:30) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, m, k) - U = MatrixSpace(R, n, k) + S = matrix_space(R, m, n) + T = matrix_space(R, m, k) + U = matrix_space(R, n, k) A = randmat_with_rank(S, rank, -20:20) X2 = rand(U, -20:20) B = A*X2 @@ -2166,11 +2166,11 @@ end @test A*X == B*d end - S = ResidueRing(ZZ, 20011*10007) + S = residue_ring(ZZ, 20011*10007) for dim = 0:5 - R = MatrixSpace(S, dim, dim) - U = MatrixSpace(S, dim, rand(1:5)) + R = matrix_space(S, dim, dim) + U = matrix_space(S, dim, rand(1:5)) M = randmat_with_rank(R, dim, -100:100) b = rand(U, -100:100) @@ -2190,14 +2190,14 @@ end end end - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") for iters = 1:100 m = rand(0:5) n = rand(0:5) k = rand(0:5) - R = MatrixSpace(S, m, n) - U = MatrixSpace(S, n, k) + R = matrix_space(S, m, n) + U = matrix_space(S, n, k) rnk = rand(0:min(m, n)) M = randmat_with_rank(R, rnk, -1:3, -20:20) x2 = rand(U, 0:3, -20:20) @@ -2212,12 +2212,12 @@ end @test M*x == d*b end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") for dim = 0:5 - S = MatrixSpace(K, dim, dim) - U = MatrixSpace(K, dim, rand(1:5)) + S = matrix_space(K, dim, dim) + U = matrix_space(K, dim, rand(1:5)) M = randmat_with_rank(S, dim, -100:100) b = rand(U, -100:100) @@ -2227,15 +2227,15 @@ end @test M*x == b end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") for iters = 1:30 m = rand(0:5) n = rand(0:5) k = rand(0:5) - R = MatrixSpace(S, m, n) - U = MatrixSpace(S, n, k) + R = matrix_space(S, m, n) + U = matrix_space(S, n, k) rnk = rand(0:min(m, n)) M = randmat_with_rank(R, rnk, 0:2, -1:2, -20:20) x2 = rand(U, 0:2, -1:2, -20:20) @@ -2250,11 +2250,11 @@ end @test M*x == d*b end - R, t = PolynomialRing(AbstractAlgebra.JuliaQQ, "t") - K, a = NumberField(t^3 + 3t + 1, "a") - S, y = PolynomialRing(K, "y") - T = MatrixSpace(S, 3, 3) - U = MatrixSpace(S, 3, 1) + R, t = polynomial_ring(AbstractAlgebra.JuliaQQ, "t") + K, a = number_field(t^3 + 3t + 1, "a") + S, y = polynomial_ring(K, "y") + T = matrix_space(S, 3, 3) + U = matrix_space(S, 3, 1) M = T([3y*a^2 + (y + 1)*a + 2y (5y+1)*a^2 + 2a + y - 1 a^2 + (-a) + 2y; (y + 1)*a^2 + 2y - 4 3y*a^2 + (2y - 1)*a + y (4y - 1)*a^2 + (y - 1)*a + 5; 2a + y + 1 (2y + 2)*a^2 + 3y*a + 3y a^2 + (-y-1)*a + (-y - 3)]) b = U(permutedims([4y*a^2 + 4y*a + 2y + 1 5y*a^2 + (2y + 1)*a + 6y + 1 (y + 1)*a^2 + 3y*a + 2y + 4], [2, 1])) @@ -2272,8 +2272,8 @@ end n = rand(1:5) c = rand(1:5) - S = MatrixSpace(R, r, n) - U = MatrixSpace(R, n, c) + S = matrix_space(R, r, n) + U = matrix_space(R, n, c) X1 = rand(U, -20:20) M = rand(S, -20:20) @@ -2285,7 +2285,7 @@ end end end end - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter = 1:4 for dim = 0:5 @@ -2293,8 +2293,8 @@ end n = rand(1:5) c = rand(1:5) - S = MatrixSpace(R, r, n) - U = MatrixSpace(R, n, c) + S = matrix_space(R, r, n) + U = matrix_space(R, n, c) X1 = rand(U, -1:2, -10:10) M = rand(S, -1:2, -10:10) @@ -2315,8 +2315,8 @@ end n = rand(1:5) c = rand(1:5) - S = MatrixSpace(R, r, n) - U = MatrixSpace(R, n, c) + S = matrix_space(R, r, n) + U = matrix_space(R, n, c) X1 = rand(S, -20:20) M = rand(U, -20:20) @@ -2329,7 +2329,7 @@ end end end - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter = 1:4 for dim = 0:5 @@ -2337,8 +2337,8 @@ end n = rand(1:5) c = rand(1:5) - S = MatrixSpace(R, r, n) - U = MatrixSpace(R, n, c) + S = matrix_space(R, r, n) + U = matrix_space(R, n, c) X1 = rand(S, -1:2, -10:10) M = rand(U, -1:2, -10:10) @@ -2352,14 +2352,14 @@ end end @testset "Generic.Mat.can_solve" begin - R, x = PolynomialRing(QQ, "x") - S = FractionField(R) + R, x = polynomial_ring(QQ, "x") + S = fraction_field(R) for iter = 1:8 m = rand(0:7) - T = MatrixSpace(R, m, m) - U = MatrixSpace(R, m, m) + T = matrix_space(R, m, m) + U = matrix_space(R, m, m) M = rand(T, -1:2, -10:10) X2 = rand(U, -1:2, -10:10) @@ -2376,13 +2376,13 @@ end @test flag && X*M == b end - R, x = PolynomialRing(GF(65537), "x") - S = FractionField(R) + R, x = polynomial_ring(GF(65537), "x") + S = fraction_field(R) for iters = 1:10 m = rand(1:15) - T = MatrixSpace(R, m, m) - U = MatrixSpace(R, m, m) + T = matrix_space(R, m, m) + U = matrix_space(R, m, m) M = rand(T, 0:2) X2 = rand(U, 0:2) @@ -2415,8 +2415,8 @@ end c = rand(1:5) let - S = MatrixSpace(R, n, r) - U = MatrixSpace(R, c, n) + S = matrix_space(R, n, r) + U = matrix_space(R, c, n) X1 = rand(S, -20:20) M = rand(U, -20:20) @@ -2429,8 +2429,8 @@ end end let - S = MatrixSpace(R, r, n) - U = MatrixSpace(R, n, c) + S = matrix_space(R, r, n) + U = matrix_space(R, n, c) X1 = rand(S, -20:20) M = rand(U, -20:20) @@ -2445,7 +2445,7 @@ end end end - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter = 1:4 for dim = 0:5 @@ -2454,8 +2454,8 @@ end c = rand(1:5) let - S = MatrixSpace(R, n, r) - U = MatrixSpace(R, c, n) + S = matrix_space(R, n, r) + U = matrix_space(R, c, n) X1 = rand(S, -1:2, -10:10) M = rand(U, -1:2, -10:10) @@ -2473,8 +2473,8 @@ end end let - S = MatrixSpace(R, r, n) - U = MatrixSpace(R, n, c) + S = matrix_space(R, r, n) + U = matrix_space(R, n, c) X1 = rand(S, -1:2, -10:10) M = rand(U, -1:2, -10:10) @@ -2533,24 +2533,24 @@ end end @testset "Generic.Mat.can_solve_with_solution_interpolation" begin - R1 = ResidueRing(ZZ, 65537) - R, x = PolynomialRing(R1, "x") - RZ, x = PolynomialRing(ZZ, "x") + R1 = residue_ring(ZZ, 65537) + R, x = polynomial_ring(R1, "x") + RZ, x = polynomial_ring(ZZ, "x") for iters = 1:50 m = rand(0:10) n = rand(0:10) k = rand(0:10) rnk = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) - T = MatrixSpace(R, n, k) - U = MatrixSpace(R, m, k) + S = matrix_space(R, m, n) + T = matrix_space(R, n, k) + U = matrix_space(R, m, k) - S1 = MatrixSpace(RZ, m, n) + S1 = matrix_space(RZ, m, n) MZ = randmat_with_rank(S1, rnk, 0:2, -20:20) M = matrix(R, m, n, [change_base_ring(R1, MZ[i, j]) for i in 1:m for j in 1:n]) - K = FractionField(R) + K = fraction_field(R) MK = change_base_ring(K, M) X2 = rand(T, -1:2, 0:65536) B = M*X2 @@ -2567,12 +2567,12 @@ end end @testset "Generic.Mat.solve_triu" begin - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") for dim = 0:10 - S = MatrixSpace(K, dim, dim) - U = MatrixSpace(K, dim, rand(1:5)) + S = matrix_space(K, dim, dim) + U = matrix_space(K, dim, rand(1:5)) M = randmat_triu(S, -100:100) b = rand(U, -100:100) @@ -2587,8 +2587,8 @@ end for iter = 1:40 n = rand(1:6) m = rand(1:n) - S = MatrixSpace(ZZ, m, n) - U = MatrixSpace(ZZ, 1, n) + S = matrix_space(ZZ, m, n) + U = matrix_space(ZZ, 1, n) M = randmat_with_rank(S, rand(1:m), -20:20) r = rand(U, -20:20) @@ -2604,8 +2604,8 @@ end @testset "Generic.Mat.rref" begin # Non-integral domain - S = ResidueRing(ZZ, 20011*10007) - R = MatrixSpace(S, 5, 5) + S = residue_ring(ZZ, 20011*10007) + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -100:100) @@ -2638,7 +2638,7 @@ end m = rand(0:50) n = rand(0:50) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) + S = matrix_space(R, m, n) M = randmat_with_rank(S, rank, -10:10) r, N, d = rref_rational(M) @@ -2652,8 +2652,8 @@ end end - S, z = PolynomialRing(ZZ, "z") - R = MatrixSpace(S, 5, 5) + S, z = polynomial_ring(ZZ, "z") + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -1:3, -20:20) @@ -2666,9 +2666,9 @@ end # Exact field - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") - S = MatrixSpace(K, 5, 5) + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") + S = matrix_space(K, 5, 5) for i = 0:5 M = randmat_with_rank(S, i, -100:100) @@ -2685,7 +2685,7 @@ end m = rand(0:50) n = rand(0:50) rank = rand(0:min(m, n)) - S = MatrixSpace(R, m, n) + S = matrix_space(R, m, n) M = randmat_with_rank(S, rank) r, N = rref(M) @@ -2695,9 +2695,9 @@ end # Multiple level exact ring - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T = MatrixSpace(S, 5, 5) + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(T, i, 0:2, -1:2, -20:20) @@ -2710,7 +2710,7 @@ end end @testset "Generic.Mat.is_invertible" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") let M = matrix(R, 1, 1, [R(1)]) @@ -2765,8 +2765,8 @@ end for _ in 1:100 m = rand(1:10) n = rand(m:10) - M1 = MatrixSpace(QQ, n, m) - M2 = MatrixSpace(QQ, m, n) + M1 = matrix_space(QQ, n, m) + M2 = matrix_space(QQ, m, n) L_l = randmat_with_rank(M1, m, -10:10) L_r = randmat_with_rank(M2, m, -10:10) @@ -2781,7 +2781,7 @@ end for _ in 1:100 n = rand(1:10) - M = MatrixSpace(QQ, n, n) + M = matrix_space(QQ, n, n) L = randmat_with_rank(M, rand(0:n-1), -10:10) @@ -2794,8 +2794,8 @@ end end @testset "Generic.Mat.nullspace" begin - S = ResidueRing(ZZ, 20011*10007) - R = MatrixSpace(S, 5, 5) + S = residue_ring(ZZ, 20011*10007) + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -100:100) @@ -2822,8 +2822,8 @@ end end end - S, z = PolynomialRing(ZZ, "z") - R = MatrixSpace(S, 5, 5) + S, z = polynomial_ring(ZZ, "z") + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -1:3, -20:20) @@ -2835,9 +2835,9 @@ end @test iszero(M*N) end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") - S = MatrixSpace(K, 5, 5) + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") + S = matrix_space(K, 5, 5) for i = 0:5 M = randmat_with_rank(S, i, -100:100) @@ -2849,9 +2849,9 @@ end @test iszero(M*N) end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T = MatrixSpace(S, 5, 5) + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(T, i, 0:2, -1:2, -20:20) @@ -2865,7 +2865,7 @@ end end @testset "Generic.Mat.kernel" begin - R = MatrixSpace(ZZ, 5, 5) + R = matrix_space(ZZ, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, -20:20) @@ -2883,9 +2883,9 @@ end @test iszero(N*M) end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") - S = MatrixSpace(K, 5, 5) + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") + S = matrix_space(K, 5, 5) for i = 0:5 M = randmat_with_rank(S, i, -100:100) @@ -2903,8 +2903,8 @@ end @test iszero(N*M) end - R, x = PolynomialRing(QQ, "x") - T = MatrixSpace(R, 5, 5) + R, x = polynomial_ring(QQ, "x") + T = matrix_space(R, 5, 5) for i = 0:5 M = randmat_with_rank(T, i, -1:2, -20:20) @@ -2932,9 +2932,9 @@ end n = rand(0:10) k = rand(0:10) - R = MatrixSpace(F, m, n) - S = MatrixSpace(F, m, k) - U = MatrixSpace(F, n, k) + R = matrix_space(F, m, n) + S = matrix_space(F, m, k) + U = matrix_space(F, n, k) # random with solution r = rand(0:min(m, n)) @@ -2981,7 +2981,7 @@ end @testset "Generic.Mat.inversion" begin for dim = 2:5 - R = MatrixSpace(ZZ, dim, dim) + R = matrix_space(ZZ, dim, dim) M = R(1) i = rand(1:dim-1) j = rand(i+1:dim) @@ -3003,10 +3003,10 @@ end @test M*NN == NN*M == cc*R(1) end - S = ResidueRing(ZZ, 20011*10007) + S = residue_ring(ZZ, 20011*10007) for dim = 1:5 - R = MatrixSpace(S, dim, dim) + R = matrix_space(S, dim, dim) M = randmat_with_rank(R, dim, -100:100) @@ -3028,10 +3028,10 @@ end end end - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") for dim = 1:5 - R = MatrixSpace(S, dim, dim) + R = matrix_space(S, dim, dim) M = randmat_with_rank(R, dim, -1:3, -20:20) @@ -3040,11 +3040,11 @@ end @test M*X == d*one(R) end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") for dim = 1:5 - S = MatrixSpace(K, dim, dim) + S = matrix_space(K, dim, dim) M = randmat_with_rank(S, dim, -100:100) @@ -3053,11 +3053,11 @@ end @test M*X == d*one(S) end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") for dim = 1:5 - T = MatrixSpace(S, dim, dim) + T = matrix_space(S, dim, dim) M = randmat_with_rank(T, dim, 0:2, -1:2, -20:20) @@ -3073,11 +3073,11 @@ end end @testset "Generic.Mat.hessenberg" begin - R = ResidueRing(ZZ, 18446744073709551629) + R = residue_ring(ZZ, 18446744073709551629) for dim = 0:5 - S = MatrixSpace(R, dim, dim) - U, x = PolynomialRing(R, "x") + S = matrix_space(R, dim, dim) + U, x = polynomial_ring(R, "x") for i = 1:10 M = rand(S, -5:5) @@ -3095,10 +3095,10 @@ end end @testset "Generic.Mat.kronecker_product" begin - R = ResidueRing(ZZ, 18446744073709551629) - S = MatrixSpace(R, 2, 3) - S2 = MatrixSpace(R, 2, 2) - S3 = MatrixSpace(R, 3, 3) + R = residue_ring(ZZ, 18446744073709551629) + S = matrix_space(R, 2, 3) + S2 = matrix_space(R, 2, 2) + S3 = matrix_space(R, 3, 3) A = S(R.([2 3 5; 9 6 3])) B = S2(R.([2 3; 1 4])) @@ -3109,11 +3109,11 @@ end end @testset "Generic.Mat.charpoly" begin - R = ResidueRing(ZZ, 18446744073709551629) + R = residue_ring(ZZ, 18446744073709551629) for dim = 0:5 - S = MatrixSpace(R, dim, dim) - U, x = PolynomialRing(R, "x") + S = matrix_space(R, dim, dim) + U, x = polynomial_ring(R, "x") for i = 1:10 M = rand(S, -5:5) @@ -3143,9 +3143,9 @@ end end end - R, x = PolynomialRing(ZZ, "x") - U, z = PolynomialRing(R, "z") - T = MatrixSpace(R, 6, 6) + R, x = polynomial_ring(ZZ, "x") + U, z = polynomial_ring(R, "z") + T = matrix_space(R, 6, 6) M = T() for i = 1:3 @@ -3168,7 +3168,7 @@ end @testset "Generic.Mat.minpoly" begin R = GF(103) - T, y = PolynomialRing(R, "y") + T, y = polynomial_ring(R, "y") M = R[92 97 8; 0 5 13; @@ -3177,7 +3177,7 @@ end @test minpoly(T, M) == y^2+96*y+8 R = GF(3) - T, y = PolynomialRing(R, "y") + T, y = polynomial_ring(R, "y") M = R[1 2 0 2; 1 2 1 0; @@ -3187,7 +3187,7 @@ end @test minpoly(T, M) == y^2 + 2y R = GF(13) - T, y = PolynomialRing(R, "y") + T, y = polynomial_ring(R, "y") M = R[7 6 1; 7 7 5; @@ -3220,20 +3220,20 @@ end @test minpoly(T, M) == (y^2+9*y+10)*(y^2+11*y+6)^2 - S = MatrixSpace(R, 1, 1) + S = matrix_space(R, 1, 1) M = S() @test minpoly(T, M) == y - S = MatrixSpace(R, 0, 0) + S = matrix_space(R, 0, 0) M = S() @test minpoly(T, M) == 1 - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - U, z = PolynomialRing(S, "z") - T = MatrixSpace(S, 6, 6) + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + U, z = polynomial_ring(S, "z") + T = matrix_space(S, 6, 6) M = T() for i = 1:3 @@ -3247,9 +3247,9 @@ end @test degree(f) <= 3 - R, x = PolynomialRing(ZZ, "x") - U, z = PolynomialRing(R, "z") - T = MatrixSpace(R, 6, 6) + R, x = polynomial_ring(ZZ, "x") + U, z = polynomial_ring(R, "z") + T = matrix_space(R, 6, 6) M = T() for i = 1:3 @@ -3271,8 +3271,8 @@ end end @testset "Generic.Mat.row_col_swapping" begin - R, x = PolynomialRing(ZZ, "x") - M = MatrixSpace(R, 3, 2) + R, x = polynomial_ring(ZZ, "x") + M = matrix_space(R, 3, 2) a = M(map(R, [1 2; 3 4; 5 6])) @@ -3311,11 +3311,11 @@ end end @testset "Generic.Mat.gen_mat_elem_op" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i in 1:10 r = rand(1:50) c = rand(1:50) - S = MatrixSpace(R, r, c) + S = matrix_space(R, r, c) M = rand(S, -1:3, -100:100) c1, c2 = rand(1:c), rand(1:c) s = rand(-100:100) @@ -3454,15 +3454,15 @@ end end @testset "Generic.Mat.concat" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for i = 1:10 r = rand(0:10) c1 = rand(0:10) c2 = rand(0:10) - S1 = MatrixSpace(R, r, c1) - S2 = MatrixSpace(R, r, c2) + S1 = matrix_space(R, r, c1) + S2 = matrix_space(R, r, c2) M1 = rand(S1, -1:3, -100:100) M2 = rand(S2, -1:3, -100:100) @@ -3512,7 +3512,7 @@ end # Test constructors over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 2, 2) + S = matrix_space(R, 2, 2) M = rand(S, -10:10) N = rand(S, -10:10) @@ -3523,9 +3523,9 @@ end end @testset "Generic.Mat.hnf_minors" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") - M = MatrixSpace(R, 4, 3) + M = matrix_space(R, 4, 3) A = M(map(R, Any[0 0 0; x^3+1 x^2 0; 0 x^2 x^5; x^4+1 x^2 x^5+x^3])) @@ -3538,13 +3538,13 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") - N = MatrixSpace(S, 4, 4) + N = matrix_space(S, 4, 4) B = N(map(S, Any[1 0 a 0; a*y^3 0 3*a^2 0; y^4+a 0 y^2+y 5; y 1 y 2])) @@ -3566,9 +3566,9 @@ end @test is_unit(det(U)) @test U*M == H - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") - M = MatrixSpace(R, 4, 3) + M = matrix_space(R, 4, 3) A = M(map(R, Any[0 0 0; x^3+1 x^2 0; 0 x^2 x^5; x^4+1 x^2 x^5+x^3])) @@ -3581,13 +3581,13 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") - N = MatrixSpace(S, 3, 4) + N = matrix_space(S, 3, 4) B = N(map(S, Any[1 0 a 0; a*y^3 0 3*a^2 0; y^4+a 0 y^2+y 5])) @@ -3624,9 +3624,9 @@ end end @testset "Generic.Mat.hnf_cohen" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") - M = MatrixSpace(R, 4, 3) + M = matrix_space(R, 4, 3) A = M(map(R, Any[0 0 0; x^3+1 x^2 0; 0 x^2 x^5; x^4+1 x^2 x^5+x^3])) @@ -3639,13 +3639,13 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") - N = MatrixSpace(S, 3, 4) + N = matrix_space(S, 3, 4) B = N(map(S, Any[1 0 a 0; a*y^3 0 3*a^2 0; y^4+a 0 y^2+y 5])) @@ -3659,9 +3659,9 @@ end end @testset "Generic.Mat.hnf" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") - M = MatrixSpace(R, 4, 3) + M = matrix_space(R, 4, 3) A = M(map(R, Any[0 0 0; x^3+1 x^2 0; 0 x^2 x^5; x^4+1 x^2 x^5+x^3])) @@ -3674,13 +3674,13 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") - N = MatrixSpace(S, 3, 4) + N = matrix_space(S, 3, 4) B = N(map(S, Any[1 0 a 0; a*y^3 0 3*a^2 0; y^4+a 0 y^2+y 5])) @@ -3694,9 +3694,9 @@ end end @testset "Generic.Mat.snf_kb" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") - M = MatrixSpace(R, 4, 3) + M = matrix_space(R, 4, 3) A = M(map(R, Any[0 0 0; x^3+1 x^2 0; 0 x^2 x^5; x^4+1 x^2 x^5+x^3])) @@ -3710,13 +3710,13 @@ end @test U*A*K == T # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") - N = MatrixSpace(S, 3, 4) + N = matrix_space(S, 3, 4) B = N(map(S, Any[1 0 a 0; a*y^3 0 3*a^2 0; y^4+a 0 y^2+y 5])) @@ -3754,9 +3754,9 @@ end end @testset "Generic.Mat.snf" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") - M = MatrixSpace(R, 4, 3) + M = matrix_space(R, 4, 3) A = M(map(R, Any[0 0 0; x^3+1 x^2 0; 0 x^2 x^5; x^4+1 x^2 x^5+x^3])) @@ -3770,13 +3770,13 @@ end @test U*A*K == T # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") - N = MatrixSpace(S, 3, 4) + N = matrix_space(S, 3, 4) B = N(map(S, Any[1 0 a 0; a*y^3 0 3*a^2 0; y^4+a 0 y^2+y 5])) @@ -3791,7 +3791,7 @@ end end @testset "Generic.Mat.weak_popov" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") A = matrix(R, map(R, Any[1 2 3 x; x 2*x 3*x x^2; x x^2+1 x^3+x^2 x^4+x^2+1])) r = 2 # == rank(A) @@ -3806,7 +3806,7 @@ end F = GF(7) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") B = matrix(S, map(S, Any[ 4*y^2+3*y+5 4*y^2+3*y+4 6*y^2+1; 3*y+6 3*y+5 y+3; 6*y^2+4*y+2 6*y^2 2*y^2+y])) s = 2 # == rank(B) @@ -3822,7 +3822,7 @@ end # some random tests for i in 1:3 - M = MatrixSpace(PolynomialRing(QQ, "x")[1], rand(1:5), rand(1:5)) + M = matrix_space(polynomial_ring(QQ, "x")[1], rand(1:5), rand(1:5)) A = rand(M, -1:5, -5:5) r = rank(A) P = weak_popov(A) @@ -3836,7 +3836,7 @@ end R = GF(randprime(100)) - M = MatrixSpace(PolynomialRing(R, "x")[1], rand(1:5), rand(1:5)) + M = matrix_space(polynomial_ring(R, "x")[1], rand(1:5), rand(1:5)) for i in 1:2 A = rand(M, 1:5) @@ -3850,9 +3850,9 @@ end @test is_unit(det(U)) end - R = ResidueField(ZZ, randprime(100)) + R = residue_field(ZZ, randprime(100)) - M = MatrixSpace(PolynomialRing(R, "x")[1], rand(1:5), rand(1:5)) + M = matrix_space(polynomial_ring(R, "x")[1], rand(1:5), rand(1:5)) for i in 1:2 A = rand(M, -1:5, 0:100) @@ -3868,7 +3868,7 @@ end end @testset "Generic.Mat.popov" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") A = matrix(R, map(R, Any[1 2 3 x; x 2*x 3*x x^2; x x^2+1 x^3+x^2 x^4+x^2+1])) r = 2 # == rank(A) @@ -3893,7 +3893,7 @@ end F = GF(7) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") B = matrix(S, map(S, Any[ 4*y^2+3*y+5 4*y^2+3*y+4 6*y^2+1; 3*y+6 3*y+5 y+3; 6*y^2+4*y+2 6*y^2 2*y^2+y])) s = 2 # == rank(B) @@ -3909,7 +3909,7 @@ end # some random tests for i in 1:3 - M = MatrixSpace(PolynomialRing(QQ, "x")[1], rand(1:5), rand(1:5)) + M = matrix_space(polynomial_ring(QQ, "x")[1], rand(1:5), rand(1:5)) A = rand(M, -1:5, -5:5) r = rank(A) P = popov(A) @@ -3923,7 +3923,7 @@ end R = GF(randprime(100)) - M = MatrixSpace(PolynomialRing(R, "x")[1], rand(1:5), rand(1:5)) + M = matrix_space(polynomial_ring(R, "x")[1], rand(1:5), rand(1:5)) for i in 1:2 A = rand(M, 1:5) @@ -3937,9 +3937,9 @@ end @test is_unit(det(U)) end - R = ResidueField(ZZ, randprime(100)) + R = residue_field(ZZ, randprime(100)) - M = MatrixSpace(PolynomialRing(R, "x")[1], rand(1:5), rand(1:5)) + M = matrix_space(polynomial_ring(R, "x")[1], rand(1:5), rand(1:5)) for i in 1:2 A = rand(M, -1:5, 0:100) @@ -3975,7 +3975,7 @@ end # Test views over noncommutative ring R = MatrixAlgebra(ZZ, 2) - S = MatrixSpace(R, 4, 4) + S = matrix_space(R, 4, 4) M = rand(S, -10:10) @@ -3989,7 +3989,7 @@ end end @testset "Generic.Mat.change_base_ring" begin - for (P, Q, T) in ((MatrixSpace(ZZ, 2, 3), MatrixSpace(ZZ, 3, 2), MatElem), + for (P, Q, T) in ((matrix_space(ZZ, 2, 3), matrix_space(ZZ, 3, 2), MatElem), (MatrixAlgebra(ZZ, 3), MatrixAlgebra(ZZ, 3), MatAlgElem)) M = rand(P, -10:10) N = rand(Q, -10:10) @@ -4013,8 +4013,8 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - U, x = PolynomialRing(R, "x") - S = MatrixSpace(R, 2, 2) + U, x = polynomial_ring(R, "x") + S = matrix_space(R, 2, 2) M = rand(S, -10:10) @@ -4027,8 +4027,8 @@ end u, v = rand(0:9, 2) for (mat, algebra) = ((rand(1:9, u, v), false), (rand(1:9, u, u), true)) - for R = [QQ, ZZ, GF(2), GF(7), PolynomialRing(GF(5), 'x')[1]] - M = algebra ? MatrixAlgebra(R, u) : MatrixSpace(R, u, v) + for R = [QQ, ZZ, GF(2), GF(7), polynomial_ring(GF(5), 'x')[1]] + M = algebra ? MatrixAlgebra(R, u) : matrix_space(R, u, v) m0 = M(mat) for f0 = (x -> x + 1, x -> x*2, x -> one(R), x -> zero(R)) for f = (f0, map_from_func(f0, R, R)) @@ -4044,15 +4044,15 @@ end end end end - m0 = algebra ? MatrixAlgebra(ZZ, u)(mat) : MatrixSpace(ZZ, u, v)(mat) + m0 = algebra ? MatrixAlgebra(ZZ, u)(mat) : matrix_space(ZZ, u, v)(mat) m = deepcopy(m0) - for S = [QQ, ZZ, GF(2), GF(7), PolynomialRing(GF(5), 'x')[1]] + for S = [QQ, ZZ, GF(2), GF(7), polynomial_ring(GF(5), 'x')[1]] for f0 = (x -> S(x), x -> S(x + 1)) for f = (f0, map_from_func(f0, ZZ, S)) n = map_entries(f, m) @test n !== m @test m == m0 # map's input must not be mutated - M = algebra ? MatrixAlgebra(S, u) : MatrixSpace(S, u, v) + M = algebra ? MatrixAlgebra(S, u) : matrix_space(S, u, v) if !isempty(mat) @test n == M(map(f isa Function ? f : f.image_fn, mat)) end @@ -4068,9 +4068,9 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - U, x = PolynomialRing(R, "x") - S = MatrixSpace(R, 2, 2) - T = MatrixSpace(U, 2, 2) + U, x = polynomial_ring(R, "x") + S = matrix_space(R, 2, 2) + T = matrix_space(U, 2, 2) M = rand(S, -10:10) N = rand(T, 0:5, -10:10) @@ -4085,7 +4085,7 @@ end for sim_zero in (similar, zero) test_zero = sim_zero === zero for R = (ZZ, GF(11)) - M = MatrixSpace(R, rand(0:9), rand(0:9)) + M = matrix_space(R, rand(0:9), rand(0:9)) m = R == ZZ ? rand(M, -10:10) : rand(M) n = sim_zero(m) @test !test_zero || iszero(n) @@ -4094,17 +4094,17 @@ end r, c = rand(0:9, 2) n = sim_zero(m, r, c) @test !test_zero || iszero(n) - @test parent(n) == MatrixSpace(R, r, c) + @test parent(n) == matrix_space(R, r, c) @test size(n) == (r, c) for S = [QQ, ZZ, GF(2), GF(5)] n = sim_zero(m, S) @test !test_zero || iszero(n) - @test parent(n) == MatrixSpace(S, size(n)...) + @test parent(n) == matrix_space(S, size(n)...) @test size(n) == (nrows(M), ncols(M)) r, c = rand(0:9, 2) n = sim_zero(m, S, r, c) @test !test_zero || iszero(n) - @test parent(n) == MatrixSpace(S, r, c) + @test parent(n) == matrix_space(S, r, c) @test size(n) == (r, c) end end @@ -4140,7 +4140,7 @@ end @test sprint(show, matrix(ZZ, [3 1 2; 2 0 1])) == "[3 1 2; 2 0 1]" - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") @test sprint(show, matrix(R, [-x-1 -x; 2*x+1 -1])) == "[-x-1 -x; 2*x+1 -1]" @@ -4165,10 +4165,10 @@ end end @testset "Generic.Mat.rand" begin - M = MatrixSpace(ZZ, 2, 3) + M = matrix_space(ZZ, 2, 3) test_rand(M, 1:9) - M = MatrixSpace(GF(7), 3, 2) + M = matrix_space(GF(7), 3, 2) test_rand(M) sp = Random.Sampler(MersenneTwister, M) @@ -4177,13 +4177,13 @@ end @test v isa Vector{elem_type(M)} @test all(x -> parent(x) == M, v) - M = MatrixSpace(F2(), 2, 3) + M = matrix_space(F2(), 2, 3) test_rand(M) end @testset "Generic.Mat.MatSpace_iteration" begin F = GF(2) - M = MatrixSpace(F, 2, 2) + M = matrix_space(F, 2, 2) xs = collect(M) ys = [ [0 0; 0 0], [1 0; 0 0], [0 1; 0 0], [1 1; 0 0], [0 0; 1 0], [1 0; 1 0], [0 1; 1 0], [1 1; 1 0], @@ -4192,7 +4192,7 @@ end @test xs == M.(ys) F = GF(5) - M = MatrixSpace(F, 3, 4) + M = matrix_space(F, 3, 4) xs = collect(Iterators.take(M, 10)) ys = [ [0 0 0 0; 0 0 0 0; 0 0 0 0], [1 0 0 0; 0 0 0 0; 0 0 0 0], [2 0 0 0; 0 0 0 0; 0 0 0 0], [3 0 0 0; 0 0 0 0; 0 0 0 0], diff --git a/test/generic/MatrixAlgebra-test.jl b/test/generic/MatrixAlgebra-test.jl index cfb37121bd..7a0a5da655 100644 --- a/test/generic/MatrixAlgebra-test.jl +++ b/test/generic/MatrixAlgebra-test.jl @@ -15,7 +15,7 @@ function randprime(n::Int) end @testset "Generic.MatAlg.constructors" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) @test MatrixAlgebra(R, 3, cached = false) !== MatrixAlgebra(R, 3, cached = false) @@ -88,7 +88,7 @@ end end @testset "Generic.MatAlg.manipulation" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -146,7 +146,7 @@ end @test degree(A) == 3 # Tests over residue ring - S = MatrixAlgebra(ResidueRing(ZZ, 6), 2) + S = MatrixAlgebra(residue_ring(ZZ, 6), 2) A = S([1 2; 3 4]) B = S([0 0; 3 3]) @test is_zero(A*B) @@ -186,7 +186,7 @@ end end @testset "Generic.MatAlg.size/axes" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -221,7 +221,7 @@ end end @testset "Generic.MatAlg.unary_ops" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -240,7 +240,7 @@ end end @testset "Generic.MatAlg.binary_ops" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -267,7 +267,7 @@ end end @testset "Generic.MatAlg.adhoc_binary" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -321,8 +321,8 @@ end @testset "Generic.MatAlg.promotion" begin m = [1 2; 3 4] - F = ResidueField(ZZ, 3) - R, t = PolynomialRing(F, "t") + F = residue_field(ZZ, 3) + R, t = polynomial_ring(F, "t") A = MatrixAlgebra(R, 2)(m) B = MatrixAlgebra(F, 2)(m) @@ -351,8 +351,8 @@ end # vector * matrix m = [1 2; 3 4] - F = ResidueField(ZZ, 3) - R, t = PolynomialRing(F, "t") + F = residue_field(ZZ, 3) + R, t = polynomial_ring(F, "t") A = MatrixAlgebra(R, 2)(m) B = MatrixAlgebra(F, 2)(m) v = [one(F), 2*one(F)] @@ -368,7 +368,7 @@ end end @testset "Generic.MatAlg.permutation" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -380,7 +380,7 @@ end end @testset "Generic.MatAlg.comparison" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -408,7 +408,7 @@ end end @testset "Generic.MatAlg.adhoc_comparison" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -441,7 +441,7 @@ end end @testset "Generic.MatAlg.powering" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -474,7 +474,7 @@ end end @testset "Generic.MatAlg.adhoc_exact_division" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -486,7 +486,7 @@ end # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - U, x = PolynomialRing(R, "x") + U, x = polynomial_ring(R, "x") S = MatrixAlgebra(R, 2) T = MatrixAlgebra(U, 2) @@ -511,7 +511,7 @@ end end @testset "Generic.MatAlg.transpose" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) arr = [t + 1 t R(1); t^2 t t; t+1 t^2 R(-1)] A = S(arr) @@ -529,7 +529,7 @@ end end @testset "Generic.MatAlg.gram" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -538,7 +538,7 @@ end end @testset "Generic.MatAlg.tr" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -547,7 +547,7 @@ end end @testset "Generic.MatAlg.content" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S = MatrixAlgebra(R, 3) A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1]) @@ -556,8 +556,8 @@ end end @testset "Generic.MatAlg.lu" begin - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") S = MatrixAlgebra(K, 3) A = S([a + 1 2a + 3 a^2 + 1; 2a^2 - 1 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -581,8 +581,8 @@ end @test r == 2 @test P*A == L*U - R, z = PolynomialRing(ZZ, "z") - F = FractionField(R) + R, z = polynomial_ring(ZZ, "z") + F = fraction_field(R) S = MatrixAlgebra(F, 3) A = S([F(0), F(0), F(11), 78*z^3-102*z^2+48*z+12, F(92), -16*z^2+80*z-149, -377*z^3+493*z^2-232*z-58, F(-448), 80*z^2-385*z+719]) @@ -594,8 +594,8 @@ end end @testset "Generic.MatAlg.fflu" begin - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") S = MatrixAlgebra(K, 3) A = S([a + 1 2a + 3 a^2 + 1; 2a^2 - 1 a - 1 2a; a^2 + 3a + 1 2a K(1)]) @@ -648,7 +648,7 @@ end end @testset "Generic.MatAlg.det" begin - S, x = PolynomialRing(ResidueRing(ZZ, 1009*2003), "x") + S, x = polynomial_ring(residue_ring(ZZ, 1009*2003), "x") for dim = 0:5 R = MatrixAlgebra(S, dim) @@ -658,7 +658,7 @@ end @test det(M) == AbstractAlgebra.det_clow(M) end - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") for dim = 0:5 R = MatrixAlgebra(S, dim) @@ -668,8 +668,8 @@ end @test det(M) == AbstractAlgebra.det_clow(M) end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") for dim = 0:7 S = MatrixAlgebra(K, dim) @@ -679,8 +679,8 @@ end @test det(M) == AbstractAlgebra.det_clow(M) end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") for dim = 0:5 T = MatrixAlgebra(S, dim) @@ -703,7 +703,7 @@ end S = MatrixAlgebra(ZZ, 9) (r, c) = (rand(1:9), rand(1:9)) - T = MatrixSpace(ZZ, r, c) + T = matrix_space(ZZ, r, c) a = rand(S, -100:100) b = rand(T, -100:100) startr = rand(1:(9-r+1)) @@ -719,7 +719,7 @@ end S = MatrixAlgebra(ZZ, n) a = rand(S, -100:100) (r, c) = (rand(1:n), rand(1:m)) - T = MatrixSpace(zz, r, c) + T = matrix_space(zz, r, c) b = rand(T, -2:2) startr = rand(1:(n-r+1)) endr = startr + r - 1 @@ -752,7 +752,7 @@ end for R in [zz, ZZ] lr = r isa Colon ? nrows(a) : length(r) lc = c isa Colon ? ncols(a) : length(c) - T = MatrixSpace(zz, lr, lc) + T = matrix_space(zz, lr, lc) b = rand(T, -2:2) aa = deepcopy(a) a[r, c] = b @@ -771,7 +771,7 @@ end for R in [zz, ZZ] lr = r isa Colon ? nrows(a) : length(r) lc = c isa Colon ? ncols(a) : length(c) - T = MatrixSpace(zz, lr, lc) + T = matrix_space(zz, lr, lc) _b = rand(T, -2:2) b = vec(Matrix(_b)) a[r, c] = b @@ -787,7 +787,7 @@ end for R in [zz, ZZ] lr = r isa Colon ? nrows(a) : length(r) lc = c isa Colon ? ncols(a) : length(c) - T = MatrixSpace(zz, lr, lc) + T = matrix_space(zz, lr, lc) _b = rand(T, -2:2) b = vec(Matrix(_b)) a[r, c] = b @@ -800,7 +800,7 @@ end end @testset "Generic.MatAlg.rank" begin - S = ResidueRing(ZZ, 20011*10007) + S = residue_ring(ZZ, 20011*10007) R = MatrixAlgebra(S, 5) for i = 0:5 @@ -823,14 +823,14 @@ end end end - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") R = MatrixAlgebra(S, 4) M = R([S(-2) S(0) S(5) S(3); 5*z^2+5*z-5 S(0) S(-z^2+z) 5*z^2+5*z+1; 2*z-1 S(0) z^2+3*z+2 S(-4*z); 3*z-5 S(0) S(-5*z+5) S(1)]) @test rank(M) == 3 - R = MatrixSpace(S, 5, 5) + R = matrix_space(S, 5, 5) for i = 0:5 M = randmat_with_rank(R, i, 0:3, -20:20) @@ -838,8 +838,8 @@ end @test rank(M) == i end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") S = MatrixAlgebra(K, 3) M = S([a a^2 + 2*a - 1 2*a^2 - 1*a; 2*a+2 2*a^2 + 2*a (-2*a^2 - 2*a); (-a) (-a^2) a^2]) @@ -854,8 +854,8 @@ end @test rank(M) == i end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") T = MatrixAlgebra(S, 3) M = T([(2*x^2)*y^2+(-2*x^2-2*x)*y+(-x^2+2*x) S(0) (-x^2-2)*y^2+(x^2+2*x+2)*y+(2*x^2-x-1); @@ -888,8 +888,8 @@ end @test flag && M*x == b end - S, y = PolynomialRing(ZZ, "y") - K = FractionField(S) + S, y = polynomial_ring(ZZ, "y") + K = fraction_field(S) for dim = 0:5 R = MatrixAlgebra(S, dim) @@ -909,7 +909,7 @@ end end @testset "Generic.MatAlg.rref" begin - S = ResidueRing(ZZ, 20011*10007) + S = residue_ring(ZZ, 20011*10007) R = MatrixAlgebra(S, 5) for i = 0:5 @@ -933,7 +933,7 @@ end end end - S, z = PolynomialRing(ZZ, "z") + S, z = polynomial_ring(ZZ, "z") R = MatrixAlgebra(S, 5) for i = 0:5 @@ -945,8 +945,8 @@ end @test is_rref(A) end - R, x = PolynomialRing(QQ, "x") - K, a = NumberField(x^3 + 3x + 1, "a") + R, x = polynomial_ring(QQ, "x") + K, a = number_field(x^3 + 3x + 1, "a") S = MatrixAlgebra(K, 5) for i = 0:5 @@ -958,8 +958,8 @@ end @test is_rref(A) end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") T = MatrixAlgebra(S, 5) for i = 0:5 @@ -1010,8 +1010,8 @@ end end end - @testset "Matrix Algebra over ResidueRing" begin - S = ResidueRing(ZZ, 20011*10007) + @testset "Matrix Algebra over residue_ring" begin + S = residue_ring(ZZ, 20011*10007) for dim = 1:5 R = MatrixAlgebra(S, dim) @@ -1033,7 +1033,7 @@ end end @testset "Matrix Algebra over ZZ[x]" begin - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") for dim = 2:5 R = MatrixAlgebra(S, dim) @@ -1060,9 +1060,9 @@ end end end - @testset "Matrix Algebra over NumberField over QQ" begin - R, x = PolynomialRing(QQ, "x") - S, a = NumberField(x^3 + 3x + 1, "a") + @testset "Matrix Algebra over number_field over QQ" begin + R, x = polynomial_ring(QQ, "x") + S, a = number_field(x^3 + 3x + 1, "a") for dim = 1:5 R = MatrixAlgebra(S, dim) @@ -1076,8 +1076,8 @@ end end @testset "Matrix Algebra over (ZZ[x])[y]" begin - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") for dim = 2:5 T = MatrixAlgebra(S, dim) @@ -1110,7 +1110,7 @@ end end # of @testset "Generic.MatAlg.inversion" @testset "Generic.MatAlg.hessenberg" begin - R = ResidueRing(ZZ, 18446744073709551629) + R = residue_ring(ZZ, 18446744073709551629) for dim = 0:5 S = MatrixAlgebra(R, dim) @@ -1126,11 +1126,11 @@ end # of @testset "Generic.MatAlg.inversion" end @testset "Generic.MatAlg.charpoly" begin - R = ResidueRing(ZZ, 18446744073709551629) + R = residue_ring(ZZ, 18446744073709551629) for dim = 0:5 - S = MatrixSpace(R, dim, dim) - U, x = PolynomialRing(R, "x") + S = matrix_space(R, dim, dim) + U, x = polynomial_ring(R, "x") for i = 1:10 M = rand(S, -5:5) @@ -1160,9 +1160,9 @@ end end end - R, x = PolynomialRing(ZZ, "x") - U, z = PolynomialRing(R, "z") - T = MatrixSpace(R, 6, 6) + R, x = polynomial_ring(ZZ, "x") + U, z = polynomial_ring(R, "z") + T = matrix_space(R, 6, 6) M = T() for i = 1:3 @@ -1185,7 +1185,7 @@ end @testset "Generic.MatAlg.minpoly" begin R = GF(103) - T, y = PolynomialRing(R, "y") + T, y = polynomial_ring(R, "y") S = MatrixAlgebra(R, 3) M = S([92 97 8; @@ -1195,7 +1195,7 @@ end @test minpoly(T, M) == y^2+96*y+8 R = GF(3) - T, y = PolynomialRing(R, "y") + T, y = polynomial_ring(R, "y") S = MatrixAlgebra(R, 4) M = S([1 2 0 2; @@ -1206,7 +1206,7 @@ end @test minpoly(T, M) == y^2 + 2y R = GF(13) - T, y = PolynomialRing(R, "y") + T, y = polynomial_ring(R, "y") S = MatrixAlgebra(R, 3) M = S([7 6 1; @@ -1253,9 +1253,9 @@ end @test minpoly(T, M) == 1 - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - U, z = PolynomialRing(S, "z") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + U, z = polynomial_ring(S, "z") T = MatrixAlgebra(S, 6) M = T() @@ -1270,8 +1270,8 @@ end @test degree(f) <= 3 - R, x = PolynomialRing(ZZ, "x") - U, z = PolynomialRing(R, "z") + R, x = polynomial_ring(ZZ, "x") + U, z = polynomial_ring(R, "z") T = MatrixAlgebra(R, 6) M = T() @@ -1294,7 +1294,7 @@ end end @testset "Generic.MatAlg.row_swapping" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") M = MatrixAlgebra(R, 3) a = M(map(R, [1 2 3; 4 5 6; 7 8 9])) @@ -1308,7 +1308,7 @@ end if false # see bug 160 @testset "Generic.MatAlg.hnf_minors" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") M = MatrixAlgebra(R, 3) @@ -1323,11 +1323,11 @@ if false # see bug 160 @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") N = MatrixAlgebra(S, 4) @@ -1344,7 +1344,7 @@ if false # see bug 160 end @testset "Generic.MatAlg.hnf_kb" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") M = MatrixAlgebra(R, 3) @@ -1359,11 +1359,11 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") N = MatrixAlgebra(S, 3) @@ -1379,7 +1379,7 @@ end end @testset "Generic.MatAlg.hnf_cohen" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") M = MatrixAlgebra(R, 3) @@ -1394,11 +1394,11 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") N = MatrixAlgebra(S, 3) @@ -1414,7 +1414,7 @@ end end @testset "Generic.MatAlg.hnf" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") M = MatrixAlgebra(R, 3) @@ -1429,11 +1429,11 @@ end @test U*A == H # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") N = MatrixAlgebra(S, 3) @@ -1449,7 +1449,7 @@ end end @testset "Generic.MatAlg.snf_kb" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") M = MatrixAlgebra(R, 3) @@ -1465,11 +1465,11 @@ end @test U*A*K == T # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") N = MatrixAlgebra(S, 3) @@ -1486,7 +1486,7 @@ end end @testset "Generic.MatAlg.snf" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") M = MatrixAlgebra(R, 3) @@ -1502,11 +1502,11 @@ end @test U*A*K == T # Fake up finite field of char 7, degree 2 - R, x = PolynomialRing(GF(7), "x") - F = ResidueField(R, x^2 + 6x + 3) + R, x = polynomial_ring(GF(7), "x") + F = residue_field(R, x^2 + 6x + 3) a = F(x) - S, y = PolynomialRing(F, "y") + S, y = polynomial_ring(F, "y") N = MatrixAlgebra(S, 3) @@ -1563,7 +1563,7 @@ end @testset "Generic.MatAlg.change_base_ring" begin # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - U, x = PolynomialRing(R, "x") + U, x = polynomial_ring(R, "x") S = MatrixAlgebra(R, 2) M = rand(S, -10:10) @@ -1576,7 +1576,7 @@ end @testset "Generic.MatAlg.map" begin # Tests over noncommutative ring R = MatrixAlgebra(ZZ, 2) - U, x = PolynomialRing(R, "x") + U, x = polynomial_ring(R, "x") S = MatrixAlgebra(U, 2) M = rand(R, -10:10) diff --git a/test/generic/Module-test.jl b/test/generic/Module-test.jl index 9c08bb4569..90342e1a1d 100644 --- a/test/generic/Module-test.jl +++ b/test/generic/Module-test.jl @@ -3,7 +3,7 @@ function rand_homomorphism(M::AbstractAlgebra.FPModule{T}, vals...) where T <: R m = ngens(M) R = base_ring(M) F = FreeModule(R, rk) - S = MatrixSpace(R, rk, m) + S = matrix_space(R, rk, m) mat = rand(S, vals...) f = ModuleHomomorphism(F, M, mat) ngens1 = rand(1:3) diff --git a/test/generic/ModuleHomomorphism-test.jl b/test/generic/ModuleHomomorphism-test.jl index 983d3de40d..6f1f304819 100644 --- a/test/generic/ModuleHomomorphism-test.jl +++ b/test/generic/ModuleHomomorphism-test.jl @@ -51,7 +51,7 @@ end m = rand(1:5) F = FreeModule(R, m) - S = MatrixSpace(R, m, ngens(M)) + S = matrix_space(R, m, ngens(M)) f = ModuleHomomorphism(F, M, rand(S, -10:10)) k, h = kernel(f) @@ -115,7 +115,7 @@ end n = ngens(M) R = base_ring(M) - S = MatrixSpace(R, n, n) + S = matrix_space(R, n, n) N = randmat_with_rank(S, n, -10:10) f = ModuleIsomorphism(M, M, N) diff --git a/test/generic/NCPoly-test.jl b/test/generic/NCPoly-test.jl index aaa2306d10..656c12c80f 100644 --- a/test/generic/NCPoly-test.jl +++ b/test/generic/NCPoly-test.jl @@ -1,10 +1,10 @@ @testset "Generic.NCPoly.constructors" begin R = MatrixAlgebra(ZZ, 2) - S1 = PolynomialRing(R, "y") + S1 = polynomial_ring(R, "y") S2 = R["y"] - @test PolynomialRing(R, "y", cached = true)[1] === PolynomialRing(R, "y", cached = true)[1] - @test PolynomialRing(R, "y", cached = true)[1] !== PolynomialRing(R, "y", cached = false)[1] + @test polynomial_ring(R, "y", cached = true)[1] === polynomial_ring(R, "y", cached = true)[1] + @test polynomial_ring(R, "y", cached = true)[1] !== polynomial_ring(R, "y", cached = false)[1] for (S, y) in (S1, S2) @test base_ring(S) === R @@ -23,7 +23,7 @@ @test typeof(S3) == Generic.NCPolyRing{Generic.NCPoly{Generic.MatAlgElem{BigInt}}} S, y = S1 - T, z = PolynomialRing(S, "z") + T, z = polynomial_ring(S, "z") @test typeof(T) <: Generic.NCPolyRing @@ -64,7 +64,7 @@ end @testset "Generic.NCPoly.manipulation" begin R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") @test iszero(zero(S)) @@ -106,7 +106,7 @@ end @testset "Generic.NCPoly.rand" begin R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") test_rand(S, -1:10, -10:10) end @@ -114,7 +114,7 @@ end @testset "Generic.NCPoly.binary_ops" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:100 f = rand(S, -1:10, -10:10) @@ -132,7 +132,7 @@ end @testset "Generic.NCPoly.adhoc_binary" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:500 f = rand(S, -1:10, -10:10) c1 = rand(R, -10:10) @@ -147,8 +147,8 @@ end # Generic tower R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") for iter = 1:100 f = rand(T, -1:5, 0:5, -10:10) c1 = rand(R, -10:10) @@ -178,7 +178,7 @@ end @testset "Generic.NCPoly.comparison" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:500 f = rand(S, -1:10, -10:10) g = deepcopy(f) @@ -193,7 +193,7 @@ end @testset "Generic.NCPoly.adhoc_comparison" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:500 f = rand(S, 0:10, -10:10) c1 = rand(ZZ, -10:10) @@ -214,8 +214,8 @@ end # Generic tower R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") for iter = 1:100 f = rand(T, 0:10, 0:5, -10:10) c1 = rand(ZZ, -10:10) @@ -236,7 +236,7 @@ end @testset "Generic.NCPoly.unary_ops" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:300 f = rand(S, -1:10, -10:10) @@ -248,7 +248,7 @@ end @testset "Generic.NCPoly.truncation" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:300 f = rand(S, -1:10, -10:10) g = rand(S, -1:10, -10:10) @@ -261,7 +261,7 @@ end @testset "Generic.NCPoly.reverse" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:300 f = rand(S, -1:10, -10:10) len = rand(length(f):12) @@ -283,7 +283,7 @@ end @testset "Generic.NCPoly.shift" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:300 f = rand(S, -1:10, -10:10) s = rand(0:10) @@ -298,7 +298,7 @@ end @testset "Generic.NCPoly.powering" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:10 f = rand(S, -1:10, -10:10) @@ -323,7 +323,7 @@ end @testset "Generic.NCPoly.exact_division" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:100 f = rand(S, -1:10, -100:100) @@ -340,7 +340,7 @@ end @testset "Generic.NCPoly.adhoc_exact_division" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter = 1:100 f = rand(S, -1:10, -100:100) @@ -363,8 +363,8 @@ end # Generic tower R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") for iter = 1:100 f = rand(T, -1:10, 0:10, -100:100) @@ -389,7 +389,7 @@ end @testset "Generic.NCPoly.evaluation" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter in 1:10 f = rand(S, -1:4, -10:10) @@ -412,7 +412,7 @@ end @testset "Generic.NCPoly.derivative" begin # Exact ring R = MatrixAlgebra(ZZ, 2) - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") for iter in 1:10 f = rand(S, -1:4, -100:100) diff --git a/test/generic/Poly-test.jl b/test/generic/Poly-test.jl index b22459e879..94f2d21cc7 100644 --- a/test/generic/Poly-test.jl +++ b/test/generic/Poly-test.jl @@ -32,8 +32,8 @@ end S1 = R["y"] S2 = ZZ["x"]["y"] - @test PolynomialRing(R, "y", cached = true)[1] === PolynomialRing(R, "y", cached = true)[1] - @test PolynomialRing(R, "y", cached = true)[1] !== PolynomialRing(R, "y", cached = false)[1] + @test polynomial_ring(R, "y", cached = true)[1] === polynomial_ring(R, "y", cached = true)[1] + @test polynomial_ring(R, "y", cached = true)[1] !== polynomial_ring(R, "y", cached = false)[1] for (S, y) in (S1, S2) @test base_ring(S) === R @@ -49,14 +49,14 @@ end @test isa(y, PolyElem) end - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") @test typeof(S) <: Generic.PolyRing @test isa(y, PolyElem) - T, z = PolynomialRing(S, "z") + T, z = polynomial_ring(S, "z") @test typeof(T) <: Generic.PolyRing @@ -103,7 +103,7 @@ end end @testset "Generic.Poly.iterators" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") C = collect(coefficients(R())) @test C == [] @@ -121,23 +121,23 @@ end @testset "Generic.Poly.conformance" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") test_Poly_interface(R) - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") test_Poly_interface(R) - R, x = PolynomialRing(GF(5), "x") + R, x = polynomial_ring(GF(5), "x") test_Poly_interface(R) end @testset "Generic.Poly.printing" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") @test string(zero(R)) == "0" @test string(one(R)) == "1" @test string(x) == "x" @test string(5*x^5-3*x^3+2*x^2-x+1) == "5*x^5 - 3*x^3 + 2*x^2 - x + 1" - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") @test string(zero(S)) == "0" @test string(one(S)) == "1" @@ -146,7 +146,7 @@ end end @testset "Generic.Poly.rand" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") # TODO: test more than just the result type test_rand(R, -1:10, -10:10) @@ -155,19 +155,19 @@ end test_rand(R, deg, -10:10) end - S, y = PolynomialRing(R, "y") + S, y = polynomial_ring(R, "y") test_rand(S, -1:5, make(R, -1:10, make(ZZ, -10:10))) test_rand(S, -1:5, make(R, -1:10, -10:10)) test_rand(S, -1:5, -1:10, -10:10) - T, z = PolynomialRing(GF(7), "z") + T, z = polynomial_ring(GF(7), "z") test_rand(T, -1:4) end @testset "Generic.Poly.similar" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iters = 1:10 f = rand(R, 0:10, -10:10) @@ -240,7 +240,7 @@ end end @testset "Generic.Poly.zero" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") f = rand(R, 0:10, -10:10) @@ -277,8 +277,8 @@ end end @testset "Generic.Poly.manipulation" begin - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") @test iszero(zero(S)) @test isone(one(S)) @@ -359,7 +359,7 @@ end end @testset "Generic.Poly.is_unit" begin - R, x = PolynomialRing(ResidueRing(ZZ, 4), "x") + R, x = polynomial_ring(residue_ring(ZZ, 4), "x") @test !is_unit(x) @test !is_unit(2*x) @@ -372,7 +372,7 @@ end end @testset "Generic.Poly.deflation" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:1000 f = rand(R, -1:20, -5:5) @@ -395,7 +395,7 @@ end @testset "Generic.Poly.binary_ops" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:100 f = rand(R, -1:10, -10:10) g = rand(R, -1:10, -10:10) @@ -410,10 +410,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:100 f = rand(R, -1:10, 0:1) g = rand(R, -1:10, 0:1) @@ -428,7 +428,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(R, -1:10, -1:1) g = rand(R, -1:10, -1:1) @@ -442,7 +442,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = T["x"] for iter = 1:100 f = rand(R, -1:10, 0:5) @@ -479,10 +479,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:500 f = rand(R, -1:10, 0:1) c1 = rand(ZZ, -10:10) @@ -522,7 +522,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) S, x = R["x"] for iter = 1:500 f = rand(S, -1:10, 0:5) @@ -584,10 +584,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:500 f = rand(R, -1:10, 0:1) g = deepcopy(f) @@ -611,7 +611,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) S, x = R["x"] for iter = 1:500 f = rand(S, -1:10, 0:5) @@ -644,10 +644,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:500 f = rand(R, 0:10, 0:1) c1 = rand(ZZ, -10:10) @@ -683,7 +683,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) S, x = R["x"] for iter = 1:500 f = rand(S, 0:10, 0:5) @@ -728,7 +728,7 @@ end @testset "Generic.Poly.unary_ops" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:300 f = rand(R, -1:10, -10:10) @@ -737,10 +737,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:300 f = rand(R, -1:10, 0:1) @@ -749,7 +749,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:300 f = rand(R, -1:10, -1:1) @@ -758,7 +758,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = T["x"] for iter = 1:300 f = rand(R, -1:10, 0:5) @@ -770,7 +770,7 @@ end @testset "Generic.Poly.truncation" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:300 f = rand(R, -1:10, -10:10) g = rand(R, -1:10, -10:10) @@ -832,10 +832,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:300 f = rand(R, -1:10, 0:1) g = rand(R, -1:10, 0:1) @@ -846,7 +846,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:300 f = rand(R, -1:10, -1:1) g = rand(R, -1:10, -1:1) @@ -856,7 +856,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = T["x"] for iter = 1:300 f = rand(R, -1:10, 0:5) @@ -896,10 +896,10 @@ end @test_throws DomainError reverse(f, -rand(2:100)) # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:300 f = rand(R, -1:10, 0:1) len = rand(length(f):12) @@ -922,7 +922,7 @@ end @test_throws DomainError reverse(f, -rand(2:100)) # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:300 f = rand(R, -1:10, -1:1) len = rand(length(f):12) @@ -945,7 +945,7 @@ end @test_throws DomainError reverse(f, -rand(2:100)) # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = T["x"] for iter = 1:300 f = rand(R, -1:10, 0:5) @@ -989,10 +989,10 @@ end @test_throws DomainError shift_left(f, -rand(2:100)) # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:300 f = rand(R, -1:10, 0:1) s = rand(0:10) @@ -1010,7 +1010,7 @@ end @test_throws DomainError shift_left(f, -rand(2:100)) # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:300 f = rand(R, -1:10, -1:1) s = rand(0:10) @@ -1028,7 +1028,7 @@ end @test_throws DomainError shift_left(f, -rand(2:100)) # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = T["x"] for iter = 1:300 f = rand(R, -1:10, 0:5) @@ -1049,7 +1049,7 @@ end @testset "Generic.Poly.powering" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:10 f = rand(R, -1:10, -10:10) @@ -1071,10 +1071,10 @@ end @test_throws DomainError pow_multinomial(f, -rand(2:100)) # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:10 f = rand(R, -1:10, 0:1) @@ -1096,7 +1096,7 @@ end @test_throws DomainError pow_multinomial(f, -rand(2:100)) # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:10 f = rand(R, -1:10, -1:1) @@ -1121,8 +1121,8 @@ end for iter = 1:10 n = rand(2:26) - Zn = ResidueRing(ZZ, n) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, n) + R, x = polynomial_ring(Zn, "x") f = rand(R, -1:10, 0:n - 1) r2 = one(R) @@ -1146,8 +1146,8 @@ end if false @testset "Generic.Poly.modular_arithmetic" begin # Exact ring - R = ResidueRing(ZZ, 23) - S, x = PolynomialRing(R, "x") + R = residue_ring(ZZ, 23) + S, x = polynomial_ring(R, "x") for iter = 1:100 f = rand(S, -1:5, 0:22) @@ -1184,10 +1184,10 @@ if false end # Fake finite field of char 7, degree 2 - R, y = PolynomialRing(GF(7), "y") - F = ResidueField(R, y^2 + 6y + 3) + R, y = polynomial_ring(GF(7), "y") + F = residue_field(R, y^2 + 6y + 3) a = F(y) - S, x = PolynomialRing(F, "x") + S, x = polynomial_ring(F, "x") for iter = 1:100 f = rand(S, -1:5, 0:1) @@ -1224,7 +1224,7 @@ if false end # Inexact field - S, x = PolynomialRing(RealField, "x") + S, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(S, -1:5, -1:1) @@ -1261,7 +1261,7 @@ if false end # Exact field - R, x = PolynomialRing(QQ, "y") + R, x = polynomial_ring(QQ, "y") for iter = 1:10 f = rand(R, -1:5, -10:10) @@ -1302,7 +1302,7 @@ end @testset "Generic.Poly.exact_division" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:100 f = rand(R, -1:10, -100:100) @@ -1314,10 +1314,10 @@ end @test_throws ArgumentError divexact(x^2, x - 1; check=true) # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:100 f = rand(R, -1:10, 0:1) @@ -1327,7 +1327,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(R, -1:10, -1:1) @@ -1338,8 +1338,8 @@ end # Characteristic p ring n = 23 - Zn = ResidueRing(ZZ, n) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, n) + R, x = polynomial_ring(Zn, "x") for iter = 1:100 f = rand(R, -1:10, 0:n - 1) @@ -1351,7 +1351,7 @@ end @testset "Generic.Poly.adhoc_exact_division" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:100 f = rand(R, -1:10, -100:100) @@ -1373,10 +1373,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter = 1:100 f = rand(R, -1:10, 0:1) @@ -1396,7 +1396,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(R, -1:10, -1:1) @@ -1417,8 +1417,8 @@ end # Characteristic p ring n = 23 - Zn = ResidueRing(ZZ, n) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, n) + R, x = polynomial_ring(Zn, "x") for iter = 1:100 f = rand(R, -1:10, 0:22) @@ -1435,8 +1435,8 @@ end end # Generic tower - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") for iter = 1:100 f = rand(S, -1:10, 0:10, -100:100) @@ -1455,8 +1455,8 @@ end @testset "Generic.Poly.euclidean_division" begin # Exact ring - R = ResidueRing(ZZ, 23) - S, x = PolynomialRing(R, "x") + R = residue_ring(ZZ, 23) + S, x = polynomial_ring(R, "x") for iter = 1:100 f = rand(S, -1:5, 0:22) @@ -1477,10 +1477,10 @@ end end # Fake finite field of char 7, degree 2 - R, y = PolynomialRing(GF(7), "y") - F = ResidueField(R, y^2 + 6y + 3) + R, y = polynomial_ring(GF(7), "y") + F = residue_field(R, y^2 + 6y + 3) a = F(y) - S, x = PolynomialRing(F, "x") + S, x = polynomial_ring(F, "x") for iter = 1:100 f = rand(S, -1:5, 0:1) @@ -1501,7 +1501,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(R, -1:5, -1:1) @@ -1522,7 +1522,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter = 1:100 f = rand(R, -1:5, -10:10) @@ -1545,7 +1545,7 @@ end @testset "Generic.Poly.ad_hoc_euclidean_division" begin # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter = 1:100 f = rand(R, -1:5, -10:10) @@ -1558,7 +1558,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(R, -1:5, -1:1) @@ -1571,8 +1571,8 @@ end end # Residue ring - S = ResidueRing(ZZ, 23) - R, x = PolynomialRing(S, "x") + S = residue_ring(ZZ, 23) + R, x = polynomial_ring(S, "x") for iter = 1:100 f = rand(R, -1:5, 0:22) @@ -1587,7 +1587,7 @@ end @testset "Generic.Poly.pseudodivision" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:100 f = rand(R, -1:5, -10:10) @@ -1605,8 +1605,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter = 1:100 f = rand(R, -1:5, 0:22) @@ -1626,7 +1626,7 @@ end @testset "Generic.Poly.content_primpart_gcd" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:100 f = rand(R, -1:10, -10:10) @@ -1652,7 +1652,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter = 1:100 f = rand(R, -1:5, -10:10) @@ -1691,8 +1691,8 @@ end end # Characteristic p ring - R = ResidueRing(ZZ, 23) - S, x = PolynomialRing(R, "x") + R = residue_ring(ZZ, 23) + S, x = polynomial_ring(R, "x") for iter = 1:100 f = rand(S, -1:10, 0:22) @@ -1720,7 +1720,7 @@ end # Characteristic p field R = GF(23) - S, x = PolynomialRing(R, "x") + S, x = polynomial_ring(R, "x") for iter = 1:100 f = rand(S, -1:10) @@ -1752,7 +1752,7 @@ end @testset "Generic.Poly.evaluation" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, -1:4, -10:10) @@ -1773,7 +1773,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 f = rand(R, -1:4, 0:1) @@ -1794,8 +1794,8 @@ end end # Non-integral domain - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:4, 0:22) @@ -1818,7 +1818,7 @@ end @testset "Generic.Poly.composition" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, -1:5, -10:10) @@ -1829,7 +1829,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 f = rand(R, -1:5, 0:1) @@ -1840,8 +1840,8 @@ end end # Non-integral domain - Zn = ResidueRing(ZZ, 6) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 6) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:5, 0:5) @@ -1854,7 +1854,7 @@ end @testset "Generic.Poly.derivative" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, -1:4, -100:100) @@ -1866,7 +1866,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 f = rand(R, -1:4, 0:1) @@ -1878,8 +1878,8 @@ end end # Non-integral domain - Zn = ResidueRing(ZZ, 6) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 6) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:4, 0:5) @@ -1893,7 +1893,7 @@ end @testset "Generic.Poly.integral" begin # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter in 1:10 f = rand(R, -1:10, -100:100) @@ -1907,8 +1907,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:10, 0:22) @@ -1922,7 +1922,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 f = rand(R, -1:10, 0:1) @@ -1937,7 +1937,7 @@ end end @testset "Generic.Poly.sylvester_matrix" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, 1:5, -10:10) @@ -1962,7 +1962,7 @@ end @testset "Generic.Poly.resultant" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, -1:5, -10:10) @@ -1977,7 +1977,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter in 1:10 f = rand(R, -1:5, -10:10) @@ -1993,8 +1993,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:5, 0:22) @@ -2009,7 +2009,7 @@ end end # Characteristic p field - R, x = PolynomialRing(GF(23), "x") + R, x = polynomial_ring(GF(23), "x") for iter in 1:10 f = rand(R, -1:5) @@ -2024,7 +2024,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 f = rand(R, -1:5, 0:1) @@ -2038,8 +2038,8 @@ end end # Non-integral domain - Zn = ResidueRing(ZZ, 6) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 6) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:5, 0:5) @@ -2055,7 +2055,7 @@ end @testset "Generic.Poly.discriminant" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter = 1:100 f = rand(R, 1:5, -10:10) @@ -2067,7 +2067,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter = 1:100 f = rand(R, 1:10, 0:1) @@ -2080,8 +2080,8 @@ end # TODO: Fix issue #291 # # Non-integral domain -# Zn = ResidueRing(ZZ, 6) -# R, x = PolynomialRing(Zn, "x") +# Zn = residue_ring(ZZ, 6) +# R, x = polynomial_ring(Zn, "x") # # for iter = 1:100 # f = R() @@ -2099,7 +2099,7 @@ end @testset "Generic.Poly.resx" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:100 f = rand(R, 1:5, -10:10) @@ -2116,7 +2116,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter in 1:100 f = rand(R, 1:5, -10:10) @@ -2133,7 +2133,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:100 f = rand(R, 1:5, 0:1) @@ -2150,8 +2150,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:100 f = rand(R, 1:5, 0:22) @@ -2168,7 +2168,7 @@ end end # Characteristic p field - R, x = PolynomialRing(GF(23), "x") + R, x = polynomial_ring(GF(23), "x") for iter in 1:100 f = rand(R, 1:5) @@ -2188,8 +2188,8 @@ end # Test will cause impossible inverse in the mean time # # # Non-integral domain -# Zn = ResidueRing(ZZ, 6) -# R, x = PolynomialRing(Zn, "x") +# Zn = residue_ring(ZZ, 6) +# R, x = polynomial_ring(Zn, "x") # # for iter in 1:100 # f = R() @@ -2213,7 +2213,7 @@ end @testset "Generic.Poly.gcdx" begin # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter in 1:100 f = rand(R, 1:5, -10:10) @@ -2231,8 +2231,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:100 f = rand(R, 1:5, 0:22) @@ -2249,7 +2249,7 @@ end end # Characteristic p field - R, x = PolynomialRing(GF(23), "x") + R, x = polynomial_ring(GF(23), "x") for iter in 1:100 f = rand(R, 1:5) @@ -2266,10 +2266,10 @@ end end # Fake finite field of char 7, degree 2 - S, y = PolynomialRing(GF(7), "y") - F = ResidueField(S, y^2 + 6y + 3) + S, y = polynomial_ring(GF(7), "y") + F = residue_field(S, y^2 + 6y + 3) a = F(y) - R, x = PolynomialRing(F, "x") + R, x = polynomial_ring(F, "x") for iter in 1:100 f = rand(R, 1:5, 0:1) @@ -2289,8 +2289,8 @@ end @testset "Generic.Poly.gcd_gcdx_gcdinv_nonfield" begin for n in (6, 101*103) - Zn = ResidueRing(ZZ, n) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, n) + R, x = polynomial_ring(Zn, "x") for iter in 1:100 a = rand(R, 0:5, 1:n) @@ -2329,7 +2329,7 @@ end @testset "Generic.Poly.newton_representation" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, -1:10, -100:100) @@ -2343,7 +2343,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter in 1:10 f = rand(R, -1:10, -100:100) @@ -2357,7 +2357,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 f = rand(R, -1:10, 0:1) @@ -2371,8 +2371,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:10, 0:22) @@ -2387,7 +2387,7 @@ end # Characteristic p ring K = GF(23) - R, x = PolynomialRing(K, "x") + R, x = polynomial_ring(K, "x") for iter in 1:10 f = rand(R, -1:10) @@ -2401,8 +2401,8 @@ end end # Non-integral domain - Zn = ResidueRing(ZZ, 6) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 6) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 f = rand(R, -1:10, 0:5) @@ -2418,7 +2418,7 @@ end @testset "Generic.Poly.interpolation" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 p = rand(R, 0:10, -10:10) @@ -2432,7 +2432,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iter in 1:10 p = rand(R, 0:10, -10:10) @@ -2446,7 +2446,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for iter in 1:10 p = rand(R, 0:10, 0:1) @@ -2460,8 +2460,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter in 1:10 p = rand(R, 0:10, 0:22) @@ -2476,7 +2476,7 @@ end # Characteristic p field K = GF(23) - R, x = PolynomialRing(K, "x") + R, x = polynomial_ring(K, "x") for iter in 1:10 p = rand(R, 0:10) @@ -2491,8 +2491,8 @@ end # TODO: Fix issue #294 (if possible) # # Non-integral domain -# Zn = ResidueRing(ZZ, 6) -# R, x = PolynomialRing(Zn, "x") +# Zn = residue_ring(ZZ, 6) +# R, x = polynomial_ring(Zn, "x") # # for iter in 1:10 # p = R() @@ -2511,7 +2511,7 @@ end @testset "Generic.Poly.special" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for n in 10:20 T = chebyshev_t(n, x) @@ -2530,7 +2530,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for n in 10:20 T = chebyshev_t(n, x) @@ -2549,7 +2549,7 @@ end end # Inexact field - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") for n in 10:20 T = chebyshev_t(n, x) @@ -2568,8 +2568,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for n in 10:20 T = chebyshev_t(n, x) @@ -2588,7 +2588,7 @@ end end # Characteristic p field - R, x = PolynomialRing(GF(23), "x") + R, x = polynomial_ring(GF(23), "x") for n in 10:20 T = chebyshev_t(n, x) @@ -2607,8 +2607,8 @@ end end # Non-integral domain - Zn = ResidueRing(ZZ, 6) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 6) + R, x = polynomial_ring(Zn, "x") for n in 10:20 T = chebyshev_t(n, x) @@ -2629,9 +2629,9 @@ end @testset "Generic.Poly.mul_karatsuba" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") f = x + y + 2z^2 + 1 @@ -2645,9 +2645,9 @@ end @testset "Generic.Poly.mul_ks" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") - S, y = PolynomialRing(R, "y") - T, z = PolynomialRing(S, "z") + R, x = polynomial_ring(ZZ, "x") + S, y = polynomial_ring(R, "y") + T, z = polynomial_ring(S, "z") f = x + y + 2z^2 + 1 @@ -2657,7 +2657,7 @@ end @testset "Generic.Poly.remove_valuation" begin # Exact ring - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") @test_throws ErrorException remove(R(1), R(0)) @test_throws ErrorException remove(R(1), R(-1)) @@ -2702,7 +2702,7 @@ end end # Exact field - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") @test_throws ErrorException remove(R(1), R(0)) @test_throws ErrorException remove(R(1), R(1)) @@ -2744,8 +2744,8 @@ end end # Characteristic p ring - Zn = ResidueRing(ZZ, 23) - R, x = PolynomialRing(Zn, "x") + Zn = residue_ring(ZZ, 23) + R, x = polynomial_ring(Zn, "x") for iter = 1:10 d = true @@ -2783,7 +2783,7 @@ end end # Characteristic p field - R, x = PolynomialRing(GF(23), "x") + R, x = polynomial_ring(GF(23), "x") for iter = 1:10 d = true @@ -2822,7 +2822,7 @@ end @testset "Generic.Poly.square_root" begin # Exact ring - S, x = PolynomialRing(ZZ, "x") + S, x = polynomial_ring(ZZ, "x") for iter = 1:10 f = rand(S, -1:20, -20:20) @@ -2848,7 +2848,7 @@ end end # Exact field - S, x = PolynomialRing(QQ, "x") + S, x = polynomial_ring(QQ, "x") for iter = 1:10 f = rand(S, -1:20, -20:20) @@ -2884,9 +2884,9 @@ end # Characteristic p field for p in [2, 7, 19, 65537, ZZ(2), ZZ(7), ZZ(19), ZZ(65537)] - R = ResidueField(ZZ, p) + R = residue_field(ZZ, p) - S, x = PolynomialRing(R, "x") + S, x = polynomial_ring(R, "x") for iter = 1:10 f = rand(S, -1:20, 0:Int(p)) @@ -2915,7 +2915,7 @@ end end @testset "Generic.Poly.generic_eval" begin - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iter in 1:10 f = rand(R, -1:2, -100:100) @@ -2925,7 +2925,7 @@ end @test f(g(h)) == f(g)(h) end - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") f = x b = a = QQ(13) @@ -2939,7 +2939,7 @@ end end @testset "Generic.Poly.change_base_ring" begin - Zx, x = PolynomialRing(ZZ,'x') + Zx, x = polynomial_ring(ZZ,'x') @test 1 == map_coefficients(sqrt, x^0) p = Zx([i for i in 1:10]) q = Zx([i for i in 10:-1:1]) @@ -2964,7 +2964,7 @@ end end F = GF(11) - P, y = PolynomialRing(F, 'x') + P, y = polynomial_ring(F, 'x') @test map_coefficients(t -> F(t) + 2, f) == 3y^2 + 5y^3 + 4y^6 end @@ -2975,7 +2975,7 @@ end end @testset "Generic.Poly.polynomial_to_power_sums" begin - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") for iters = 1:100 f = rand(R, 0:10, -10:10) @@ -2995,7 +2995,7 @@ end @test collect(Base.Iterators.take(V, d)) == collect(Base.Iterators.take(W, d)) end - R, x = PolynomialRing(ZZ, "x") + R, x = polynomial_ring(ZZ, "x") for iters = 1:100 f = rand(R, 0:10, -10:10) diff --git a/test/generic/PuiseuxSeries-test.jl b/test/generic/PuiseuxSeries-test.jl index 8380b63490..9e61b79c37 100644 --- a/test/generic/PuiseuxSeries-test.jl +++ b/test/generic/PuiseuxSeries-test.jl @@ -19,7 +19,7 @@ @testset "Generic.PuiseuxSeries.constructors" begin R, x = PuiseuxSeriesRing(ZZ, 30, "x") - S, t = PolynomialRing(QQ, "t") + S, t = polynomial_ring(QQ, "t") T, y = PuiseuxSeriesRing(S, 30, "y") @test PuiseuxSeriesRing(S, 30, "y", cached = true)[1] === PuiseuxSeriesRing(S, 30, "y", cached = true)[1] @@ -113,7 +113,7 @@ end end @testset "Generic.PuiseuxSeries.manipulation" begin - R, t = PolynomialRing(QQ, "t") + R, t = polynomial_ring(QQ, "t") S, x = PuiseuxSeriesRing(R, 30, "x") @test max_precision(S) == 30 @@ -145,7 +145,7 @@ end @test characteristic(S) == 0 - T = ResidueRing(ZZ, 7) + T = residue_ring(ZZ, 7) U, y = PuiseuxSeriesRing(T, 10, "y") @test modulus(T) == 7 @@ -174,7 +174,7 @@ end end @testset "Generic.PuiseuxSeries.change_base_ring" begin - Zx, x = LaurentSeriesRing(ZZ, 10, "x") + Zx, x = laurent_series_ring(ZZ, 10, "x") @test 1 == map_coefficients(sqrt, x^0) lp = Zx(BigInt[i for i in 1:10], 10, 11, 5, 1) lq = Zx(BigInt[i for i in 10:-1:1], 10, 11, 5, 1) @@ -227,7 +227,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = PuiseuxSeriesRing(T, 10, "x") for iter = 1:300 f = rand(R, -12:12, 1:6, 0:5) @@ -270,7 +270,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = PuiseuxSeriesRing(T, 10, "x") for iter = 1:100 f = rand(R, -12:12, 1:6, 0:5) @@ -339,7 +339,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) S, x = PuiseuxSeriesRing(R, 10, "x") for iter = 1:500 f = rand(S, -12:12, 1:6, 0:5) @@ -421,7 +421,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) S, x = PuiseuxSeriesRing(R, 10, "x") for iter = 1:500 f = rand(S, -12:12, 1:6, 0:5) @@ -484,7 +484,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) + R = residue_ring(ZZ, 6) S, x = PuiseuxSeriesRing(R, 10, "x") for iter = 1:500 f = S() @@ -572,7 +572,7 @@ end for iter = 1:100 n = rand(2:26) - Zn = ResidueRing(ZZ, n) + Zn = residue_ring(ZZ, n) R, x = PuiseuxSeriesRing(Zn, 10, "x") f = rand(R, -12:12, 1:6, 0:n - 1) @@ -612,7 +612,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = PuiseuxSeriesRing(T, 10, "x") for iter = 1:300 f = R() @@ -666,7 +666,7 @@ end # Characteristic p field for p in [2, 7, 19, 65537, ZZ(7), ZZ(19), ZZ(65537)] - R = ResidueField(ZZ, p) + R = residue_field(ZZ, p) S, x = PuiseuxSeriesField(R, 10, "x") @@ -691,8 +691,8 @@ end end end - R = ResidueField(ZZ, 2) - T, y = PolynomialRing(R, "x") + R = residue_field(ZZ, 2) + T, y = polynomial_ring(R, "x") S, x = PuiseuxSeriesRing(T, 10, "x") @@ -732,7 +732,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = PuiseuxSeriesRing(T, 10, "x") for iter = 1:300 s = rand(0:12) @@ -772,7 +772,7 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) + T = residue_ring(ZZ, 6) R, x = PuiseuxSeriesRing(T, 10, "x") for iter = 1:300 f = rand(R, -12:12, 1:6, 0:5) @@ -811,7 +811,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 143) + R = residue_ring(ZZ, 143) S, x = PuiseuxSeriesRing(R, 5, "x") for iter = 1:100 @@ -882,7 +882,7 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 143) + R = residue_ring(ZZ, 143) S, x = PuiseuxSeriesRing(R, 5, "x") for iter = 1:10 diff --git a/test/generic/RationalFunctionField-test.jl b/test/generic/RationalFunctionField-test.jl index ad46b0dac5..820254d368 100644 --- a/test/generic/RationalFunctionField-test.jl +++ b/test/generic/RationalFunctionField-test.jl @@ -443,7 +443,7 @@ end @testset "Generic.RationalFunctionField.evaluate" begin # Univariate - R, x = PolynomialRing(QQ, "x") + R, x = polynomial_ring(QQ, "x") f = (x^2 + 2)//(x + 1) @@ -451,7 +451,7 @@ end @test evaluate(f, QQ(2)) == 2 # Multivariate - R, (x, y) = PolynomialRing(QQ, ["x", "y"]) + R, (x, y) = polynomial_ring(QQ, ["x", "y"]) f = (x^2 + 2)//(y + 1) diff --git a/test/generic/RelSeries-test.jl b/test/generic/RelSeries-test.jl index fe1e33d421..089e383daa 100644 --- a/test/generic/RelSeries-test.jl +++ b/test/generic/RelSeries-test.jl @@ -28,13 +28,13 @@ end @test S1 !== S2 @test isa(S1, Generic.RelSeriesRing) - R, x = PowerSeriesRing(ZZ, 30, "x") + R, x = power_series_ring(ZZ, 30, "x") - S, t = PolynomialRing(QQ, "t") - T, y = PowerSeriesRing(S, 30, "y") + S, t = polynomial_ring(QQ, "t") + T, y = power_series_ring(S, 30, "y") - @test PowerSeriesRing(S, 30, "y", cached = true)[1] === PowerSeriesRing(S, 30, "y", cached = true)[1] - @test PowerSeriesRing(S, 30, "y", cached = false)[1] !== PowerSeriesRing(S, 30, "y", cached = true)[1] + @test power_series_ring(S, 30, "y", cached = true)[1] === power_series_ring(S, 30, "y", cached = true)[1] + @test power_series_ring(S, 30, "y", cached = false)[1] !== power_series_ring(S, 30, "y", cached = true)[1] @test elem_type(R) == Generic.RelSeries{BigInt} @test elem_type(Generic.RelSeriesRing{BigInt}) == Generic.RelSeries{BigInt} @@ -99,14 +99,14 @@ end end @testset "Generic.RelSeries.rand" begin - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") test_rand(R, 0:12, -10:10) end @testset "Generic.RelSeries.manipulation" begin - R, t = PolynomialRing(QQ, "t") - S, x = PowerSeriesRing(R, 30, "x") + R, t = polynomial_ring(QQ, "t") + S, x = power_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -143,14 +143,14 @@ end @test characteristic(S) == 0 - T = ResidueRing(ZZ, 7) - U, y = PowerSeriesRing(T, 10, "y") + T = residue_ring(ZZ, 7) + U, y = power_series_ring(T, 10, "y") @test modulus(T) == 7 end @testset "Generic.RelSeries.similar" begin - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iters = 1:10 f = rand(R, 0:10, -10:10) @@ -241,7 +241,7 @@ end @testset "Generic.RelSeries.unary_ops" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, 0:12, -10:10) @@ -250,7 +250,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f = rand(R, 0:12, -1:1) @@ -259,8 +259,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, 0:12, 0:5) @@ -271,7 +271,7 @@ end @testset "Generic.RelSeries.binary_ops" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:100 f = rand(R, 0:12, -10:10) g = rand(R, 0:12, -10:10) @@ -287,7 +287,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:100 f = rand(R, 0:12, -1:1) g = rand(R, 0:12, -1:1) @@ -302,8 +302,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:100 f = rand(R, 0:12, 0:5) g = rand(R, 0:12, 0:5) @@ -320,7 +320,7 @@ end @testset "Generic.RelSeries.adhoc_binary_ops" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:500 f = rand(R, 0:12, -10:10) c1 = rand(ZZ, -10:10) @@ -340,7 +340,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:500 f = rand(R, 0:12, -1:1) c1 = rand(ZZ, -10:10) @@ -360,8 +360,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = PowerSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 6) + S, x = power_series_ring(R, 10, "x") for iter = 1:500 f = rand(S, 0:12, 0:5) c1 = rand(ZZ, -10:10) @@ -388,7 +388,7 @@ end # Generic tower R, x = ZZ["x"] - S, y = PowerSeriesRing(R, 10, "y") + S, y = power_series_ring(R, 10, "y") for iter = 1:100 f = rand(S, 0:12, 0:5, -10:10) c1 = rand(ZZ, -10:10) @@ -410,7 +410,7 @@ end @testset "Generic.RelSeries.comparison" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:500 f = rand(R, 0:12, -10:10) g = deepcopy(f) @@ -426,7 +426,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:500 f = rand(R, 0:12, -1:1) g = deepcopy(f) @@ -442,8 +442,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = PowerSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 6) + S, x = power_series_ring(R, 10, "x") for iter = 1:500 f = rand(S, 0:12, 0:5) g = deepcopy(f) @@ -461,7 +461,7 @@ end @testset "Generic.RelSeries.adhoc_comparison" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:500 f = R() while f == 0 @@ -483,7 +483,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:500 f = R() while isapprox(f, R()) @@ -505,8 +505,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 6) - S, x = PowerSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 6) + S, x = power_series_ring(R, 10, "x") for iter = 1:500 f = S() while f == 0 @@ -534,7 +534,7 @@ end # Generic tower R, x = ZZ["x"] - S, y = PowerSeriesRing(R, 10, "y") + S, y = power_series_ring(R, 10, "y") for iter = 1:100 f = S() while f == 0 @@ -558,7 +558,7 @@ end @testset "Generic.RelSeries.powering" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:100 f = rand(R, 0:12, -10:10) @@ -578,7 +578,7 @@ end @test_throws DomainError f^-rand(2:100) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:100 f = rand(R, 0:12, -1:1) @@ -601,8 +601,8 @@ end for iter = 1:100 n = rand(2:26) - Zn = ResidueRing(ZZ, n) - R, x = PowerSeriesRing(Zn, 10, "x") + Zn = residue_ring(ZZ, n) + R, x = power_series_ring(Zn, 10, "x") f = rand(R, 0:12, 0:n - 1) r2 = R(1) @@ -617,8 +617,8 @@ end end # regression test (see #931) - Zn = ResidueRing(ZZ, 2) - R, x = PowerSeriesRing(Zn, 10, "x") + Zn = residue_ring(ZZ, 2) + R, x = power_series_ring(Zn, 10, "x") f = O(x^2) @test isequal(f^0, 1 + O(x^10)) @@ -627,8 +627,8 @@ end @test_throws DomainError f^-rand(2:100) # regression test (see #967) - Zn = ResidueRing(ZZ, 4) - R, x = PowerSeriesRing(Zn, 5, "x") + Zn = residue_ring(ZZ, 4) + R, x = power_series_ring(Zn, 5, "x") f = 2*x^6 + O(x^11) @test isequal(f*f, f^2) @@ -637,7 +637,7 @@ end @testset "Generic.RelSeries.shift" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, 0:12, -10:10) s = rand(0:12) @@ -657,7 +657,7 @@ end @test_throws DomainError shift_right(f, -rand(2:100)) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f = rand(R, 0:12, -1:1) s = rand(0:12) @@ -677,8 +677,8 @@ end @test_throws DomainError shift_right(f, -rand(2:100)) # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, 0:12, 0:5) s = rand(0:12) @@ -700,7 +700,7 @@ end @testset "Generic.RelSeries.truncation" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, 0:12, -10:10) s = rand(0:12) @@ -715,7 +715,7 @@ end @test_throws DomainError truncate(f, -rand(2:100)) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f = rand(R, 0:12, -1:1) s = rand(0:12) @@ -730,8 +730,8 @@ end @test_throws DomainError truncate(f, -rand(2:100)) # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, 0:12, 0:5) s = rand(0:12) @@ -748,7 +748,7 @@ end @testset "Generic.RelSeries.inversion" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = R() while !is_unit(f) @@ -760,7 +760,7 @@ end # Exact field for prec = 1:10 - R, x = PowerSeriesRing(QQ, prec, "x") + R, x = power_series_ring(QQ, prec, "x") for iter = 1:30 f = R() while valuation(f) != 0 @@ -772,7 +772,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f = R() while coeff(f, 0) == 0 @@ -783,8 +783,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 f = R() while !is_unit(f) @@ -797,7 +797,7 @@ end @testset "Generic.RelSeries.compose" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -810,7 +810,7 @@ end @test compose(R(), g) == R() end - S, y = PowerSeriesRing(ZZ, 10, "y") + S, y = power_series_ring(ZZ, 10, "y") for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -822,7 +822,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -835,7 +835,7 @@ end @test isapprox(compose(R(), g), R()) end - S, y = PowerSeriesRing(RealField, 10, "y") + S, y = power_series_ring(RealField, 10, "y") for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -846,8 +846,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -860,7 +860,7 @@ end @test compose(R(), g) == R() end - S, y = PowerSeriesRing(T, 10, "y") + S, y = power_series_ring(T, 10, "y") for iter = 1:300 f1 = rand(R, 0:10, -10:10) f2 = rand(R, 0:10, -10:10) @@ -874,7 +874,7 @@ end @testset "Generic.RelSeries.square_root" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, 0:10, -10:10) g = f^2 @@ -901,7 +901,7 @@ end @test_throws ErrorException sqrt(f) # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f = rand(R, 0:10, -1:1) g = f^2 @@ -926,9 +926,9 @@ end # Characteristic p field for p in [2, 7, 19, 65537, ZZ(2), ZZ(7), ZZ(19), ZZ(65537)] - R = ResidueField(ZZ, p) + R = residue_field(ZZ, p) - S, x = PowerSeriesRing(R, 10, "x") + S, x = power_series_ring(R, 10, "x") for iter = 1:10 f = rand(S, 0:10, 0:Int(p)) @@ -955,10 +955,10 @@ end end end - R = ResidueField(ZZ, 2) - T, y = PolynomialRing(R, "x") + R = residue_field(ZZ, 2) + T, y = polynomial_ring(R, "x") - S, x = PowerSeriesRing(T, 10, "x") + S, x = power_series_ring(T, 10, "x") f = 1 + y^2*x^2 + (y^2 + y + 1)*x^4 + O(x^10) @@ -975,7 +975,7 @@ end @testset "Generic.RelSeries.exact_division" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 s = rand(0:12) f = rand(R, s:s, -10:10) @@ -991,7 +991,7 @@ end end # Exact field - R, x = PowerSeriesRing(QQ, 10, "x") + R, x = power_series_ring(QQ, 10, "x") for iter = 1:300 s = rand(0:12) f = rand(R, s:s, -10:10) @@ -1007,7 +1007,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 s = rand(0:12) f = rand(R, s:s, -1:1) @@ -1023,8 +1023,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 s = rand(0:12) f = rand(R, s:s, 0:5) @@ -1042,7 +1042,7 @@ end @testset "Generic.RelSeries.adhoc_exact_division" begin # Exact field - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, 0:12, -10:10) c = ZZ() @@ -1054,7 +1054,7 @@ end end # Inexact field - R, x = PowerSeriesRing(RealField, 10, "x") + R, x = power_series_ring(RealField, 10, "x") for iter = 1:300 f = rand(R, 0:12, -1:1) c = RealField() @@ -1066,8 +1066,8 @@ end end # Non-integral domain - T = ResidueRing(ZZ, 6) - R, x = PowerSeriesRing(T, 10, "x") + T = residue_ring(ZZ, 6) + R, x = power_series_ring(T, 10, "x") for iter = 1:300 f = rand(R, 0:12, 0:5) c = T() @@ -1081,7 +1081,7 @@ end @testset "Generic.RelSeries.derivative_integral" begin # Exact field - S, x = PowerSeriesRing(QQ, 10, "x") + S, x = power_series_ring(QQ, 10, "x") for iter = 1:100 f = rand(S, 0:10, -10:10) @@ -1093,7 +1093,7 @@ end end # Inexact field - S, x = PowerSeriesRing(RealField, 10, "x") + S, x = power_series_ring(RealField, 10, "x") for iter = 1:100 f = rand(S, 0:10, -10:10) @@ -1107,7 +1107,7 @@ end @testset "Generic.RelSeries.special_functions" begin # Exact field - S, x = PowerSeriesRing(QQ, 10, "x") + S, x = power_series_ring(QQ, 10, "x") for iter = 1:100 @test exp(x + O(x^iter)) == exp(x + O(x^(iter - 1))) @@ -1136,8 +1136,8 @@ end # Exact Ring - R, t = PolynomialRing(QQ, "t") - S, x = PowerSeriesRing(R, 10, "x") + R, t = polynomial_ring(QQ, "t") + S, x = power_series_ring(R, 10, "x") c = exp(x + O(x^10)) @@ -1145,7 +1145,7 @@ end 1//720*x^6 + 1//5040*x^7 + 1//40320*x^8 + 1//362880*x^9 + O(x^10)) # Inexact field - S, x = PowerSeriesRing(RealField, 10, "x") + S, x = power_series_ring(RealField, 10, "x") for iter = 1:100 @test isapprox(exp(x + O(x^iter)), exp(x + O(x^(iter - 1)))) @@ -1177,8 +1177,8 @@ end end # Non-integral domain - R = ResidueRing(ZZ, 143) - S, x = PowerSeriesRing(R, 10, "x") + R = residue_ring(ZZ, 143) + S, x = power_series_ring(R, 10, "x") for iter = 1:10 @test exp(x + O(x^iter)) == exp(x + O(x^(iter - 1))) @@ -1199,7 +1199,7 @@ end end @testset "Generic.RelSeries.change_base_ring" begin - Zx, x = PowerSeriesRing(ZZ, 10, "x") + Zx, x = power_series_ring(ZZ, 10, "x") @test 1 == map_coefficients(sqrt, x^0) p = Zx([i for i in 1:10], 10, 11, 5) q = Zx([i for i in 10:-1:1], 10, 11, 5) @@ -1224,13 +1224,13 @@ end end F = GF(11) - P, y = PowerSeriesRing(F, 10, "x") + P, y = power_series_ring(F, 10, "x") @test map_coefficients(t -> F(t) + 2, f) == 3y^2 + 5y^3 + 4y^6 end @testset "Generic.RelSeries.unsafe_operators" begin # Exact ring - R, x = PowerSeriesRing(ZZ, 10, "x") + R, x = power_series_ring(ZZ, 10, "x") for iter = 1:300 f = rand(R, 0:9, -10:10) diff --git a/test/generic/Residue-test.jl b/test/generic/Residue-test.jl index 82866639ec..d98b549f21 100644 --- a/test/generic/Residue-test.jl +++ b/test/generic/Residue-test.jl @@ -7,28 +7,28 @@ function test_elem(R::AbstractAlgebra.Generic.ResRing{AbstractAlgebra.Generic.Po end @testset "Generic.Res.conformance_tests" begin - test_Ring_interface(ResidueRing(ZZ, 1)) # is_gen fails on polys - test_Ring_interface_recursive(ResidueRing(ZZ, -4)) + test_Ring_interface(residue_ring(ZZ, 1)) # is_gen fails on polys + test_Ring_interface_recursive(residue_ring(ZZ, -4)) # - R = ResidueRing(ZZ, 16453889) + R = residue_ring(ZZ, 16453889) test_Ring_interface_recursive(R) # - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) test_Ring_interface_recursive(T) # - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) #test_Ring_interface_recursive(T) # TODO: currently fails because `inv(one(T))` fails end @testset "Generic.Res.constructors" begin B = ZZ - R = Generic.ResidueRing(B, 16453889) + R = Generic.residue_ring(B, 16453889) S, f1 = quo(B, 16453889) U, f2 = quo(B, 16453889; cached=false) @@ -44,10 +44,10 @@ end @test f1(c1) == S(c1) @test f2(c1) == S(c1) - @test Generic.ResidueRing(B, 16453889, cached = true) === Generic.ResidueRing(B, 16453889, cached = true) - @test Generic.ResidueRing(B, 16453889, cached = false) !== Generic.ResidueRing(B, 16453889, cached = true) + @test Generic.residue_ring(B, 16453889, cached = true) === Generic.residue_ring(B, 16453889, cached = true) + @test Generic.residue_ring(B, 16453889, cached = false) !== Generic.residue_ring(B, 16453889, cached = true) - @test_throws DomainError Generic.ResidueRing(B, 0) + @test_throws DomainError Generic.residue_ring(B, 0) @test elem_type(R) == Generic.Res{elem_type(B)} @test elem_type(Generic.ResRing{elem_type(B)}) == Generic.Res{elem_type(B)} @@ -71,8 +71,8 @@ end @test isa(d, Generic.Res) - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) @test isa(T, Generic.ResRing) @@ -85,8 +85,8 @@ end @test isa(g, Generic.Res) # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) @test isa(T, Generic.ResRing) @@ -106,7 +106,7 @@ end @test isa(k, Generic.Res) - S = Generic.ResidueRing(B, 164538890) + S = Generic.residue_ring(B, 164538890) x = R(1) y = S(1) @test x in [x, y] @@ -118,21 +118,21 @@ end end @testset "Generic.Res.rand" begin - R = Generic.ResidueRing(ZZ, 49) + R = Generic.residue_ring(ZZ, 49) test_rand(R, 1:9) do f @test 1 <= f.data <= 9 end # make with 3 arguments - P, x = PolynomialRing(RealField, "x") - R = Generic.ResidueRing(P, x^3) + P, x = polynomial_ring(RealField, "x") + R = Generic.residue_ring(P, x^3) test_rand(R, -1:9, -3:3) end @testset "Generic.Res.manipulation" begin - R = Generic.ResidueRing(ZZ, 16453889) + R = Generic.residue_ring(ZZ, 16453889) @test modulus(R) == 16453889 @@ -142,8 +142,8 @@ end @test modulus(g) == 16453889 - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) h = one(T) @@ -166,8 +166,8 @@ end @test characteristic(R) == 16453889 # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) @test isone(one(T)) @test iszero(zero(T)) @@ -175,31 +175,31 @@ end @test canonical_unit(T(x)) == T(x) @test modulus(T) == x^2 + 1 - S = ResidueRing(zz, 23) + S = residue_ring(zz, 23) @test lift(S(1)) == 1 @test isa(lift(S(1)), BigInt) end @testset "Generic.Res.unary_ops" begin - R = Generic.ResidueRing(ZZ, 16453889) + R = Generic.residue_ring(ZZ, 16453889) @test -R(12345) == R(16441544) - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) @test -T(x^5 + 1) == T(x^2+16453880*x+16453885) # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) @test -T(x + 1) == T(-x - 1) end @testset "Generic.Res.binary_ops" begin - R = Generic.ResidueRing(ZZ, 12) + R = Generic.residue_ring(ZZ, 12) f = R(4) g = R(6) @@ -210,9 +210,9 @@ end @test f*g == R(0) - Q = Generic.ResidueRing(ZZ, 7) - S, x = PolynomialRing(Q, "x") - T = ResidueRing(S, x^3 + 3x + 1) + Q = Generic.residue_ring(ZZ, 7) + S, x = polynomial_ring(Q, "x") + T = residue_ring(S, x^3 + 3x + 1) n = T(x^5 + 1) p = T(x^2 + 2x + 1) @@ -224,8 +224,8 @@ end @test n*p == T(3x^2 + 4x + 4) # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) n = T(x^5 + 1) p = T(x^2 + 2x + 1) @@ -238,16 +238,16 @@ end end @testset "Generic.Res.gcd" begin - R = Generic.ResidueRing(ZZ, 12) + R = Generic.residue_ring(ZZ, 12) f = R(4) g = R(6) @test gcd(f, g) == R(2) - Q = Generic.ResidueRing(ZZ, 7) - S, x = PolynomialRing(Q, "x") - T = ResidueRing(S, x^3 + 3x + 1) + Q = Generic.residue_ring(ZZ, 7) + S, x = polynomial_ring(Q, "x") + T = residue_ring(S, x^3 + 3x + 1) n = T(x^5 + 1) p = T(x^2 + 2x + 1) @@ -255,18 +255,18 @@ end @test gcd(n, p) == 1 # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 2x + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 2x + 1) @test gcd(T(x + 1), T(x + 1)) == T(x + 1) - T = ResidueRing(S, x^2 + 1) + T = residue_ring(S, x^2 + 1) @test gcd(T(x + 1), T(x + 1)) == T(1) end @testset "Generic.Res.adhoc_binary" begin - R = Generic.ResidueRing(ZZ, 7) + R = Generic.residue_ring(ZZ, 7) a = R(3) @@ -276,8 +276,8 @@ end @test 5a == R(1) - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) f = T(x^5 + 1) @@ -288,8 +288,8 @@ end @test f*5 == T(2*x^2+3*x+6) # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 2x + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 2x + 1) f = T(x + 1) @@ -301,7 +301,7 @@ end end @testset "Generic.Res.comparison" begin - R = Generic.ResidueRing(ZZ, 7) + R = Generic.residue_ring(ZZ, 7) a = R(3) b = a @@ -313,8 +313,8 @@ end @test c != a - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) f = T(x^5 + 1) g = 8f @@ -326,53 +326,53 @@ end @test isequal(f, g) # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) @test T(x + 1) == T(x + 1) @test isequal(T(x + 2), T(x + 2)) end @testset "Generic.Res.adhoc_comparison" begin - R = Generic.ResidueRing(ZZ, 7) + R = Generic.residue_ring(ZZ, 7) a = R(3) @test a == 3 @test 4 != a - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) f = T(x^5 + 1) @test f != 5 # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) @test T(2) == 2 @test T(x) != 2 end @testset "Generic.Res.powering" begin - R = Generic.ResidueRing(ZZ, 7) + R = Generic.residue_ring(ZZ, 7) a = R(3) @test a^5 == 5 - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) f = T(x^5 + 1) @test f^100 == T(x^2 + 2x + 1) # Poly modulus, invertible lc - S, x = PolynomialRing(ZZ, "x") - T = ResidueRing(S, x^2 + 1) + S, x = polynomial_ring(ZZ, "x") + T = residue_ring(S, x^2 + 1) @test T(x + 1)^0 == T(1) @test T(x + 1)^1 == T(x + 1) @@ -380,7 +380,7 @@ end @test T(x + 1)^3 == T(2x - 2) - R = ResidueRing(ZZ, ZZ(4)) + R = residue_ring(ZZ, ZZ(4)) @test_throws NotInvertibleError R(4)^-1 @test_throws NotInvertibleError R(2)^-1 try @@ -391,7 +391,7 @@ end @test modulus(e.mod) == 4 end - R = ResidueRing(ZZ, 4) + R = residue_ring(ZZ, 4) @test_throws NotInvertibleError R(4)^-1 @test_throws NotInvertibleError R(2)^-1 try @@ -402,23 +402,23 @@ end @test modulus(e.mod) == 4 end - R = ResidueRing(ZZ, ZZ(5)) + R = residue_ring(ZZ, ZZ(5)) @test_throws NotInvertibleError R(5)^-1 - R = ResidueRing(ZZ, 5) + R = residue_ring(ZZ, 5) @test_throws NotInvertibleError R(5)^-1 end @testset "Generic.Res.inversion" begin - R = Generic.ResidueRing(ZZ, 49) + R = Generic.residue_ring(ZZ, 49) a = R(5) @test inv(a) == 10 - R = Generic.ResidueRing(ZZ, 41) - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + R = Generic.residue_ring(ZZ, 41) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) f = T(x^5 + 1) @@ -426,16 +426,16 @@ end end @testset "Generic.Res.exact_division" begin - R = Generic.ResidueRing(ZZ, 49) + R = Generic.residue_ring(ZZ, 49) a = R(5) b = R(3) @test divexact(a, b) == 18 - R = Generic.ResidueRing(ZZ, 41) - S, x = PolynomialRing(R, "x") - T = ResidueRing(S, x^3 + 3x + 1) + R = Generic.residue_ring(ZZ, 41) + S, x = polynomial_ring(R, "x") + T = residue_ring(S, x^3 + 3x + 1) f = T(x^5 + 1) g = T(x^4 + x + 2) @@ -444,7 +444,7 @@ end for i = 1:100 n = rand(1:24) - R = ResidueRing(ZZ, n) + R = residue_ring(ZZ, n) for iter = 1:100 a1 = rand(R, 0:n - 1) diff --git a/test/generic/ResidueField-test.jl b/test/generic/ResidueField-test.jl index ff6ce7081f..0e6ebaa8e2 100644 --- a/test/generic/ResidueField-test.jl +++ b/test/generic/ResidueField-test.jl @@ -1,7 +1,7 @@ @testset "Generic.ResF.constructors" begin B = ZZ - R = Generic.ResidueField(B, 16453889) + R = Generic.residue_field(B, 16453889) S, f1 = quo(Field, B, 16453889) U, f2 = quo(Field, B, 16453889; cached=false) @@ -17,8 +17,8 @@ @test f1(c1) == S(c1) @test f2(c1) == S(c1) - @test Generic.ResidueField(B, 16453889, cached = true) === Generic.ResidueField(B, 16453889, cached = true) - @test Generic.ResidueField(B, 16453889, cached = true) !== Generic.ResidueField(B, 16453889, cached = false) + @test Generic.residue_field(B, 16453889, cached = true) === Generic.residue_field(B, 16453889, cached = true) + @test Generic.residue_field(B, 16453889, cached = true) !== Generic.residue_field(B, 16453889, cached = false) @test elem_type(R) == Generic.ResF{elem_type(B)} @test elem_type(Generic.ResField{elem_type(B)}) == Generic.ResF{elem_type(B)} @@ -42,8 +42,8 @@ @test isa(d, Generic.ResF) - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) @test isa(T, Generic.ResField) @@ -55,7 +55,7 @@ @test isa(g, Generic.ResF) - S = Generic.ResidueRing(B, 2) + S = Generic.residue_ring(B, 2) x = R(1) y = S(1) @test x in [x, y] @@ -67,12 +67,12 @@ end @testset "Generic.ResF.printing" begin - R = Generic.ResidueField(ZZ, 16453889) + R = Generic.residue_field(ZZ, 16453889) @test string(zero(R)) == "0" @test string(one(R)) == "1" - S, x = PolynomialRing(R, "x") + S, x = polynomial_ring(R, "x") @test string(zero(S)) == "0" @test string(one(S)) == "1" @@ -81,7 +81,7 @@ end end @testset "Generic.ResF.rand" begin - R = Generic.ResidueField(ZZ, 16453889) + R = Generic.residue_field(ZZ, 16453889) test_rand(R, 1:9) do f @test 1 <= f.data <= 9 @@ -89,7 +89,7 @@ end end @testset "Generic.ResF.manipulation" begin - R = Generic.ResidueField(ZZ, 16453889) + R = Generic.residue_field(ZZ, 16453889) @test modulus(R) == 16453889 @@ -99,8 +99,8 @@ end @test modulus(g) == 16453889 - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) h = one(T) @@ -119,25 +119,25 @@ end @test deepcopy(h) == h - S = ResidueField(zz, 23) + S = residue_field(zz, 23) @test lift(S(1)) == 1 @test isa(lift(S(1)), BigInt) end @testset "Generic.ResF.unary_ops" begin - R = Generic.ResidueField(ZZ, 16453889) + R = Generic.residue_field(ZZ, 16453889) @test -R(12345) == R(16441544) - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) @test -T(x^5 + 1) == T(x^2+16453880*x+16453885) end @testset "Generic.ResF.binary_ops" begin - R = Generic.ResidueField(ZZ, 13) + R = Generic.residue_field(ZZ, 13) f = R(4) g = R(6) @@ -148,9 +148,9 @@ end @test f*g == R(11) - Q = Generic.ResidueField(ZZ, 7) - S, x = PolynomialRing(Q, "x") - T = ResidueField(S, x^3 + 3x + 1) + Q = Generic.residue_field(ZZ, 7) + S, x = polynomial_ring(Q, "x") + T = residue_field(S, x^3 + 3x + 1) n = T(x^5 + 1) p = T(x^2 + 2x + 1) @@ -163,16 +163,16 @@ end end @testset "Generic.ResF.gcd" begin - R = Generic.ResidueField(ZZ, 13) + R = Generic.residue_field(ZZ, 13) f = R(4) g = R(6) @test gcd(f, g) == R(1) - Q = Generic.ResidueField(ZZ, 7) - S, x = PolynomialRing(Q, "x") - T = ResidueField(S, x^3 + 3x + 1) + Q = Generic.residue_field(ZZ, 7) + S, x = polynomial_ring(Q, "x") + T = residue_field(S, x^3 + 3x + 1) n = T(x^5 + 1) p = T(x^2 + 2x + 1) @@ -181,7 +181,7 @@ end end @testset "Generic.ResF.adhoc_binary" begin - R = Generic.ResidueField(ZZ, 7) + R = Generic.residue_field(ZZ, 7) a = R(3) @@ -191,8 +191,8 @@ end @test 5a == R(1) - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) f = T(x^5 + 1) @@ -204,7 +204,7 @@ end end @testset "Generic.ResF.comparison" begin - R = Generic.ResidueField(ZZ, 7) + R = Generic.residue_field(ZZ, 7) a = R(3) b = a @@ -216,8 +216,8 @@ end @test c != a - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) f = T(x^5 + 1) g = 8f @@ -230,15 +230,15 @@ end end @testset "Generic.ResF.adhoc_comparison" begin - R = Generic.ResidueField(ZZ, 7) + R = Generic.residue_field(ZZ, 7) a = R(3) @test a == 3 @test 4 != a - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) f = T(x^5 + 1) @@ -246,14 +246,14 @@ end end @testset "Generic.ResF.powering" begin - R = Generic.ResidueField(ZZ, 7) + R = Generic.residue_field(ZZ, 7) a = R(3) @test a^5 == 5 - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) f = T(x^5 + 1) @@ -261,15 +261,15 @@ end end @testset "Generic.ResF.inversion" begin - R = Generic.ResidueField(ZZ, 47) + R = Generic.residue_field(ZZ, 47) a = R(5) @test inv(a) == 19 - R = Generic.ResidueField(ZZ, 41) - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + R = Generic.residue_field(ZZ, 41) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) f = T(x^5 + 1) @@ -277,16 +277,16 @@ end end @testset "Generic.ResF.exact_division" begin - R = Generic.ResidueField(ZZ, 47) + R = Generic.residue_field(ZZ, 47) a = R(5) b = R(3) @test divexact(a, b) == 33 - R = Generic.ResidueField(ZZ, 41) - S, x = PolynomialRing(R, "x") - T = ResidueField(S, x^3 + 3x + 1) + R = Generic.residue_field(ZZ, 41) + S, x = polynomial_ring(R, "x") + T = residue_field(S, x^3 + 3x + 1) f = T(x^5 + 1) g = T(x^4 + x + 2) @@ -296,7 +296,7 @@ end @testset "Generic.ResF.square_root" begin for p in [3, 47, 733, 13913, 168937, 3980299, 57586577] - R = Generic.ResidueField(ZZ, p) + R = Generic.residue_field(ZZ, p) for i = 1:10 a = rand(R, 0:p - 1)^2 @@ -316,7 +316,7 @@ end end for p in [ZZ(3), ZZ(53), ZZ(727), ZZ(8893), ZZ(191339), ZZ(2369093), ZZ(52694921)] - R = Generic.ResidueField(ZZ, p) + R = Generic.residue_field(ZZ, p) for i = 1:10 a = rand(R, 0:Int(p - 1))^2 diff --git a/test/generic/TotalFraction-test.jl b/test/generic/TotalFraction-test.jl index cfec67f3a3..4dd172d194 100644 --- a/test/generic/TotalFraction-test.jl +++ b/test/generic/TotalFraction-test.jl @@ -1,5 +1,5 @@ @testset "Generic.TotFrac.constructors" begin - S = ResidueRing(ZZ, 12) + S = residue_ring(ZZ, 12) T = TotalRingOfFractions(S) @test TotalRingOfFractions(S, cached = true) === TotalRingOfFractions(S, cached = true) @@ -37,7 +37,7 @@ end @testset "Generic.TotFrac.printing" begin - S, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]) + S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) K = TotalRingOfFractions(S) @test string(K(x+y, z)) == "(x + y)//z" @@ -45,14 +45,14 @@ end end @testset "Generic.TotFrac.rand" begin - S = ResidueRing(ZZ, 12) + S = residue_ring(ZZ, 12) K = TotalRingOfFractions(S) test_rand(K, 0:11) end @testset "Generic.TotFrac.manipulation" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) @test denominator(S(5, 7)) == 7 @@ -88,14 +88,14 @@ end end @testset "Generic.TotFrac.unary_ops" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) @test -(S(5, 7)) == 1 end @testset "Generic.TotFrac.binary_ops" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) for iter = 1:100 @@ -111,7 +111,7 @@ end end @testset "Generic.TotFrac.adhoc_binary" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) a = S(3, 7) @@ -151,7 +151,7 @@ end end @testset "Generic.TotFrac.comparison" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) a = S(3, 7) @@ -163,7 +163,7 @@ end end @testset "Generic.TotFrac.adhoc_comparison" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) @test S(3, 1) == 3 @@ -176,7 +176,7 @@ end end @testset "Generic.TotFrac.powering" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) a = S(5, 7) @@ -185,7 +185,7 @@ end end @testset "Generic.TotFrac.inversion" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) a = S(5, 7) @@ -196,7 +196,7 @@ end end @testset "Generic.TotFrac.promotion" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) T = elem_type(S) @@ -204,7 +204,7 @@ end end @testset "Generic.TotFrac.unsafe_operators" begin - R = ResidueRing(ZZ, 12) + R = residue_ring(ZZ, 12) S = TotalRingOfFractions(R) a = S(5, 7) diff --git a/test/generic/UnivPoly-test.jl b/test/generic/UnivPoly-test.jl index 2b66128e3f..e5ce28d10f 100644 --- a/test/generic/UnivPoly-test.jl +++ b/test/generic/UnivPoly-test.jl @@ -127,7 +127,7 @@ function test_elem(R::AbstractAlgebra.Generic.UnivPolyRing{AbstractAlgebra.Gener end @testset "Generic.UnivPoly.conformance" begin - S = UniversalPolynomialRing(ResidueRing(ZZ, ZZ(6))) + S = UniversalPolynomialRing(residue_ring(ZZ, ZZ(6))) gen(S, "x") test_Ring_interface(S) end @@ -916,7 +916,7 @@ end y, z = gens(S, ["y", "z"]) h = rand(S, 0:5, 0:10, -10:10) - U, w = PolynomialRing(R, "v") + U, w = polynomial_ring(R, "v") n = rand(1:3) V = [rand(-10:10) for v in 1:n] @@ -1005,7 +1005,7 @@ end for R in [ZZ, QQ] S = UniversalPolynomialRing(R; cached=false) - U, y = PolynomialRing(R, "y") + U, y = polynomial_ring(R, "y") x = gen(S, "x") @@ -1038,7 +1038,7 @@ end for R in [ZZ, QQ] S = UniversalPolynomialRing(R; cached=false) - U, y = PolynomialRing(R, "y") + U, y = polynomial_ring(R, "y") x = gen(S, "x") y, z = gens(S, ["y", "z"]) @@ -1073,7 +1073,7 @@ end for R in [ZZ, QQ] S = UniversalPolynomialRing(R; cached=false) - U, y = PolynomialRing(R, "y") + U, y = polynomial_ring(R, "y") x = gen(S, "x") y, z = gens(S, ["y", "z"]) diff --git a/test/julia/Floats-test.jl b/test/julia/Floats-test.jl index 386a7255a2..0eb2f01f5d 100644 --- a/test/julia/Floats-test.jl +++ b/test/julia/Floats-test.jl @@ -12,7 +12,7 @@ end end @testset "Julia.Floats.printing" begin - R, x = PolynomialRing(RealField, "x") + R, x = polynomial_ring(RealField, "x") @test !occursin("+", string(2*x^2-3*x)) end diff --git a/test/julia/GFElem-test.jl b/test/julia/GFElem-test.jl index 6c48aa9920..a6f2d2390a 100644 --- a/test/julia/GFElem-test.jl +++ b/test/julia/GFElem-test.jl @@ -25,7 +25,7 @@ end @test string(S(3)) == "3" @test string(S()) == "0" - R, x = PolynomialRing(GF(13), "x") + R, x = polynomial_ring(GF(13), "x") @test string(x) == "x" @test !occursin("1", string(x^2+2*x)) @@ -331,7 +331,7 @@ end while !is_probable_prime(n) n = rand(ZZ(2)^9:ZZ(2)^10-1) end - R, x = PolynomialRing(GF(n), "x") + R, x = polynomial_ring(GF(n), "x") f = rand(R, 10:10) g = rand(R, 10:10) @test f*g == g*f diff --git a/test/julia/Rationals-test.jl b/test/julia/Rationals-test.jl index 6abda07eb2..5306390869 100644 --- a/test/julia/Rationals-test.jl +++ b/test/julia/Rationals-test.jl @@ -11,8 +11,8 @@ end R = qq S = QQ - @test R == FractionField(zz) - @test S == FractionField(ZZ) + @test R == fraction_field(zz) + @test S == fraction_field(ZZ) a = R(11) b = S(11) diff --git a/todo.txt b/todo.txt index ab45d02382..68d2ffb9f9 100644 --- a/todo.txt +++ b/todo.txt @@ -137,7 +137,7 @@ Fraction.jl nf.jl ----- -* find way of allowing NumberField to take a polynomial over Z instead of +* find way of allowing number_field to take a polynomial over Z instead of over Q, and yet allow all the coercions from that ring into number fields maximal orders, ideals, etc., without making it inefficient