Skip to content

Commit 4c2e1ee

Browse files
committed
chore: adjust compat entry for Nemo and bump version
1 parent 40127ab commit 4c2e1ee

File tree

7 files changed

+36
-34
lines changed

7 files changed

+36
-34
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AlgebraicSolving"
22
uuid = "66b61cbe-0446-4d5d-9090-1ff510639f9d"
33
authors = ["ederc <[email protected]>", "Mohab Safey El Din <[email protected]", "Rafael Mohr <[email protected]>"]
4-
version = "0.4.5"
4+
version = "0.4.6"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -17,7 +17,7 @@ msolve_jll = "6d01cc9a-e8f6-580e-8c54-544227e08205"
1717

1818
[compat]
1919
LoopVectorization = "0.12"
20-
Nemo = "0.35.1, 0.36, 0.37, 0.38"
20+
Nemo = "0.35.1, 0.36, 0.37, 0.38, 0.39"
2121
StaticArrays = "1"
2222
julia = "1.6"
2323
LinearAlgebra = "1.6"

docs/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
99
[compat]
1010
Documenter = "0.26"
1111
msolve_jll = "0.6.1"
12-
Nemo = "0.35.1"

src/algorithms/groebner-bases.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
2727
julia> using AlgebraicSolving
2828
2929
julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex)
30-
(Multivariate polynomial ring in 3 variables over GF(101), fpMPolyRingElem[x, y, z])
30+
(Multivariate polynomial ring in 3 variables over GF(101), FqMPolyRingElem[x, y, z])
3131
3232
julia> I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
33-
fpMPolyRingElem[x + 2*y + 2*z + 100, x^2 + 2*y^2 + 2*z^2 + 100*x, 2*x*y + 2*y*z + 100*y]
33+
FqMPolyRingElem[x + 2*y + 2*z + 100, x^2 + 2*y^2 + 2*z^2 + 100*x, 2*x*y + 2*y*z + 100*y]
3434
3535
julia> eliminate(I, 2)
36-
1-element Vector{fpMPolyRingElem}:
36+
1-element Vector{FqMPolyRingElem}:
3737
z^4 + 38*z^3 + 95*z^2 + 95*z
3838
```
3939
"""
@@ -81,20 +81,20 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
8181
julia> using AlgebraicSolving
8282
8383
julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex)
84-
(Multivariate polynomial ring in 3 variables over GF(101), fpMPolyRingElem[x, y, z])
84+
(Multivariate polynomial ring in 3 variables over GF(101), FqMPolyRingElem[x, y, z])
8585
8686
julia> I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
87-
fpMPolyRingElem[x + 2*y + 2*z + 100, x^2 + 2*y^2 + 2*z^2 + 100*x, 2*x*y + 2*y*z + 100*y]
87+
FqMPolyRingElem[x + 2*y + 2*z + 100, x^2 + 2*y^2 + 2*z^2 + 100*x, 2*x*y + 2*y*z + 100*y]
8888
8989
julia> groebner_basis(I)
90-
4-element Vector{fpMPolyRingElem}:
90+
4-element Vector{FqMPolyRingElem}:
9191
x + 2*y + 2*z + 100
9292
y*z + 82*z^2 + 10*y + 40*z
9393
y^2 + 60*z^2 + 20*y + 81*z
9494
z^3 + 28*z^2 + 64*y + 13*z
9595
9696
julia> groebner_basis(I, eliminate=2)
97-
1-element Vector{fpMPolyRingElem}:
97+
1-element Vector{FqMPolyRingElem}:
9898
z^4 + 38*z^3 + 95*z^2 + 95*z
9999
```
100100
"""

src/algorithms/normal-forms.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Gröbner basis, then this one is first computed.
2727
julia> using AlgebraicSolving
2828
2929
julia> R, (x,y) = polynomial_ring(GF(101),["x","y"])
30-
(Multivariate polynomial ring in 2 variables over GF(101), fpMPolyRingElem[x, y])
30+
(Multivariate polynomial ring in 2 variables over GF(101), FqMPolyRingElem[x, y])
3131
3232
julia> I = Ideal([y*x^3+12-y, x+y])
33-
fpMPolyRingElem[x^3*y + 100*y + 12, x + y]
33+
FqMPolyRingElem[x^3*y + 100*y + 12, x + y]
3434
3535
julia> f = 2*x^2+7*x*y
3636
2*x^2 + 7*x*y
@@ -74,18 +74,18 @@ Gröbner basis, then this one is first computed.
7474
julia> using AlgebraicSolving
7575
7676
julia> R, (x,y) = polynomial_ring(GF(101),["x","y"])
77-
(Multivariate polynomial ring in 2 variables over GF(101), fpMPolyRingElem[x, y])
77+
(Multivariate polynomial ring in 2 variables over GF(101), FqMPolyRingElem[x, y])
7878
7979
julia> I = Ideal([y*x^3+12-y, x+y])
80-
fpMPolyRingElem[x^3*y + 100*y + 12, x + y]
80+
FqMPolyRingElem[x^3*y + 100*y + 12, x + y]
8181
8282
julia> F = [2*x^2+7*x*y, x+y]
83-
2-element Vector{fpMPolyRingElem}:
83+
2-element Vector{FqMPolyRingElem}:
8484
2*x^2 + 7*x*y
8585
x + y
8686
8787
julia> normal_form(F,I)
88-
2-element Vector{fpMPolyRingElem}:
88+
2-element Vector{FqMPolyRingElem}:
8989
96*y^2
9090
0
9191
```

src/exports.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export polynomial_ring, MPolyRing, GFElem, MPolyRingElem, finite_field, GF, fpMPolyRingElem,
22
characteristic, degree, ZZ, QQ, vars, nvars, ngens, ZZRingElem, QQFieldElem, QQMPolyRingElem,
3-
base_ring, coefficient_ring, evaluate, prime_field, sig_groebner_basis, cyclic, leading_coefficient
3+
base_ring, coefficient_ring, evaluate, prime_field, sig_groebner_basis, cyclic, leading_coefficient,
4+
FqMPolyRingElem

src/siggb/siggb.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ signature and the second the underlying polynomial.
3535
julia> using AlgebraicSolving
3636
3737
julia> R, vars = polynomial_ring(GF(17), ["x$i" for i in 1:4])
38-
(Multivariate polynomial ring in 4 variables over GF(17), fpMPolyRingElem[x1, x2, x3, x4])
38+
(Multivariate polynomial ring in 4 variables over GF(17), FqMPolyRingElem[x1, x2, x3, x4])
3939
4040
julia> F = AlgebraicSolving.cyclic(R)
41-
fpMPolyRingElem[x1 + x2 + x3 + x4, x1*x2 + x1*x4 + x2*x3 + x3*x4, x1*x2*x3 + x1*x2*x4 + x1*x3*x4 + x2*x3*x4, x1*x2*x3*x4 + 16]
41+
FqMPolyRingElem[x1 + x2 + x3 + x4, x1*x2 + x1*x4 + x2*x3 + x3*x4, x1*x2*x3 + x1*x2*x4 + x1*x3*x4 + x2*x3*x4, x1*x2*x3*x4 + 16]
4242
4343
julia> Fhom = AlgebraicSolving._homogenize(F.gens)
44-
4-element Vector{fpMPolyRingElem}:
44+
4-element Vector{FqMPolyRingElem}:
4545
x1 + x2 + x3 + x4
4646
x1*x2 + x2*x3 + x1*x4 + x3*x4
4747
x1*x2*x3 + x1*x2*x4 + x1*x3*x4 + x2*x3*x4
4848
x1*x2*x3*x4 + 16*x5^4
4949
5050
julia> sig_groebner_basis(Fhom)
51-
7-element Vector{Tuple{Tuple{Int64, fpMPolyRingElem}, fpMPolyRingElem}}:
51+
7-element Vector{Tuple{Tuple{Int64, FqMPolyRingElem}, FqMPolyRingElem}}:
5252
((1, 1), x1 + x2 + x3 + x4)
5353
((2, 1), x2^2 + 2*x2*x4 + x4^2)
5454
((3, 1), x2*x3^2 + x3^2*x4 + 16*x2*x4^2 + 16*x4^3)
@@ -59,7 +59,7 @@ julia> sig_groebner_basis(Fhom)
5959
```
6060
"""
6161
function sig_groebner_basis(sys::Vector{T}; info_level::Int=0, degbound::Int=0) where {T <: MPolyRingElem}
62-
R = first(sys).parent
62+
R = parent(first(sys))
6363
Rchar = characteristic(R)
6464

6565
# check if input is ok
@@ -131,9 +131,9 @@ function sig_groebner_basis(sys::Vector{T}; info_level::Int=0, degbound::Int=0)
131131
m = monomial(SVector{nv}((Exp).(exps[j])))
132132
eidx = insert_in_hash_table!(basis_ht, m)
133133
if isone(j)
134-
inver = inv(Coeff(cfs[1].data), char)
134+
inver = inv(Coeff(lift(ZZ, cfs[1])), char)
135135
end
136-
cf = isone(j) ? one(Coeff) : mul(inver, Coeff(cfs[j].data), char)
136+
cf = isone(j) ? one(Coeff) : mul(inver, Coeff(lift(ZZ, cfs[j])), char)
137137
mons[j] = eidx
138138
coeffs[j] = cf
139139
end
@@ -181,13 +181,13 @@ function sig_groebner_basis(sys::Vector{T}; info_level::Int=0, degbound::Int=0)
181181
exps = [basis_ht.exponents[m].exps for m in basis.monomials[i]]
182182
ctx = MPolyBuildCtx(R)
183183
for (e, c) in zip(exps, basis.coefficients[i])
184-
push_term!(ctx, c, Vector{Int}(e))
184+
push_term!(ctx, coefficient_ring(R)(c), Vector{Int}(e))
185185
end
186186
pol = finish(ctx)
187187

188188
s = basis.sigs[i]
189189
ctx = MPolyBuildCtx(R)
190-
push_term!(ctx, 1, Vector{Int}(monomial(s).exps))
190+
push_term!(ctx, one(coefficient_ring(R)), Vector{Int}(monomial(s).exps))
191191
sig = (Int(index(s)), finish(ctx))
192192

193193
push!(outp, (sig, pol))

test/interfaces/nemo.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
F = [x^2+1-3, x*y-z, x*z^2-3*y^2]
44
cmp = (Int32[2, 2, 2], BigInt[1, 1, -2, 1, 1, 1, -1, 1, 1, 1, -3, 1], Int32[2, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0])
55
@test AlgebraicSolving._convert_to_msolve(F) == cmp
6-
R, (x,y,z) = polynomial_ring(GF(2147483659),["x","y","z"], ordering=:degrevlex)
7-
F = [x^2+1-3, x*y-z, x*z^2-3*y^2]
8-
# prime is bigger than 2^31, should throw an error
9-
@test_throws ErrorException AlgebraicSolving._convert_to_msolve(F)
10-
R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex)
11-
F = [x^2+1-3, x*y-z, x*z^2-3*y^2]
12-
res = AlgebraicSolving._convert_to_msolve(F)
13-
@test AlgebraicSolving._convert_finite_field_array_to_abstract_algebra(Int32(3), res..., R) == F
6+
for _GF in [GF, AlgebraicSolving.Nemo.Native.GF]
7+
R, (x,y,z) = polynomial_ring(_GF(2147483659),["x","y","z"], ordering=:degrevlex)
8+
F = [x^2+1-3, x*y-z, x*z^2-3*y^2]
9+
# prime is bigger than 2^31, should throw an error
10+
@test_throws ErrorException AlgebraicSolving._convert_to_msolve(F)
11+
R, (x,y,z) = polynomial_ring(_GF(101),["x","y","z"], ordering=:degrevlex)
12+
F = [x^2+1-3, x*y-z, x*z^2-3*y^2]
13+
res = AlgebraicSolving._convert_to_msolve(F)
14+
@test AlgebraicSolving._convert_finite_field_array_to_abstract_algebra(Int32(3), res..., R) == F
15+
end
1416
end

0 commit comments

Comments
 (0)