Skip to content

Commit

Permalink
Merge pull request #19 from RafaelDavidMohr/f5
Browse files Browse the repository at this point in the history
Signature Gröbner basis implementation
  • Loading branch information
ederc authored Oct 19, 2023
2 parents f86e10b + 943c411 commit de0a110
Show file tree
Hide file tree
Showing 14 changed files with 1,879 additions and 7 deletions.
12 changes: 8 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name = "AlgebraicSolving"
uuid = "66b61cbe-0446-4d5d-9090-1ff510639f9d"
authors = ["ederc <[email protected]>",
"Mohab Safey El Din <[email protected]"]
authors = ["ederc <[email protected]>", "Mohab Safey El Din <[email protected]", "Rafael Mohr <[email protected]>"]
version = "0.3.6"

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

[compat]
Nemo = "0.35.1, 0.36, 0.37"
julia = "1.6"
msolve_jll = "0.4.6"
Nemo = "0.35.1, 0.36, 0.37"
13 changes: 12 additions & 1 deletion docs/src/groebner-bases.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ AlgebraicSolving allows to compute Gröbner bases for input generators over fini
fields of characteristic smaller $2^{31}$ w.r.t. the degree reverse
lexicographical monomial order.

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

## Functionality

Expand Down Expand Up @@ -56,3 +57,13 @@ variables of the first block via the `eliminate` parameter in the
info_level::Int=0
)
```

To compute signature Gröbner bases use

```@docs
sig_groebner_basis(
sys::Vector{T} where T <: MPolyElem,
info_level::Int=0,
degbound::Int=0
)
```
3 changes: 3 additions & 0 deletions src/AlgebraicSolving.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ include("types.jl")
include("interfaces/nemo.jl")
include("algorithms/groebner-bases.jl")
include("algorithms/solvers.jl")
#= siggb =#
include("siggb/siggb.jl")
#= examples =#
include("examples/katsura.jl")
include("examples/cyclic.jl")

end # module AlgebraicSolving
2 changes: 1 addition & 1 deletion src/algorithms/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function _core_msolve(
k = 1
while i <= len
j = 1
tmp = Vector{Nemo.QQFieldElem}(undef, nr_vars)
tmp = Vector{QQFieldElem}(undef, nr_vars)
while j <= nr_vars
tmp[j] = QQFieldElem(unsafe_load(jl_sols_num, i)) >> Int64(unsafe_load(jl_sols_den, i))
tmp[j] += QQFieldElem(unsafe_load(jl_sols_num, i+1)) >> Int64(unsafe_load(jl_sols_den, i+1))
Expand Down
23 changes: 23 additions & 0 deletions src/examples/cyclic.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@doc Markdown.doc"""
cyclic(R::MPolyRing)
Return the Cyclic ideal in the variables of `R`.
# Example
```jldoctest
julia> using AlgebraicSolving
julia> R, vars = polynomial_ring(QQ, ["x$i" for i in 1:4])
(Multivariate polynomial ring in 4 variables over QQ, QQMPolyRingElem[x1, x2, x3, x4])
julia> cyclic(R)
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]
```
"""
function cyclic(R::MPolyRing)
vars = gens(R)
n = length(vars)
pols = [sum(prod(vars[j%n+1] for j in k:k+i) for k in 1:n) for i in 0:n-2]
push!(pols, prod(vars[i] for i in 1:n)-1)
return Ideal(pols)
end
2 changes: 1 addition & 1 deletion src/exports.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export polynomial_ring, MPolyRing, GFElem, MPolyRingElem, finite_field, GF, fpMPolyRingElem,
characteristic, degree, ZZ, QQ, vars, nvars, ngens, ZZRingElem, QQFieldElem, QQMPolyRingElem,
base_ring, coefficient_ring, evaluate, prime_field
base_ring, coefficient_ring, evaluate, prime_field, sig_groebner_basis, cyclic
6 changes: 6 additions & 0 deletions src/imports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ using Test
using msolve_jll
using Nemo
using LinearAlgebra
using StaticArrays
using LoopVectorization

import Random: MersenneTwister
import Logging: ConsoleLogger, with_logger, Warn, Info
import Printf: @sprintf

import Nemo:
bell,
Expand Down
Loading

0 comments on commit de0a110

Please sign in to comment.