Skip to content

Commit

Permalink
feat: bump dependencies (#3153)
Browse files Browse the repository at this point in the history
- adjust to finite field changes in Nemo
- adjust to broadcasting changes
  • Loading branch information
thofma authored Jan 7, 2024
1 parent 8b3299d commit f4f7ea8
Show file tree
Hide file tree
Showing 38 changed files with 252 additions and 149 deletions.
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade"

[compat]
AbstractAlgebra = "0.34.7"
AlgebraicSolving = "0.4.4"
AbstractAlgebra = "0.35.2"
AlgebraicSolving = "0.4.6"
Distributed = "1.6"
DocStringExtensions = "0.8, 0.9"
GAP = "0.10.0"
Hecke = "0.23.0"
Hecke = "0.24.0"
JSON = "^0.20, ^0.21"
JSON3 = "1.13.2"
LazyArtifacts = "1.6"
Nemo = "0.38.0"
Nemo = "0.39.1"
Pkg = "1.6"
Polymake = "0.11.8"
Preferences = "1"
Random = "1.6"
RandomExtensions = "0.4.3"
Serialization = "1.6"
Singular = "0.21.1"
Singular = "0.21.2"
TOPCOM_jll = "0.17.8"
UUIDs = "1.6"
cohomCalg_jll = "0.32.0"
Expand Down
14 changes: 7 additions & 7 deletions docs/src/CommutativeAlgebra/rings.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ QQPolyRingElem
julia> T, x = polynomial_ring(GF(3), ["x[1]", "x[2]"]);
julia> x
2-element Vector{fpMPolyRingElem}:
2-element Vector{FqMPolyRingElem}:
x[1]
x[2]
Expand Down Expand Up @@ -126,10 +126,10 @@ Rational field

```jldoctest
julia> GF(3)
Finite field of characteristic 3
Finite field of degree 1 over GF(3)
julia> GF(ZZ(2)^127 - 1)
Finite field of characteristic 170141183460469231731687303715884105727
Finite field of degree 1 over GF(170141183460469231731687303715884105727)
```

Expand All @@ -151,7 +151,7 @@ julia> K, a = number_field(t^2 + 1, "a")
(Number field of degree 2 over QQ, a)
julia> F = GF(3)
Finite field of characteristic 3
Finite field of degree 1 over GF(3)
julia> T, t = polynomial_ring(F, "t")
(Univariate polynomial ring in t over GF(3), t)
Expand Down Expand Up @@ -440,10 +440,10 @@ subsection *Monomials, Terms, and More* of the section on *Gröbner/Standard Bas

```jldoctest
julia> R, (x, y) = polynomial_ring(GF(5), ["x", "y"])
(Multivariate polynomial ring in 2 variables over GF(5), fpMPolyRingElem[x, y])
(Multivariate polynomial ring in 2 variables over GF(5), FqMPolyRingElem[x, y])
julia> c = map(GF(5), [1, 2, 3])
3-element Vector{fpFieldElem}:
3-element Vector{FqFieldElem}:
1
2
3
Expand All @@ -459,7 +459,7 @@ x^3*y^2 + 2*x + 3*y
julia> parent(f)
Multivariate polynomial ring in 2 variables x, y
over finite field of characteristic 5
over finite field of degree 1 over GF(5)
julia> total_degree(f)
5
Expand Down
8 changes: 5 additions & 3 deletions experimental/GModule/Cohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ function (k::Nemo.fpField)(a::Vector)
end

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

function Oscar.order(F::AbstractAlgebra.FPModule{<:FinFieldElem})
Expand All @@ -1854,12 +1854,14 @@ function pc_group_with_isomorphism(M::AbstractAlgebra.FPModule{<:FinFieldElem};
B = PcGroup(GAP.Globals.GroupByRws(C))
FB = GAP.Globals.FamilyObj(GAP.Globals.Identity(B.X))

function Julia_to_gap(a::AbstractAlgebra.FPModuleElem{<:Union{fpFieldElem, FpFieldElem}})
function Julia_to_gap(a::AbstractAlgebra.FPModuleElem{<:Union{fpFieldElem, FpFieldElem, FqFieldElem}})
F = base_ring(parent(a))
@assert absolute_degree(F) == 1
r = ZZRingElem[]
for i=1:ngens(M)
if !iszero(a[i])
push!(r, i)
push!(r, lift(a[i]))
push!(r, lift(ZZ, a[i]))
end
end
g = GAP.Globals.ObjByExtRep(FB, GAP.Obj(r, recursive = true))
Expand Down
10 changes: 6 additions & 4 deletions experimental/GModule/GModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ function gmodule(::typeof(CyclotomicField), C::GModule)
return gmodule(F, group(C), [hom(F, F, map_entries(x->K(x.data), matrix(x))) for x = C.ac])
end

function gmodule(k::Nemo.fpField, C::GModule{<:Oscar.GAPGroup, GrpAbFinGen})
function gmodule(k::Union{Nemo.fpField, FqField}, C::GModule{<:Oscar.GAPGroup, GrpAbFinGen})
@assert absolute_degree(k) == 1
q, mq = quo(C.M, characteristic(k))
s, ms = snf(q)

Expand Down Expand Up @@ -512,9 +513,10 @@ function Oscar.sub(C::GModule{<:Any, <:AbstractAlgebra.FPModule{T}}, m::MatElem{
return b
end

function gmodule(k::Nemo.fpField, C::GModule{<:Any, <:AbstractAlgebra.FPModule{<:FinFieldElem}})
F = free_module(k, dim(C)*degree(base_ring(C)))
return GModule(F, group(C), [hom(F, F, hvcat(dim(C), [representation_matrix(x) for x = transpose(matrix(y))]...)) for y = C.ac])
function gmodule(k::Nemo.FinField, C::GModule{<:Any, <:AbstractAlgebra.FPModule{<:FinFieldElem}})
@assert absolute_degree(k) == 1
F = free_module(k, dim(C)*absolute_degree(base_ring(C)))
return GModule(F, group(C), [hom(F, F, hvcat(dim(C), [absolute_representation_matrix(x) for x = transpose(matrix(y))]...)) for y = C.ac])
end

function Hecke.frobenius(K::FinField, i::Int=1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ One realization is given by
[1 0 0 1 1 1]
[0 1 0 1 4 3]
[0 0 1 1 3 2]
in the Finite field of characteristic 5
in the Finite field of degree 1 over GF(5)
```
"""
Expand Down
9 changes: 9 additions & 0 deletions experimental/ModStd/ModStdQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ function (R::fpMPolyRing)(f::QQMPolyRingElem)
return finish(g)
end

function (R::FqMPolyRing)(f::QQMPolyRingElem)
g = MPolyBuildCtx(R)
S = base_ring(R)
for (c, v) in zip(AbstractAlgebra.coefficients(f), AbstractAlgebra.exponent_vectors(f))
push_term!(g, S(c), v)
end
return finish(g)
end

function (S::Union{Nemo.zzModRing, Nemo.fpField})(a::QQFieldElem)
return S(numerator(a))//S(denominator(a))
end
Expand Down
8 changes: 4 additions & 4 deletions experimental/QuadFormAndIsom/src/embeddings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ function _cokernel_as_Fp_vector_space(HinV::TorQuadModuleMor, p::IntegerUnion)
return Vp(vec(collect(v)))
end

function _VptoV(v::ModuleElem{FpFieldElem})
x = lift.(v.v)
function _VptoV(v::ModuleElem{FqFieldElem})
x = map(z -> lift(ZZ, z), v.v)
return sum(x[i]*V[i] for i in 1:n)
end

Expand Down Expand Up @@ -379,8 +379,8 @@ function _subgroups_orbit_representatives_and_stabilizers_elementary(Vinq::TorQu
# invariants sub-vector spaces of given rank in the quotient (then lifting
# generators and putting them with H0 will give us invariant subgroups as
# wanted)
act_GV = FpMatrix[change_base_ring(base_ring(Qp), matrix(gg)) for gg in gens(GV)]
act_GV = FpMatrix[solve(VptoQp.matrix, g*VptoQp.matrix) for g in act_GV]
act_GV = dense_matrix_type(elem_type(base_ring(Qp)))[change_base_ring(base_ring(Qp), matrix(gg)) for gg in gens(GV)]
act_GV = dense_matrix_type(elem_type(base_ring(Qp)))[solve(VptoQp.matrix, g*VptoQp.matrix) for g in act_GV]
MGp = matrix_group(base_ring(Qp), dim(Qp), act_GV)
GVtoMGp = hom(GV, MGp, MGp.(act_GV); check = false)
GtoMGp = compose(GtoGV, GVtoMGp)
Expand Down
2 changes: 1 addition & 1 deletion experimental/Schemes/ProjectiveModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function _is_projective_without_denominators(A::MatElem;
result = sum([c[k]*projectors[k] for k in 1:length(projectors)])

# Copied from below
d = lcm(_lifted_denominator.(result))
d = reduce(lcm, _lifted_denominator.(result))
if isone(d)
return true, result, 0
end
Expand Down
14 changes: 9 additions & 5 deletions experimental/Schemes/elliptic_surface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,13 @@ function weierstrass_model(X::EllipticSurface)
c = standard_covering(IP1)
# rename the variables on the affine charts
# to a more readable version
OO(c[1]).S = [:t]
OO(c[2]).S = [:s]

if k isa FqField
OO(c[1]).data.S = [:t]
OO(c[2]).data.S = [:s]
else
OO(c[1]).S = [:t]
OO(c[2]).S = [:s]
end

O0 = twisting_sheaf(IP1, 0)
O4 = twisting_sheaf(IP1, -2*s)
Expand Down Expand Up @@ -981,15 +985,15 @@ julia> E = EllipticCurve(ktfield,[3*t^8+24*t^7+22*t^6+15*t^5+28*t^4+20*t^3+16*t^
julia> bk = [E(collect(i)) for i in bk];
julia> Oscar._prop217(E,bk[2],2)
5-element Vector{Tuple{fpPolyRingElem, fpPolyRingElem}}:
5-element Vector{Tuple{FqPolyRingElem, FqPolyRingElem}}:
(t^2 + 12*t + 7, 0)
(t^3 + 8*t + 3, 0)
(t^4 + 23*t + 2, 0)
(25*t + 22, 1)
(12*t + 28, t)
julia> Oscar._prop217(E,bk[1],1)
2-element Vector{Tuple{fpPolyRingElem, fpPolyRingElem}}:
2-element Vector{Tuple{FqPolyRingElem, FqPolyRingElem}}:
(1, 0)
(t, 0)
```
Expand Down
8 changes: 4 additions & 4 deletions experimental/StandardFiniteFields/src/StandardFiniteFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function (k::Nemo.FpField)(a::Vector)
return k(a[1])
end
function (k::FqPolyRepField)(a::Vector)
return k(polynomial(GF(ZZ(characteristic(k))), a))
return k(polynomial(Native.GF(ZZ(characteristic(k))), a))
end

# TODO : Should be fixed in Hecke for prime fields
Expand Down Expand Up @@ -348,7 +348,7 @@ function _extension_with_tower_basis(
push!(lcoeffs, one(K))
pmat = identity_matrix(K, Int(deg))
vname = "x" * string(deg)
L, X = finite_field(polynomial(K, lcoeffs), vname)
L, X = Native.finite_field(polynomial(K, lcoeffs), vname)
set_standard_finite_field!(L)
set_primitive_powers_in_tower_basis!(L, pmat)

Expand Down Expand Up @@ -439,7 +439,7 @@ function _extension_with_tower_basis(
# pmat gives the primitive powers in the tower basis for the new extension

vname = "x" * string(d)
L, X = finite_field(polynomial(F, poly), vname)
L, X = Native.finite_field(polynomial(F, poly), vname)
set_standard_finite_field!(L)
set_primitive_powers_in_tower_basis!(L, pmat)

Expand All @@ -461,7 +461,7 @@ Finite field of degree 24 over GF(3)
"""
function standard_finite_field(p::IntegerUnion, n::IntegerUnion)
@req is_prime(p) "first argument must be a prime"
F = GF(p)
F = Native.GF(p)
set_standard_prime_field!(F)

function _sff(N::Fac{ZZRingElem})
Expand Down
5 changes: 3 additions & 2 deletions experimental/StandardFiniteFields/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ GAP.Packages.load("StandardFF")
poly = GAP.Globals.StandardFiniteField(Int(p), n)
poly = GAP.Globals.DefiningPolynomial(poly)
poly = GAP.Globals.CoefficientsOfUnivariatePolynomial(poly)
poly = polynomial(GF(p), map(GF(p), Vector{GAP.FFE}(poly)))
k = Nemo.Native.GF(p)
poly = polynomial(k, map(k, Vector{GAP.FFE}(poly)))
end

function compare_poly(p, n)
F = GF(p)
F = Nemo.Native.GF(p)
F.(collect(coefficients(MyPoly(p, n)))) == F.(collect(coefficients(GAPPoly(p, n))))
end

Expand Down
2 changes: 1 addition & 1 deletion src/GAP/iso_gap_oscar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function _iso_gap_oscar_residue_ring(RG::GAP.GapObj)
end

function _iso_gap_oscar_field_finite(FG::GAP.GapObj)
FO = Nemo._GF(characteristic(FG), GAPWrap.DegreeOverPrimeField(FG))
FO = GF(characteristic(FG), GAPWrap.DegreeOverPrimeField(FG))

finv, f = _iso_oscar_gap_field_finite_functions(FO, FG)

Expand Down
2 changes: 1 addition & 1 deletion src/Groups/group_characters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,7 @@ function character_field(chi::GAPGroupClassFunction)
q = order_field_of_definition(chi)
flag, e, pp = is_prime_power_with_data(q)
(flag && p == pp) || error("something is wrong with 'GAPWrap.SizeOfFieldOfDefinition'")
F = Nemo._GF(p, e)
F = GF(p, e)
return (F, identity_map(F))
end

Expand Down
2 changes: 1 addition & 1 deletion src/Groups/matrices/FiniteFormOrthogonalGroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function _gens_form(G::Union{ZZModMatrix, zzModMatrix}, form_constructor, p)
Oq = isometry_group(q)
gensOq = gens(Oq)
gensOq = [change_base_ring(FF,matrix(g)) for g in gensOq]
gensOq = [change_base_ring(R,lift(g)) for g in gensOq]
gensOq = [change_base_ring(R,map(x -> lift(ZZ, x), g)) for g in gensOq]

return gensOq
end
Expand Down
Loading

0 comments on commit f4f7ea8

Please sign in to comment.