Skip to content

Commit

Permalink
Merge branch 'master' into lg/QQBar-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Apr 29, 2024
2 parents 4840974 + f102e74 commit b7ec0d6
Show file tree
Hide file tree
Showing 106 changed files with 691 additions and 582 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Nemo"
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
version = "0.43.2"
version = "0.44.0-DEV"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -16,7 +16,7 @@ RandomExtensions = "fb686558-2515-59ef-acaa-46db3789a887"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[compat]
AbstractAlgebra = "0.40.8"
AbstractAlgebra = "0.41.0"
Antic_jll = "~0.201.500"
Arb_jll = "~200.2300.000"
Calcium_jll = "~0.401.100"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bernoulli_polynomials.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function benchmark_bernoulli()
print("benchmark_bernoulli ... ")

R, x = FlintQQ["x"]
R, x = QQ["x"]
S, t = power_series_ring(R, 1000, "t")

u = t + O(t^1000)
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/charpoly_integers.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
function benchmark_charpoly_int()
print("benchmark_charpoly_int ... ")
M = matrix_space(FlintZZ, 80, 80)()
M = matrix_space(ZZ, 80, 80)()

for i in 1:80
for j in 1:80
M[i, j] = rand(-20:20)
end
end

tt = @elapsed charpoly(polynomial_ring(FlintZZ, "x")[1], M)
tt = @elapsed charpoly(polynomial_ring(ZZ, "x")[1], M)
println("$tt")
end
2 changes: 1 addition & 1 deletion benchmarks/det_commutative_ring.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function benchmark_znz_det()
print("benchmark_znz_det ... ")
n = 2003 * 1009
Zn, = residue_ring(FlintZZ, n)
Zn, = residue_ring(ZZ, n)
R, x = polynomial_ring(Zn, "x")

M = matrix_space(R, 80, 80)()
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/det_field.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function benchmark_nf_det()
print("benchmark_nf_det ... ")
QQx, x = polynomial_ring(FlintQQ, "x")
QQx, x = polynomial_ring(QQ, "x")
K, a = AbsSimpleNumField(x^3 + 3*x + 1, "a")
M = matrix_space(K, 80, 80)()

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/det_polynomials.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function benchmark_det_poly_ring()
print("benchmark_det_poly_ring ... ")
ZZx, x = polynomial_ring(FlintZZ, "x")
ZZx, x = polynomial_ring(ZZ, "x")
M = matrix_space(ZZx, 40, 40)()

for i in 1:40
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fateman.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function benchmark_fateman()
print("benchmark_fateman ... ")
R, x = polynomial_ring(FlintZZ, "x")
R, x = polynomial_ring(ZZ, "x")
S, y = polynomial_ring(R, "y")
T, z = polynomial_ring(S, "z")
U, t = polynomial_ring(T, "t")
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/minpoly_finite_field.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function benchmark_minpoly_finite_field()
print("benchmark_minpoly_finite_field ... ")

F, s = FlintFiniteField(103, 2, "s")
F, s = finite_field(103, 2, "s")

M = matrix_space(F, 80, 80)()

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/minpoly_integers.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function benchmark_minpoly_integers()
print("benchmark_minpoly_integers ... ")
M = matrix_space(FlintZZ, 80, 80)()
M = matrix_space(ZZ, 80, 80)()

for i in 1:40
for j in 1:40
Expand All @@ -14,7 +14,7 @@ function benchmark_minpoly_integers()
similarity!(M, rand(1:80), ZZRingElem(rand(-3:3)))
end

tt = @elapsed minpoly(polynomial_ring(FlintZZ, "x")[1], M)
tt = @elapsed minpoly(polynomial_ring(ZZ, "x")[1], M)
println("$tt")
end

2 changes: 1 addition & 1 deletion benchmarks/solve_polynomials.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function benchmark_solve_poly()
print("benchmark_solve_poly ... ")
R, x = polynomial_ring(FlintZZ, "x")
R, x = polynomial_ring(ZZ, "x")
S, y = polynomial_ring(R, "y")
M = matrix_space(S, 20, 20)()

Expand Down
2 changes: 1 addition & 1 deletion docs/src/developer/parents.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ As all elements and parents in Nemo are objects, those objects have types
which we refer to as the element type and parent type respectively.

For example, Flint integers have type `ZZRingElem` and the parent object they all
belong to, `FlintZZ` has type `ZZRing`.
belong to, `ZZ` has type `ZZRing`.

More complex parents and elements are parameterised. For example, generic
univariate polynomials over a base ring `R` are parameterised by `R`. The
Expand Down
6 changes: 3 additions & 3 deletions docs/src/integer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ end
# Integers

The default integer type in Nemo is provided by Flint. The associated ring of
integers is represented by the constant parent object called `FlintZZ`.
integers is represented by the constant parent object called `ZZ`.

For convenience we define

```
ZZ = FlintZZ
ZZ = ZZ
```

so that integers can be constructed using `ZZ` instead of `FlintZZ`. Note that
so that integers can be constructed using `ZZ` instead of `ZZ`. Note that
this is the name of a specific parent object, not the name of its type.

The types of the integer ring parent objects and elements of the associated
Expand Down
4 changes: 2 additions & 2 deletions docs/src/qadic.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ c = R(2)
k = precision(a)
m = prime(R)
n = valuation(b)
Qx, x = FlintQQ["x"]
Qx, x = QQ["x"]
p = lift(Qx, a)
Zy, y = FlintZZ["y"]
Zy, y = ZZ["y"]
q = lift(Zy, divexact(a, b))
```

Expand Down
53 changes: 20 additions & 33 deletions src/Aliases.jl
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
include(joinpath(pathof(AbstractAlgebra), "..", "Aliases.jl"))
# alternative names for some functions from Base
# (this list contained stuff along the lines of `@alias is_equal isequal`, but everything has moved to AbstractAlgebra)

# make some Julia names compatible with our naming conventions
@alias is_equal isequal
@alias is_finite isfinite
@alias is_inf isinf
@alias is_integer isinteger
@alias is_less isless
@alias is_real isreal

# TODO: next breaking release: remove the if guard around the block
if @__MODULE__() == Nemo

# alternative names for some functions from LinearAlgebra
# we don't use the `@alias` macro here because we provide custom
# docstrings for these aliases
const eigenvalues = eigvals
end

# predeclare some functions to allow defining aliases for some of our own functions
function eigenvalues_simple end
@alias eigvals_simple eigenvalues_simple # for consistency with eigvals/eigenvalues

# renamed for 0.40.0
Base.@deprecate_binding FlintPadicField PadicField
Base.@deprecate_binding padic PadicFieldElem
Base.@deprecate_binding FlintQadicField QadicField
Base.@deprecate_binding qadic QadicFieldElem

# renamed for 0.41.0
Base.@deprecate_binding arb_poly ArbPolyRingElem
Base.@deprecate_binding arb_mat ArbMatrix
Base.@deprecate_binding arb ArbFieldElem
Base.@deprecate_binding acb_poly AcbPolyRingElem
Base.@deprecate_binding acb_mat AcbMatrix
Base.@deprecate_binding acb AcbFieldElem
Base.@deprecate_binding ca CalciumFieldElem
Base.@deprecate_binding Loc LocalizedEuclideanRing
Base.@deprecate_binding LocElem LocalizedEuclideanRingElem
Base.@deprecate_binding lll_ctx LLLContext
Base.@deprecate_binding qqbar QQBarFieldElem
Base.@deprecate_binding CalciumQQBarField QQBarField
Base.@deprecate_binding FlintQQiField Nemo.QQiField false
Base.@deprecate_binding fmpqi Nemo.QQiFieldElem false
Base.@deprecate_binding FlintZZiRing Nemo.ZZiRing false
Base.@deprecate_binding fmpzi Nemo.ZZiRingElem false
Base.@deprecate_binding fmpzUnitRange ZZRingElemUnitRange
Base.@deprecate_binding AnticNumberField AbsSimpleNumField
Base.@deprecate_binding nf_elem AbsSimpleNumFieldElem
# TODO: next breaking release: remove this block
# Oscar includes this file for historical reasons, but expects it to contain the Base.@deprecate_binding calls.
# Until this is changed and released there, we thus need to include the deprecations here.
@static if Symbol(@__MODULE__()) in [:Hecke, :Oscar]
Nemo.@include_deprecated_bindings()
end

60 changes: 59 additions & 1 deletion src/Deprecations.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Deprecated in 0.39.*
###############################################################################
#
# Aliases
#
###############################################################################

# ALL aliases here are only a temporary measure to allow for a smooth transition downstream.
# they will be replaced by deprecations eventually

#= currently none =#

###############################################################################
#
# Deprecated bindings
#
###############################################################################

# Deprecated bindings don't get reexported automatically in Hecke/Oscar/etc.
# By calling this macro from the respective packages, we can ensure that the deprecated bindings are available there.
macro include_deprecated_bindings()
return esc(quote
# renamed and deprecated for 0.40.0
Base.@deprecate_binding FlintPadicField PadicField
Base.@deprecate_binding padic PadicFieldElem
Base.@deprecate_binding FlintQadicField QadicField
Base.@deprecate_binding qadic QadicFieldElem

# renamed and deprecated for 0.41.0
Base.@deprecate_binding arb_poly ArbPolyRingElem
Base.@deprecate_binding arb_mat ArbMatrix
Base.@deprecate_binding arb ArbFieldElem
Base.@deprecate_binding acb_poly AcbPolyRingElem
Base.@deprecate_binding acb_mat AcbMatrix
Base.@deprecate_binding acb AcbFieldElem
Base.@deprecate_binding ca CalciumFieldElem
Base.@deprecate_binding Loc LocalizedEuclideanRing
Base.@deprecate_binding LocElem LocalizedEuclideanRingElem
Base.@deprecate_binding lll_ctx LLLContext
Base.@deprecate_binding qqbar QQBarFieldElem
Base.@deprecate_binding CalciumQQBarField QQBarField
Base.@deprecate_binding FlintQQiField Nemo.QQiField false
Base.@deprecate_binding fmpqi Nemo.QQiFieldElem false
Base.@deprecate_binding FlintZZiRing Nemo.ZZiRing false
Base.@deprecate_binding fmpzi Nemo.ZZiRingElem false
Base.@deprecate_binding fmpzUnitRange ZZRingElemUnitRange
Base.@deprecate_binding AnticNumberField AbsSimpleNumField
Base.@deprecate_binding nf_elem AbsSimpleNumFieldElem

end)
end

@include_deprecated_bindings()

###############################################################################
#
# Deprecations
#
###############################################################################

# Deprecated in 0.39.*
@deprecate divisible(x::Int, y::Int) is_divisible_by(x, y)
@deprecate divisible(x::ZZRingElem, y::Int) is_divisible_by(x, y)
@deprecate divisible(x::ZZRingElem, y::ZZRingElem) is_divisible_by(x, y)
1 change: 0 additions & 1 deletion src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ export snf
export snf_diagonal
export solve
export sort_terms!
export SparsePolynomialRing
export sqr_classical
export sqrt
export sqrt1pm1
Expand Down
11 changes: 10 additions & 1 deletion src/HeckeMiscFiniteField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Base.eltype(::fqPolyRepField) = fqPolyRepFieldElem
# FqPolyRepField

function Base.iterate(F::FqPolyRepField)
return zero(F), zeros(FlintZZ, degree(F))
return zero(F), zeros(ZZ, degree(F))
end

function Base.iterate(F::FqPolyRepField, st::Vector{ZZRingElem})
Expand Down Expand Up @@ -222,6 +222,15 @@ function (k::FqPolyRepField)(a::QQFieldElem)
return k(numerator(a)) // k(denominator(a))
end

function (k::Nemo.fpField)(a::Vector)
@assert length(a) == 1
return k(a[1])
end

function (k::fqPolyRepField)(a::Vector)
return k(polynomial(Native.GF(Int(characteristic(k))), a))
end


(F::fqPolyRepField)(a::zzModRingElem) = F(a.data)

Expand Down
2 changes: 1 addition & 1 deletion src/HeckeMiscInteger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ for sym in (:trunc, :round, :ceil, :floor)
# support `trunc(ZZRingElem, m)` etc. where m is a matrix of reals
function Base.$sym(::Type{ZZMatrix}, a::Matrix{<:Real})
s = Base.size(a)
m = zero_matrix(FlintZZ, s[1], s[2])
m = zero_matrix(ZZ, s[1], s[2])
for i = 1:s[1], j = 1:s[2]
m[i, j] = Base.$sym(ZZRingElem, a[i, j])
end
Expand Down
16 changes: 8 additions & 8 deletions src/HeckeMiscMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# This function is really slow...
function denominator(M::QQMatrix)
d = one(FlintZZ)
d = one(ZZ)
for i in 1:nrows(M)
for j in 1:ncols(M)
d = lcm!(d, d, denominator(M[i, j]))
Expand All @@ -18,7 +18,7 @@ end
transpose!(A::Union{ZZMatrix,QQMatrix}) = is_square(A) ? transpose!(A, A) : transpose(A)

function matrix(A::Matrix{ZZRingElem})
m = matrix(FlintZZ, A)
m = matrix(ZZ, A)
return m
end

Expand Down Expand Up @@ -137,7 +137,7 @@ end
It returns a lift of the matrix to the integers.
"""
function lift(a::Generic.Mat{EuclideanRingResidueRingElem{ZZRingElem}})
z = zero_matrix(FlintZZ, nrows(a), ncols(a))
z = zero_matrix(ZZ, nrows(a), ncols(a))
for i in 1:nrows(a)
for j in 1:ncols(a)
z[i, j] = lift(a[i, j])
Expand All @@ -147,7 +147,7 @@ function lift(a::Generic.Mat{EuclideanRingResidueRingElem{ZZRingElem}})
end

function lift(a::ZZModMatrix)
z = zero_matrix(FlintZZ, nrows(a), ncols(a))
z = zero_matrix(ZZ, nrows(a), ncols(a))
GC.@preserve a z begin
for i in 1:nrows(a)
for j in 1:ncols(a)
Expand All @@ -166,7 +166,7 @@ function lift(x::FpMatrix)
end

function lift(a::Generic.Mat{ZZModRingElem})
z = zero_matrix(FlintZZ, nrows(a), ncols(a))
z = zero_matrix(ZZ, nrows(a), ncols(a))
for i in 1:nrows(a)
for j in 1:ncols(a)
z[i, j] = lift(a[i, j])
Expand Down Expand Up @@ -227,7 +227,7 @@ mod_sym!(M::ZZMatrix, B::Integer) = mod_sym!(M, ZZRingElem(B))
Reduces every entry modulo $p$ into the symmetric residue system.
"""
function mod_sym(M::ZZMatrix, B::ZZRingElem)
N = zero_matrix(FlintZZ, nrows(M), ncols(M))
N = zero_matrix(ZZ, nrows(M), ncols(M))
ccall((:fmpz_mat_scalar_smod, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}, Ref{ZZRingElem}), N, M, B)
return N
end
Expand Down Expand Up @@ -293,11 +293,11 @@ left and/ or right transformation matrices are computed as well.
"""
function snf_with_transform(A::ZZMatrix, l::Bool=true, r::Bool=true)
if r
R = identity_matrix(FlintZZ, ncols(A))
R = identity_matrix(ZZ, ncols(A))
end

if l
L = identity_matrix(FlintZZ, nrows(A))
L = identity_matrix(ZZ, nrows(A))
end
# TODO: if only one trafo is required, start with the HNF that does not
# compute the trafo
Expand Down
Loading

0 comments on commit b7ec0d6

Please sign in to comment.