Skip to content

Commit de0a110

Browse files
authored
Merge pull request #19 from RafaelDavidMohr/f5
Signature Gröbner basis implementation
2 parents f86e10b + 943c411 commit de0a110

File tree

14 files changed

+1879
-7
lines changed

14 files changed

+1879
-7
lines changed

Project.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
name = "AlgebraicSolving"
22
uuid = "66b61cbe-0446-4d5d-9090-1ff510639f9d"
3-
authors = ["ederc <[email protected]>",
4-
"Mohab Safey El Din <[email protected]"]
3+
authors = ["ederc <[email protected]>", "Mohab Safey El Din <[email protected]", "Rafael Mohr <[email protected]>"]
54
version = "0.3.6"
65

76
[deps]
87
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
8+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
9+
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
910
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
10-
msolve_jll = "6d01cc9a-e8f6-580e-8c54-544227e08205"
1111
Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
12+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
13+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
14+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1215
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
16+
msolve_jll = "6d01cc9a-e8f6-580e-8c54-544227e08205"
1317

1418
[compat]
19+
Nemo = "0.35.1, 0.36, 0.37"
1520
julia = "1.6"
1621
msolve_jll = "0.4.6"
17-
Nemo = "0.35.1, 0.36, 0.37"

docs/src/groebner-bases.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ AlgebraicSolving allows to compute Gröbner bases for input generators over fini
2121
fields of characteristic smaller $2^{31}$ w.r.t. the degree reverse
2222
lexicographical monomial order.
2323

24-
At the moment different variants of Faugère's F4 Algorithm are implemented.
24+
At the moment different variants of Faugère's F4 Algorithm are implemented as
25+
well as a signature based algorithm to compute Gröbner bases.
2526

2627
## Functionality
2728

@@ -56,3 +57,13 @@ variables of the first block via the `eliminate` parameter in the
5657
info_level::Int=0
5758
)
5859
```
60+
61+
To compute signature Gröbner bases use
62+
63+
```@docs
64+
sig_groebner_basis(
65+
sys::Vector{T} where T <: MPolyElem,
66+
info_level::Int=0,
67+
degbound::Int=0
68+
)
69+
```

src/AlgebraicSolving.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ include("types.jl")
1111
include("interfaces/nemo.jl")
1212
include("algorithms/groebner-bases.jl")
1313
include("algorithms/solvers.jl")
14+
#= siggb =#
15+
include("siggb/siggb.jl")
1416
#= examples =#
1517
include("examples/katsura.jl")
18+
include("examples/cyclic.jl")
1619

1720
end # module AlgebraicSolving

src/algorithms/solvers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function _core_msolve(
171171
k = 1
172172
while i <= len
173173
j = 1
174-
tmp = Vector{Nemo.QQFieldElem}(undef, nr_vars)
174+
tmp = Vector{QQFieldElem}(undef, nr_vars)
175175
while j <= nr_vars
176176
tmp[j] = QQFieldElem(unsafe_load(jl_sols_num, i)) >> Int64(unsafe_load(jl_sols_den, i))
177177
tmp[j] += QQFieldElem(unsafe_load(jl_sols_num, i+1)) >> Int64(unsafe_load(jl_sols_den, i+1))

src/examples/cyclic.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@doc Markdown.doc"""
2+
cyclic(R::MPolyRing)
3+
4+
Return the Cyclic ideal in the variables of `R`.
5+
6+
# Example
7+
```jldoctest
8+
julia> using AlgebraicSolving
9+
10+
julia> R, vars = polynomial_ring(QQ, ["x$i" for i in 1:4])
11+
(Multivariate polynomial ring in 4 variables over QQ, QQMPolyRingElem[x1, x2, x3, x4])
12+
13+
julia> cyclic(R)
14+
QQMPolyRingElem[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 - 1]
15+
```
16+
"""
17+
function cyclic(R::MPolyRing)
18+
vars = gens(R)
19+
n = length(vars)
20+
pols = [sum(prod(vars[j%n+1] for j in k:k+i) for k in 1:n) for i in 0:n-2]
21+
push!(pols, prod(vars[i] for i in 1:n)-1)
22+
return Ideal(pols)
23+
end

src/exports.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
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
3+
base_ring, coefficient_ring, evaluate, prime_field, sig_groebner_basis, cyclic

src/imports.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ using Test
33
using msolve_jll
44
using Nemo
55
using LinearAlgebra
6+
using StaticArrays
7+
using LoopVectorization
8+
9+
import Random: MersenneTwister
10+
import Logging: ConsoleLogger, with_logger, Warn, Info
11+
import Printf: @sprintf
612

713
import Nemo:
814
bell,

0 commit comments

Comments
 (0)