From 4e07e610c04513f669808ec8def0c916a9ebce1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 23 Jan 2024 12:26:25 +0100 Subject: [PATCH] Rename `number_of_*` functions consistently (#1553) * ncols * ndigits * ngens * nrows * nvars * Update src/Matrix.jl [skip ci] Co-authored-by: Tommy Hofmann --------- Co-authored-by: Tommy Hofmann --- docs/src/free_associative_algebra.md | 2 +- docs/src/laurent_mpolynomial.md | 2 +- docs/src/laurent_polynomial.md | 2 +- docs/src/matrix.md | 12 ++++++------ docs/src/matrix_interface.md | 12 ++++++------ docs/src/module.md | 4 ++-- docs/src/module_interface.md | 2 +- docs/src/mpoly_interface.md | 2 +- docs/src/mpolynomial.md | 4 ++-- docs/src/mseries.md | 2 +- src/AbstractAlgebra.jl | 21 ++++++++++++++++----- src/Generic.jl | 10 +++++----- src/Groups.jl | 2 +- src/MPoly.jl | 4 ++-- src/Matrix.jl | 16 ++++++++-------- src/MatrixAlgebra.jl | 4 ++-- src/NemoStuff.jl | 2 +- src/Poly.jl | 4 ++-- src/generic/AbsMSeries.jl | 6 +++--- src/generic/DirectSum.jl | 2 +- src/generic/Fraction.jl | 2 +- src/generic/FreeAssAlgebra.jl | 6 +++--- src/generic/FreeModule.jl | 2 +- src/generic/InvariantFactorDecomposition.jl | 2 +- src/generic/LaurentMPoly.jl | 4 ++-- src/generic/LaurentPoly.jl | 2 +- src/generic/MPoly.jl | 6 +++--- src/generic/Matrix.jl | 12 ++++++------ src/generic/PermGroups.jl | 2 +- src/generic/QuotientModule.jl | 2 +- src/generic/RationalFunctionField.jl | 2 +- src/generic/Submodule.jl | 2 +- src/generic/UnivPoly.jl | 2 +- src/julia/Matrix.jl | 4 ++-- test/generic/Matrix-test.jl | 4 ++-- 35 files changed, 90 insertions(+), 79 deletions(-) diff --git a/docs/src/free_associative_algebra.md b/docs/src/free_associative_algebra.md index 840a850d9a..a4d5f3d7eb 100644 --- a/docs/src/free_associative_algebra.md +++ b/docs/src/free_associative_algebra.md @@ -100,7 +100,7 @@ multivariate polynomial interface are provided. ```julia symbols(S::FreeAssAlgebra) -nvars(f::FreeAssAlgebra) +number_of_variables(f::FreeAssAlgebra) gens(S::FreeAssAlgebra) gen(S::FreeAssAlgebra, i::Int) is_gen(x::FreeAssAlgElem) diff --git a/docs/src/laurent_mpolynomial.md b/docs/src/laurent_mpolynomial.md index b0bf51dc9f..0ca5bc9596 100644 --- a/docs/src/laurent_mpolynomial.md +++ b/docs/src/laurent_mpolynomial.md @@ -61,7 +61,7 @@ finish(M::LaurentMPolyBuildCtx) ```julia symbols(S::LaurentMPolyRing) -nvars(f::LaurentMPolyRing) +number_of_variables(f::LaurentMPolyRing) gens(S::LaurentMPolyRing) gen(S::LaurentMPolyRing, i::Int) is_gen(x::LaurentMPolyRingElem) diff --git a/docs/src/laurent_polynomial.md b/docs/src/laurent_polynomial.md index f6f5bdcb71..eabf400c81 100644 --- a/docs/src/laurent_polynomial.md +++ b/docs/src/laurent_polynomial.md @@ -51,7 +51,7 @@ julia> symbols(R) 1-element Vector{Symbol}: :x -julia> nvars(R) +julia> number_of_variables(R) 1 julia> f = x^-2 + 2x diff --git a/docs/src/matrix.md b/docs/src/matrix.md index 59c3f57813..177298fecd 100644 --- a/docs/src/matrix.md +++ b/docs/src/matrix.md @@ -395,13 +395,13 @@ dense_matrix_type(::Ring) ``` ```@docs -nrows(::MatSpace) -ncols(::MatSpace) +number_of_rows(::MatSpace) +number_of_columns(::MatSpace) ``` ```@docs -nrows(::MatrixElem{T}) where T <: RingElement -ncols(::MatrixElem{T}) where T <: RingElement +number_of_rows(::MatrixElem{T}) where T <: RingElement +number_of_columns(::MatrixElem{T}) where T <: RingElement ``` ```@docs @@ -501,10 +501,10 @@ julia> B = S([R(2) R(3) R(1); t t + 1 t + 2; R(-1) t^2 t^3]) julia> T = dense_matrix_type(R) AbstractAlgebra.Generic.MatSpaceElem{AbstractAlgebra.Generic.Poly{Rational{BigInt}}} -julia> r = nrows(B) +julia> r = number_of_rows(B) 3 -julia> c = ncols(B) +julia> c = number_of_columns(B) 3 julia> length(B) diff --git a/docs/src/matrix_interface.md b/docs/src/matrix_interface.md index a3dd06d49c..26e64989aa 100644 --- a/docs/src/matrix_interface.md +++ b/docs/src/matrix_interface.md @@ -170,27 +170,27 @@ E.g. in Nemo, which depends on AbstractAlgebra, we define `dense_matrix_type(::Type{ZZRingElem}) = ZZMatrix`. ```julia -nrows(M::MyMatSpace{T}) where T <: RingElem -nrows(M::MyMatAlgebra{T}) where T <: RingElem +number_of_rows(M::MyMatSpace{T}) where T <: RingElem +number_of_rows(M::MyMatAlgebra{T}) where T <: RingElem ``` Return the number of rows of matrices in the matrix space. ```julia -ncols(M:MyMatSpace{T}) where T <: RingElem -ncols(M:MyMatAlgebra{T}) where T <: RingElem +number_of_columns(M:MyMatSpace{T}) where T <: RingElem +number_of_columns(M:MyMatAlgebra{T}) where T <: RingElem ``` Return the number of columns of matrices in the matrix space. ```julia -nrows(f::MyMat{T}) where T <: RingElem +number_of_rows(f::MyMat{T}) where T <: RingElem ``` Return the number of rows of the given matrix. ```julia -ncols(f::MyMat{T}) where T <: RingElem +number_of_columns(f::MyMat{T}) where T <: RingElem ``` Return the number of columns of the given matrix. diff --git a/docs/src/module.md b/docs/src/module.md index f514c4bee2..4b636c821d 100644 --- a/docs/src/module.md +++ b/docs/src/module.md @@ -47,7 +47,7 @@ iszero(m::FPModuleElem{T}) where T <: RingElement Return `true` if the given module element is zero. ```julia -ngens(M::FPModule{T}) where T <: RingElement +number_of_generators(M::FPModule{T}) where T <: RingElement ``` Return the number of generators of the module $M$ in its current representation. @@ -77,7 +77,7 @@ relation is given as an AbstractAlgebra row matrix. julia> M = FreeModule(QQ, 2) Vector space of dimension 2 over rationals -julia> n = ngens(M) +julia> n = number_of_generators(M) 2 julia> G = gens(M) diff --git a/docs/src/module_interface.md b/docs/src/module_interface.md index 6d9fc0e038..ebe9f28851 100644 --- a/docs/src/module_interface.md +++ b/docs/src/module_interface.md @@ -71,7 +71,7 @@ iszero(m::MyModuleElem{T}) where T <: RingElement Return `true` if the given module element is zero. ```julia -ngens(M::MyModule{T}) where T <: RingElement +number_of_generators(M::MyModule{T}) where T <: RingElement ``` Return the number of generators of the module $M$ in its current representation. diff --git a/docs/src/mpoly_interface.md b/docs/src/mpoly_interface.md index 41351d3c8e..3402ed115e 100644 --- a/docs/src/mpoly_interface.md +++ b/docs/src/mpoly_interface.md @@ -120,7 +120,7 @@ ring. Note that these are `Symbol`s not `String`s, though their string values wi usually be used when printing polynomials. ```julia -nvars(f::MyMPolyRing{T}) where T <: RingElem +number_of_variables(f::MyMPolyRing{T}) where T <: RingElem ``` Return the number of variables of the polynomial ring. diff --git a/docs/src/mpolynomial.md b/docs/src/mpolynomial.md index 467c219857..8a43a49888 100644 --- a/docs/src/mpolynomial.md +++ b/docs/src/mpolynomial.md @@ -225,7 +225,7 @@ All basic functions from the Multivariate Polynomial interface are provided. ```julia symbols(S::MPolyRing) -nvars(f::MPolyRing) +number_of_variables(f::MPolyRing) gens(S::MPolyRing) gen(S::MPolyRing, i::Int) ``` @@ -458,7 +458,7 @@ julia> n = length(f) julia> is_gen(y) true -julia> nvars(S) == 2 +julia> number_of_variables(S) == 2 true julia> d = total_degree(f) diff --git a/docs/src/mseries.md b/docs/src/mseries.md index c2d9121061..2e22f47165 100644 --- a/docs/src/mseries.md +++ b/docs/src/mseries.md @@ -226,7 +226,7 @@ for absolute series over any commutative ring. The following are provided for weighted and unweighted series: ```@docs -nvars(::Generic.AbsMSeriesRing) +number_of_variables(::Generic.AbsMSeriesRing) ``` ```@docs diff --git a/src/AbstractAlgebra.jl b/src/AbstractAlgebra.jl index b1d9fcd498..537405dea0 100644 --- a/src/AbstractAlgebra.jl +++ b/src/AbstractAlgebra.jl @@ -312,6 +312,7 @@ export is_real export is_subset export is_valid export is_zero +export number_of_digits @alias is_empty isempty @alias is_even iseven @@ -326,6 +327,7 @@ export is_zero @alias is_subset issubset @alias is_valid isvalid @alias is_zero iszero +@alias number_of_digits ndigits function order end @@ -338,6 +340,20 @@ const is_symmetric = issymmetric const is_lower_triangular = istril const is_upper_triangular = istriu +# alternative names for some of our own functions +function number_of_columns end +function number_of_generators end +function number_of_rows end +function number_of_variables end +export number_of_columns +export number_of_generators +export number_of_rows +export number_of_variables +@alias ncols number_of_columns +@alias ngens number_of_generators +@alias nrows number_of_rows +@alias nvars number_of_variables + ############################################################################### # Macros for fancy printing. to use, enable attribute storage for your struct, # i.e.m change @@ -720,7 +736,6 @@ import .Generic: monomial! import .Generic: monomials import .Generic: MPolyBuildCtx import .Generic: mullow_karatsuba -import .Generic: ngens import .Generic: norm import .Generic: normal_form import .Generic: normalise @@ -1058,16 +1073,12 @@ export multiply_column export multiply_column! export multiply_row export multiply_row! -export ncols export newton_to_monomial! -export ngens export norm export normal_form export normalise -export nrows export nullspace export num_coeff -export nvars export O export one export order diff --git a/src/Generic.jl b/src/Generic.jl index c13c1727c5..f051c8586a 100644 --- a/src/Generic.jl +++ b/src/Generic.jl @@ -67,7 +67,6 @@ import Base: length import Base: log1p import Base: Matrix import Base: mod -import Base: ndigits import Base: oct import Base: one import Base: parent @@ -205,13 +204,14 @@ import ..AbstractAlgebra: mul_classical import ..AbstractAlgebra: mul_karatsuba import ..AbstractAlgebra: mul! import ..AbstractAlgebra: mullow -import ..AbstractAlgebra: ncols +import ..AbstractAlgebra: number_of_columns +import ..AbstractAlgebra: number_of_digits +import ..AbstractAlgebra: number_of_generators import ..AbstractAlgebra: NCRing import ..AbstractAlgebra: NCRingElem -import ..AbstractAlgebra: ngens -import ..AbstractAlgebra: nrows +import ..AbstractAlgebra: number_of_rows import ..AbstractAlgebra: numerator -import ..AbstractAlgebra: nvars +import ..AbstractAlgebra: number_of_variables import ..AbstractAlgebra: O import ..AbstractAlgebra: order import ..AbstractAlgebra: parent_type diff --git a/src/Groups.jl b/src/Groups.jl index 606feee49a..d3825c3e8a 100644 --- a/src/Groups.jl +++ b/src/Groups.jl @@ -138,7 +138,7 @@ The default implementation returns `true`. has_gens(G::Group) = true gens(G::Group) = throw(NotImplementedError(:gens, G)) -ngens(G::Group) = throw(NotImplementedError(:ngens, G)) +number_of_generators(G::Group) = throw(NotImplementedError(:number_of_generators, G)) ############################################################################### # diff --git a/src/MPoly.jl b/src/MPoly.jl index d2c9ee78c1..6349b8622a 100644 --- a/src/MPoly.jl +++ b/src/MPoly.jl @@ -80,11 +80,11 @@ function is_exact_type(a::Type{T}) where {S <: RingElement, T <: MPolyRingElem{S end @doc raw""" - ngens(R::MPolyRing) + number_of_generators(R::MPolyRing) Return the number of variables in `R`. """ -ngens(R::MPolyRing) = nvars(R) +number_of_generators(R::MPolyRing) = number_of_variables(R) @doc raw""" vars(p::MPolyRingElem{T}) where {T <: RingElement} diff --git a/src/Matrix.jl b/src/Matrix.jl index e54186889e..73471d1eca 100644 --- a/src/Matrix.jl +++ b/src/Matrix.jl @@ -89,18 +89,18 @@ check_square(S::MatAlgebra) = S ############################################################################### @doc raw""" - nrows(a::MatSpace) + number_of_rows(a::MatSpace) Return the number of rows of the given matrix space. """ -nrows(a::MatSpace) = a.nrows +number_of_rows(a::MatSpace) = a.nrows @doc raw""" - ncols(a::MatSpace) + number_of_columns(a::MatSpace) Return the number of columns of the given matrix space. """ -ncols(a::MatSpace) = a.ncols +number_of_columns(a::MatSpace) = a.ncols function Base.hash(a::MatElem, h::UInt) b = 0x3e4ea81eb31d94f4%UInt @@ -114,18 +114,18 @@ function Base.hash(a::MatElem, h::UInt) end @doc raw""" - nrows(a::MatrixElem{T}) where T <: NCRingElement + number_of_rows(a::MatrixElem{T}) where T <: NCRingElement Return the number of rows of the given matrix. """ -nrows(a::MatrixElem{T}) where T <: NCRingElement +number_of_rows(a::MatrixElem{T}) where T <: NCRingElement @doc raw""" - ncols(a::MatrixElem{T}) where T <: NCRingElement + number_of_columns(a::MatrixElem{T}) where T <: NCRingElement Return the number of columns of the given matrix. """ -ncols(a::MatrixElem{T}) where T <: NCRingElement +number_of_columns(a::MatrixElem{T}) where {T<:NCRingElement} @doc raw""" length(a::MatrixElem{T}) where T <: NCRingElement diff --git a/src/MatrixAlgebra.jl b/src/MatrixAlgebra.jl index 100010c8b6..0aa9b0ffdb 100644 --- a/src/MatrixAlgebra.jl +++ b/src/MatrixAlgebra.jl @@ -39,8 +39,8 @@ function Base.hash(a::MatAlgElem, h::UInt) return b end -nrows(a::MatAlgebra) = a.n -ncols(a::MatAlgebra) = nrows(a) +number_of_rows(a::MatAlgebra) = a.n +number_of_columns(a::MatAlgebra) = number_of_rows(a) @doc raw""" degree(a::MatAlgebra) diff --git a/src/NemoStuff.jl b/src/NemoStuff.jl index f0c89e834a..3f81069e27 100644 --- a/src/NemoStuff.jl +++ b/src/NemoStuff.jl @@ -187,7 +187,7 @@ function Base.getindex(L::SimpleNumField{T}, i::Int) where {T} end end -ngens(L::SimpleNumField{T}) where {T} = 1 +number_of_generators(L::SimpleNumField{T}) where {T} = 1 is_unit(a::NumFieldElem) = !iszero(a) diff --git a/src/Poly.jl b/src/Poly.jl index 61e5de0398..c0d40f7711 100644 --- a/src/Poly.jl +++ b/src/Poly.jl @@ -45,11 +45,11 @@ this is returned as an array of `Symbol` not `String`. symbols(a::PolyRing) = [a.S] @doc raw""" - nvars(a::PolyRing) + number_of_variables(a::PolyRing) Return the number of variables of the polynomial ring, which is 1. """ -nvars(a::PolyRing) = 1 +number_of_variables(a::PolyRing) = 1 function check_parent(a::PolynomialElem, b::PolynomialElem, throw::Bool = true) c = parent(a) != parent(b) diff --git a/src/generic/AbsMSeries.jl b/src/generic/AbsMSeries.jl index 4bfef15095..6b60611e53 100644 --- a/src/generic/AbsMSeries.jl +++ b/src/generic/AbsMSeries.jl @@ -62,13 +62,13 @@ Return the number of nonzero terms in the series $a$. length(a::AbsMSeries) = length(poly(a)) @doc raw""" - nvars(R::AbsMSeriesRing) + number_of_variables(R::AbsMSeriesRing) Return the number of variables in the series ring. """ -nvars(R::AbsMSeriesRing) = nvars(poly_ring(R)) +number_of_variables(R::AbsMSeriesRing) = number_of_variables(poly_ring(R)) -ngens(R::AbsMSeriesRing) = ngens(poly_ring(R)) +number_of_generators(R::AbsMSeriesRing) = number_of_generators(poly_ring(R)) @doc raw""" precision(a::AbsMSeries) diff --git a/src/generic/DirectSum.jl b/src/generic/DirectSum.jl index fa394636c1..67cd59dc4a 100644 --- a/src/generic/DirectSum.jl +++ b/src/generic/DirectSum.jl @@ -20,7 +20,7 @@ base_ring(N::DirectSumModule{T}) where T <: RingElement = base_ring(N.m[1]) base_ring(v::DirectSumModuleElem{T}) where T <: RingElement = base_ring(v.parent) -ngens(N::DirectSumModule{T}) where T <: RingElement = sum(ngens(M) for M in N.m) +number_of_generators(N::DirectSumModule{T}) where T <: RingElement = sum(ngens(M) for M in N.m) gens(N::DirectSumModule{T}) where T <: RingElement = [gen(N, i) for i = 1:ngens(N)] diff --git a/src/generic/Fraction.jl b/src/generic/Fraction.jl index 85f9ed5883..fa685f292f 100644 --- a/src/generic/Fraction.jl +++ b/src/generic/Fraction.jl @@ -45,7 +45,7 @@ function deepcopy_internal(a::FracFieldElem{T}, dict::IdDict) where {T <: RingEl return v end -ngens(F::FracField) = ngens(base_ring(F)) +number_of_generators(F::FracField) = number_of_generators(base_ring(F)) gen(F::FracField) = F(gen(base_ring(F))) diff --git a/src/generic/FreeAssAlgebra.jl b/src/generic/FreeAssAlgebra.jl index 895ffc810f..948f7b91e1 100644 --- a/src/generic/FreeAssAlgebra.jl +++ b/src/generic/FreeAssAlgebra.jl @@ -30,7 +30,7 @@ function symbols(a::FreeAssAlgebra) return a.S end -function nvars(a::FreeAssAlgebra) +function number_of_variables(a::FreeAssAlgebra) return length(a.S) end @@ -85,8 +85,8 @@ function isone(a::FreeAssAlgElem{T}) where T end end -function ngens(a::FreeAssAlgebra{T}) where T - return nvars(a) +function number_of_generators(a::FreeAssAlgebra{T}) where T + return number_of_variables(a) end function gen(a::FreeAssAlgebra{T}, i::Int) where T diff --git a/src/generic/FreeModule.jl b/src/generic/FreeModule.jl index 6c9a7e43c4..06cd0d0986 100644 --- a/src/generic/FreeModule.jl +++ b/src/generic/FreeModule.jl @@ -43,7 +43,7 @@ Return the dimension of the given vector space. """ dim(M::FreeModule{T}) where T <: FieldElement = M.rank -ngens(M::FreeModule{T}) where T <: Union{RingElement, NCRingElem} = M.rank +number_of_generators(M::FreeModule{T}) where T <: Union{RingElement, NCRingElem} = M.rank function gens(N::FreeModule{T}) where T <: Union{RingElement, NCRingElem} return [gen(N, i) for i = 1:ngens(N)] diff --git a/src/generic/InvariantFactorDecomposition.jl b/src/generic/InvariantFactorDecomposition.jl index ac0002abac..ab5562e8b7 100644 --- a/src/generic/InvariantFactorDecomposition.jl +++ b/src/generic/InvariantFactorDecomposition.jl @@ -20,7 +20,7 @@ base_ring(N::SNFModule{T}) where T <: RingElement = N.base_ring base_ring(v::SNFModuleElem{T}) where T <: RingElement = base_ring(v.parent) -ngens(N::SNFModule{T}) where T <: RingElement = length(N.invariant_factors) +number_of_generators(N::SNFModule{T}) where T <: RingElement = length(N.invariant_factors) gens(N::SNFModule{T}) where T <: RingElement = [gen(N, i) for i = 1:ngens(N)] diff --git a/src/generic/LaurentMPoly.jl b/src/generic/LaurentMPoly.jl index 4267ed7c53..96e71d9126 100644 --- a/src/generic/LaurentMPoly.jl +++ b/src/generic/LaurentMPoly.jl @@ -23,9 +23,9 @@ coefficient_ring(R::LaurentMPolyWrapRing) = coefficient_ring(R.mpolyring) symbols(R::LaurentMPolyWrapRing) = symbols(R.mpolyring) -nvars(R::LaurentMPolyWrapRing) = nvars(R.mpolyring) +number_of_variables(R::LaurentMPolyWrapRing) = number_of_variables(R.mpolyring) -ngens(R::LaurentMPolyWrapRing) = nvars(R.mpolyring) +number_of_generators(R::LaurentMPolyWrapRing) = number_of_variables(R.mpolyring) characteristic(R::LaurentMPolyWrapRing) = characteristic(R.mpolyring) diff --git a/src/generic/LaurentPoly.jl b/src/generic/LaurentPoly.jl index e95a92d281..87edfbab6d 100644 --- a/src/generic/LaurentPoly.jl +++ b/src/generic/LaurentPoly.jl @@ -25,7 +25,7 @@ var(R::LaurentPolyWrapRing) = var(R.polyring) symbols(R::LaurentPolyWrapRing) = symbols(R.polyring) -nvars(R::LaurentPolyWrapRing) = nvars(R.polyring) +number_of_variables(R::LaurentPolyWrapRing) = number_of_variables(R.polyring) characteristic(R::LaurentPolyWrapRing) = characteristic(R.polyring) diff --git a/src/generic/MPoly.jl b/src/generic/MPoly.jl index f745d51620..b66082074b 100644 --- a/src/generic/MPoly.jl +++ b/src/generic/MPoly.jl @@ -29,13 +29,13 @@ polynomial ring. symbols(a::MPolyRing) = a.S @doc raw""" - nvars(x::MPolyRing) + number_of_variables(x::MPolyRing) Return the number of variables of the polynomial ring. """ -nvars(a::MPolyRing) = a.num_vars +number_of_variables(a::MPolyRing) = a.num_vars -ngens(a::MPolyRing) = a.num_vars +number_of_generators(a::MPolyRing) = a.num_vars function gen(a::MPolyRing{T}, i::Int, ::Type{Val{:lex}}) where {T <: RingElement} n = nvars(a) diff --git a/src/generic/Matrix.jl b/src/generic/Matrix.jl index edba7bf616..472929dd5f 100644 --- a/src/generic/Matrix.jl +++ b/src/generic/Matrix.jl @@ -44,22 +44,22 @@ dense_matrix_type(::Type{T}) where T <: NCRingElement = MatSpaceElem{T} ############################################################################### @doc raw""" - nrows(a::MatSpace) + number_of_rows(a::MatSpace) Return the number of rows of the given matrix space. """ -nrows(a::MatSpace) = a.nrows +number_of_rows(a::MatSpace) = a.nrows @doc raw""" - ncols(a::MatSpace) + number_of_columns(a::MatSpace) Return the number of columns of the given matrix space. """ -ncols(a::MatSpace) = a.ncols +number_of_columns(a::MatSpace) = a.ncols -nrows(a::Union{Mat, MatAlgElem}) = size(a.entries, 1) +number_of_rows(a::Union{Mat, MatAlgElem}) = size(a.entries, 1) -ncols(a::Union{Mat, MatAlgElem}) = size(a.entries, 2) +number_of_columns(a::Union{Mat,MatAlgElem}) = size(a.entries, 2) Base.@propagate_inbounds getindex(a::Union{Mat, MatAlgElem}, r::Int, c::Int) = a.entries[r, c] diff --git a/src/generic/PermGroups.jl b/src/generic/PermGroups.jl index 3c4e033156..7beb05f433 100644 --- a/src/generic/PermGroups.jl +++ b/src/generic/PermGroups.jl @@ -671,7 +671,7 @@ end gen(G::SymmetricGroup, i::Int) = gens(G)[i] -ngens(G::SymmetricGroup) = G.n == 1 ? 0 : G.n == 2 ? 1 : 2 +number_of_generators(G::SymmetricGroup) = G.n == 1 ? 0 : G.n == 2 ? 1 : 2 is_finite(G::SymmetricGroup) = true diff --git a/src/generic/QuotientModule.jl b/src/generic/QuotientModule.jl index 36dfed6c6b..05edce1656 100644 --- a/src/generic/QuotientModule.jl +++ b/src/generic/QuotientModule.jl @@ -20,7 +20,7 @@ base_ring(N::QuotientModule{T}) where T <: RingElement = N.base_ring base_ring(v::QuotientModuleElem{T}) where T <: RingElement = base_ring(v.parent) -ngens(N::QuotientModule{T}) where T <: RingElement = length(N.gen_cols) +number_of_generators(N::QuotientModule{T}) where T <: RingElement = length(N.gen_cols) gens(N::QuotientModule{T}) where T <: RingElement = elem_type(N)[gen(N, i) for i = 1:ngens(N)] diff --git a/src/generic/RationalFunctionField.jl b/src/generic/RationalFunctionField.jl index 0efd3bba3d..ff7b3c18d8 100644 --- a/src/generic/RationalFunctionField.jl +++ b/src/generic/RationalFunctionField.jl @@ -113,7 +113,7 @@ gen(R::RationalFunctionField, i::Int) = R(gen(base_ring(R.fraction_field), i)) gens(R::RationalFunctionField) = R.(gens(base_ring(R.fraction_field))) -ngens(R::RationalFunctionField) = ngens(base_ring(R.fraction_field)) +number_of_generators(R::RationalFunctionField) = number_of_generators(base_ring(R.fraction_field)) function deepcopy_internal(a::RationalFunctionFieldElem, dict::IdDict) R = parent(a) diff --git a/src/generic/Submodule.jl b/src/generic/Submodule.jl index 162636e2d9..36b0b7a7ff 100644 --- a/src/generic/Submodule.jl +++ b/src/generic/Submodule.jl @@ -20,7 +20,7 @@ base_ring(N::Submodule{T}) where T <: RingElement = N.base_ring base_ring(v::SubmoduleElem{T}) where T <: RingElement = base_ring(v.parent) -ngens(N::Submodule{T}) where T <: RingElement = length(N.gen_cols) +number_of_generators(N::Submodule{T}) where T <: RingElement = length(N.gen_cols) gens(N::Submodule{T}) where T <: RingElement = [gen(N, i) for i = 1:ngens(N)] diff --git a/src/generic/UnivPoly.jl b/src/generic/UnivPoly.jl index 00e4855355..d18b6da05b 100644 --- a/src/generic/UnivPoly.jl +++ b/src/generic/UnivPoly.jl @@ -34,7 +34,7 @@ function mpoly_ring(S::UniversalPolyRing{T, U}) where {T <: RingElement, U <: Ab return S.mpoly_ring::Generic.MPolyRing{T} end -nvars(S::UniversalPolyRing) = length(S.S) +number_of_variables(S::UniversalPolyRing) = length(S.S) symbols(S::UniversalPolyRing) = S.S diff --git a/src/julia/Matrix.jl b/src/julia/Matrix.jl index 95bc808db3..bb6e978a34 100644 --- a/src/julia/Matrix.jl +++ b/src/julia/Matrix.jl @@ -4,8 +4,8 @@ # ############################################################################### -nrows(A::Matrix{T}) where {T} = size(A)[1] -ncols(A::Matrix{T}) where {T} = size(A)[2] +number_of_rows(A::Matrix{T}) where {T} = size(A)[1] +number_of_columns(A::Matrix{T}) where {T} = size(A)[2] function is_zero_row(M::Matrix, i::Int) for j = 1:ncols(M) diff --git a/test/generic/Matrix-test.jl b/test/generic/Matrix-test.jl index 5e955b5eb6..a106aeda62 100644 --- a/test/generic/Matrix-test.jl +++ b/test/generic/Matrix-test.jl @@ -84,8 +84,8 @@ AbstractAlgebra.dense_matrix_type(::Type{F2}) = F2Matrix AbstractAlgebra.parent(a::F2Matrix) = F2MatSpace(nrows(a), ncols(a)) 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) +AbstractAlgebra.number_of_rows(a::F2Matrix) = nrows(a.m) +AbstractAlgebra.number_of_columns(a::F2Matrix) = ncols(a.m) AbstractAlgebra.base_ring(::F2Matrix) = F2() Base.getindex(a::F2Matrix, r::Int64, c::Int64) = a.m[r, c]