Skip to content

Commit 089e440

Browse files
authored
Merge pull request #93 from RafaelDavidMohr/rm/larger-bitmasks
Larger bitmasks
2 parents 4e0d7ec + 8b6e96d commit 089e440

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

src/algorithms/decomposition.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@doc Markdown.doc"""
2-
function equidimensional_decomposition(I::Ideal{T}, info_level::Int=0) where {T <: MPolyRingElem}
2+
equidimensional_decomposition(I::Ideal{T}, info_level::Int=0) where {T <: MPolyRingElem}
33
44
Given a polynomial ideal `I`, return a list of ideals `dec` s.t.
55
each ideal in `dec` is equidimensional (i.e. has minimal primes

src/siggb/hashtable.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ end
3434

3535
# initialize and set fields for basis hashtable
3636
function initialize_basis_hash_table(::Val{N}) where N
37-
38-
# for now at most 32 variables
39-
if N > 32
40-
error("At most 32 variables currently supported.")
41-
end
4237

4338
# not necessary to create `initial_size` exponents
4439
exponents = Vector{Monomial{N}}(undef, init_ht_size)
@@ -50,8 +45,7 @@ function initialize_basis_hash_table(::Val{N}) where N
5045
size = init_ht_size
5146

5247
# initialize fast divisibility params
53-
int32bits = 32
54-
ndivbits = div(int32bits, N)
48+
ndivbits = div(DivMaskSize, N)
5549
# division mask stores at least 1 bit
5650
# per each of first ndivvars variables
5751
ndivbits == 0 && (ndivbits += 1)
@@ -270,16 +264,17 @@ function fill_divmask!(ht::MonomialHashtable{N}) where N
270264
end
271265

272266
ctr = 1
273-
steps = UInt32(0)
267+
steps = DivMask(0)
274268
@inbounds for i in 1:N
275-
steps = div(max_exp[i] - min_exp[i], UInt32(ht.ndivbits))
276-
(iszero(steps)) && (steps += UInt32(1))
269+
steps = div(DivMask(max_exp[i] - min_exp[i]), DivMask(ht.ndivbits))
270+
(iszero(steps)) && (steps += DivMask(1))
277271
for j in 1:ht.ndivbits
278272
ht.divmap[ctr] = steps
279-
steps += UInt32(1)
273+
steps += DivMask(1)
280274
ctr += 1
281275
end
282276
end
277+
283278
@inbounds for vidx in 1:ht.load
284279
m = ht.exponents[vidx]
285280
divm = divmask(m, ht.divmap, ht.ndivbits)

src/siggb/monomials.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ function divmask(e::Monomial{N},
121121
ctr = one(DivMask)
122122
res = zero(DivMask)
123123
o = one(DivMask)
124+
lb = N > DivMaskSize ? N - DivMaskSize : 1
124125
for i in N:-1:1
125126
for j in 1:ndivbits
126127
@inbounds if e.exps[i] >= divmap[ctr]

src/siggb/siggb.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ include("helpers.jl")
2424
#---------------- user functions --------------------#
2525

2626
@doc Markdown.doc"""
27-
function sig_groebner_basis(sys::Vector{T}; info_level::Int=0, degbound::Int=0, mod_ord::Symbol=:POT) where {T <: MPolyRingElem}
27+
sig_groebner_basis(sys::Vector{T}; info_level::Int=0, degbound::Int=0, mod_ord::Symbol=:POT) where {T <: MPolyRingElem}
2828
2929
Compute a Signature Gröbner basis of the sequence `sys` w.r.t. to the
3030
degree reverse lexicographical monomial ordering and the module order

src/siggb/typedefs.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const Exp = Int16
66
# types for hashvalue, ht index and divisor mask of a monomial
77
const MonIdx = Int32
88
const MonHash = UInt32
9-
const DivMask = UInt32
9+
const DivMask = UInt64
10+
const DivMaskSize = 64
1011
# stuff for matrix
1112
const ColIdx = UInt32
1213
const Coeff = UInt32
@@ -45,7 +46,7 @@ mutable struct MonomialHashtable{N}
4546

4647
#= Monom divisibility =#
4748
# divisor map to check divisibility faster
48-
divmap::Vector{UInt32}
49+
divmap::Vector{DivMask}
4950
# bits per div variable
5051
ndivbits::Int
5152

0 commit comments

Comments
 (0)