Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename number_of_* functions consistently #1624

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/integer.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ base(::ZZRingElem, ::Integer)
```

```@docs
ndigits(::ZZRingElem, ::Integer)
number_of_digits(::ZZRingElem, ::Integer)
```

```@docs
Expand Down
1 change: 0 additions & 1 deletion src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ export NALocalFieldElem
export Native
export nbits
export ncdivrem
export ndigits
export ndivrem
export neg!
export NegInf
Expand Down
1 change: 0 additions & 1 deletion src/Nemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ import Base: log1p
import Base: maximum
import Base: minimum
import Base: mod
import Base: ndigits
import Base: numerator
import Base: oct
import Base: one
Expand Down
8 changes: 4 additions & 4 deletions src/arb/ComplexMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ function one(x::ComplexMatSpace)
return z
end

nrows(a::ComplexMat) = a.r
number_of_rows(a::ComplexMat) = a.r

ncols(a::ComplexMat) = a.c
number_of_columns(a::ComplexMat) = a.c

nrows(a::ComplexMatSpace) = a.nrows
number_of_rows(a::ComplexMatSpace) = a.nrows

ncols(a::ComplexMatSpace) = a.ncols
number_of_columns(a::ComplexMatSpace) = a.ncols

function deepcopy_internal(x::ComplexMat, dict::IdDict)
z = similar(x)
Expand Down
8 changes: 4 additions & 4 deletions src/arb/RealMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ function one(x::RealMatSpace)
return z
end

nrows(a::RealMat) = a.r
number_of_rows(a::RealMat) = a.r

ncols(a::RealMat) = a.c
number_of_columns(a::RealMat) = a.c

nrows(a::RealMatSpace) = a.nrows
number_of_rows(a::RealMatSpace) = a.nrows

ncols(a::RealMatSpace) = a.ncols
number_of_columns(a::RealMatSpace) = a.ncols

function deepcopy_internal(x::RealMat, dict::IdDict)
z = RealMat(nrows(x), ncols(x))
Expand Down
8 changes: 4 additions & 4 deletions src/arb/acb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ function one(x::AcbMatSpace)
return z
end

nrows(a::acb_mat) = a.r
number_of_rows(a::acb_mat) = a.r

ncols(a::acb_mat) = a.c
number_of_columns(a::acb_mat) = a.c

nrows(a::AcbMatSpace) = a.nrows
number_of_rows(a::AcbMatSpace) = a.nrows

ncols(a::AcbMatSpace) = a.ncols
number_of_columns(a::AcbMatSpace) = a.ncols

function deepcopy_internal(x::acb_mat, dict::IdDict)
z = similar(x)
Expand Down
8 changes: 4 additions & 4 deletions src/arb/arb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ function one(x::ArbMatSpace)
return z
end

nrows(a::arb_mat) = a.r
number_of_rows(a::arb_mat) = a.r

ncols(a::arb_mat) = a.c
number_of_columns(a::arb_mat) = a.c

nrows(a::ArbMatSpace) = a.nrows
number_of_rows(a::ArbMatSpace) = a.nrows

ncols(a::ArbMatSpace) = a.ncols
number_of_columns(a::ArbMatSpace) = a.ncols

function deepcopy_internal(x::arb_mat, dict::IdDict)
z = arb_mat(nrows(x), ncols(x))
Expand Down
8 changes: 4 additions & 4 deletions src/flint/fmpq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ Base.@propagate_inbounds setindex!(a::QQMatrix, d::Rational,
r::Int, c::Int) =
setindex!(a, QQFieldElem(d), r, c)

nrows(a::QQMatrix) = a.r
number_of_rows(a::QQMatrix) = a.r

ncols(a::QQMatrix) = a.c
number_of_columns(a::QQMatrix) = a.c

nrows(a::QQMatrixSpace) = a.nrows
number_of_rows(a::QQMatrixSpace) = a.nrows

ncols(a::QQMatrixSpace) = a.ncols
number_of_columns(a::QQMatrixSpace) = a.ncols

zero(a::QQMatrixSpace) = a()

Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpq_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function check_parent(a::QQMPolyRingElem, b::QQMPolyRingElem)
error("Incompatible polynomial rings in polynomial operation")
end

nvars(a::QQMPolyRing) = ccall((:fmpq_mpoly_ctx_nvars, libflint), Int,
number_of_variables(a::QQMPolyRing) = ccall((:fmpq_mpoly_ctx_nvars, libflint), Int,
(Ref{QQMPolyRing}, ), a)

base_ring(a::QQMPolyRing) = FlintQQ
Expand Down
10 changes: 5 additions & 5 deletions src/flint/fmpz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2234,22 +2234,22 @@ function base(n::ZZRingElem, b::Integer)
end

@doc raw"""
ndigits(x::ZZRingElem, b::Integer)
number_of_digits(x::ZZRingElem, b::Integer)

Return the number of digits of $x$ in the base $b$ (default is $b = 10$).

# Examples

```jldoctest
julia> ndigits(ZZ(12), 3)
julia> number_of_digits(ZZ(12), 3)
3
```
"""
function Base.ndigits(x::ZZRingElem, b::Integer)::Int
ndigits(x, base=b)
function number_of_digits(x::ZZRingElem, b::Integer)::Int
number_of_digits(x, base=b)
end

function Base.ndigits(a::ZZRingElem; base::Integer = 10, pad::Integer = 1)
function number_of_digits(a::ZZRingElem; base::Integer = 10, pad::Integer = 1)
iszero(a) && return max(pad, 1)
return max(pad, 1+flog(abs(a), ZZRingElem(abs(base))))
end
Expand Down
8 changes: 4 additions & 4 deletions src/flint/fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ end
end
end

@inline nrows(a::ZZMatrix) = a.r
@inline number_of_rows(a::ZZMatrix) = a.r

@inline ncols(a::ZZMatrix) = a.c
@inline number_of_columns(a::ZZMatrix) = a.c

nrows(a::ZZMatrixSpace) = a.nrows
number_of_rows(a::ZZMatrixSpace) = a.nrows

ncols(a::ZZMatrixSpace) = a.ncols
number_of_columns(a::ZZMatrixSpace) = a.ncols

zero(a::ZZMatrixSpace) = a()

Expand Down
8 changes: 4 additions & 4 deletions src/flint/fmpz_mod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ function deepcopy_internal(a::ZZModMatrix, dict::IdDict)
return z
end

nrows(a::T) where T <: Zmod_fmpz_mat = a.r
number_of_rows(a::T) where T <: Zmod_fmpz_mat = a.r

ncols(a::T) where T <: Zmod_fmpz_mat = a.c
number_of_columns(a::T) where T <: Zmod_fmpz_mat = a.c

nrows(a::ZZModMatrixSpace) = a.nrows
number_of_rows(a::ZZModMatrixSpace) = a.nrows

ncols(a::ZZModMatrixSpace) = a.ncols
number_of_columns(a::ZZModMatrixSpace) = a.ncols

parent(a::Zmod_fmpz_mat) = matrix_space(base_ring(a), nrows(a), ncols(a))

Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpz_mod_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function check_parent(a::($etype), b::($etype))
error("Incompatible polynomial rings in polynomial operation")
end

nvars(a::($rtype)) = a.nvars
number_of_variables(a::($rtype)) = a.nvars

base_ring(a::($rtype)) = a.base_ring

Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpz_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function check_parent(a::ZZMPolyRingElem, b::ZZMPolyRingElem)
error("Incompatible polynomial rings in polynomial operation")
end

nvars(a::ZZMPolyRing) = ccall((:fmpz_mpoly_ctx_nvars, libflint), Int,
number_of_variables(a::ZZMPolyRing) = ccall((:fmpz_mpoly_ctx_nvars, libflint), Int,
(Ref{ZZMPolyRing}, ), a)

base_ring(a::ZZMPolyRing) = FlintZZ
Expand Down
8 changes: 4 additions & 4 deletions src/flint/fq_default_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ function deepcopy_internal(a::FqMatrix, dict::IdDict)
return z
end

function nrows(a::FqMatrix)
function number_of_rows(a::FqMatrix)
return ccall((:fq_default_mat_nrows, libflint), Int,
(Ref{FqMatrix}, Ref{FqField}),
a, base_ring(a))
end

function ncols(a::FqMatrix)
function number_of_columns(a::FqMatrix)
return ccall((:fq_default_mat_ncols, libflint), Int,
(Ref{FqMatrix}, Ref{FqField}),
a, base_ring(a))
end

nrows(a::FqMatrixSpace) = a.nrows
number_of_rows(a::FqMatrixSpace) = a.nrows

ncols(a::FqMatrixSpace) = a.ncols
number_of_columns(a::FqMatrixSpace) = a.ncols

parent(a::FqMatrix) = matrix_space(base_ring(a), nrows(a), ncols(a))

Expand Down
2 changes: 1 addition & 1 deletion src/flint/fq_default_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ symbols(a::FqMPolyRing) = symbols(a.data)

parent(a::FqMPolyRingElem) = a.parent

nvars(a::FqMPolyRing) = nvars(a.data)
number_of_variables(a::FqMPolyRing) = number_of_variables(a.data)

base_ring(a::FqMPolyRing) = a.base_ring

Expand Down
8 changes: 4 additions & 4 deletions src/flint/fq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ function deepcopy_internal(a::FqPolyRepMatrix, dict::IdDict)
return z
end

nrows(a::FqPolyRepMatrix) = a.r
number_of_rows(a::FqPolyRepMatrix) = a.r

ncols(a::FqPolyRepMatrix) = a.c
number_of_columns(a::FqPolyRepMatrix) = a.c

nrows(a::FqPolyRepMatrixSpace) = a.nrows
number_of_rows(a::FqPolyRepMatrixSpace) = a.nrows

ncols(a::FqPolyRepMatrixSpace) = a.ncols
number_of_columns(a::FqPolyRepMatrixSpace) = a.ncols

parent(a::FqPolyRepMatrix) = matrix_space(base_ring(a), nrows(a), ncols(a))

Expand Down
8 changes: 4 additions & 4 deletions src/flint/fq_nmod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ function deepcopy_internal(a::fqPolyRepMatrix, dict::IdDict)
return z
end

nrows(a::fqPolyRepMatrix) = a.r
number_of_rows(a::fqPolyRepMatrix) = a.r

ncols(a::fqPolyRepMatrix) = a.c
number_of_columns(a::fqPolyRepMatrix) = a.c

nrows(a::fqPolyRepMatrixSpace) = a.nrows
number_of_rows(a::fqPolyRepMatrixSpace) = a.nrows

ncols(a::fqPolyRepMatrixSpace) = a.ncols
number_of_columns(a::fqPolyRepMatrixSpace) = a.ncols

parent(a::fqPolyRepMatrix) = matrix_space(base_ring(a), nrows(a), ncols(a))

Expand Down
2 changes: 1 addition & 1 deletion src/flint/fq_nmod_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function check_parent(a::fqPolyRepMPolyRingElem, b::fqPolyRepMPolyRingElem)
error("Incompatible polynomial rings in polynomial operation")
end

nvars(a::fqPolyRepMPolyRing) = a.nvars
number_of_variables(a::fqPolyRepMPolyRing) = a.nvars

base_ring(a::fqPolyRepMPolyRing) = a.base_ring

Expand Down
8 changes: 4 additions & 4 deletions src/flint/gfp_fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ function deepcopy_internal(a::FpMatrix, dict::IdDict)
return z
end

nrows(a::FpMatrix) = a.r
number_of_rows(a::FpMatrix) = a.r

ncols(a::FpMatrix) = a.c
number_of_columns(a::FpMatrix) = a.c

nrows(a::FpMatrixSpace) = a.nrows
number_of_rows(a::FpMatrixSpace) = a.nrows

ncols(a::FpMatrixSpace) = a.ncols
number_of_columns(a::FpMatrixSpace) = a.ncols

parent(a::FpMatrix) = matrix_space(base_ring(a), nrows(a), ncols(a))

Expand Down
4 changes: 2 additions & 2 deletions src/flint/gfp_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ function deepcopy_internal(a::fpMatrix, dict::IdDict)
return z
end

nrows(a::fpMatrixSpace) = a.nrows
number_of_rows(a::fpMatrixSpace) = a.nrows

ncols(a::fpMatrixSpace) = a.ncols
number_of_columns(a::fpMatrixSpace) = a.ncols

base_ring(a::fpMatrixSpace) = a.base_ring

Expand Down
8 changes: 4 additions & 4 deletions src/flint/nmod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ function deepcopy_internal(a::zzModMatrix, dict::IdDict)
return z
end

nrows(a::T) where T <: Zmodn_mat = a.r
number_of_rows(a::T) where T <: Zmodn_mat = a.r

ncols(a::T) where T <: Zmodn_mat = a.c
number_of_columns(a::T) where T <: Zmodn_mat = a.c

nrows(a::zzModMatrixSpace) = a.nrows
number_of_rows(a::zzModMatrixSpace) = a.nrows

ncols(a::zzModMatrixSpace) = a.ncols
number_of_columns(a::zzModMatrixSpace) = a.ncols

parent(a::Zmodn_mat) = matrix_space(base_ring(a), nrows(a), ncols(a))

Expand Down
2 changes: 1 addition & 1 deletion src/flint/nmod_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function check_parent(a::($etype), b::($etype))
error("Incompatible polynomial rings in polynomial operation")
end

nvars(a::($rtype)) = a.nvars
number_of_variables(a::($rtype)) = a.nvars

base_ring(a::($rtype)) = a.base_ring

Expand Down
Loading