Skip to content

Commit 0b81077

Browse files
authored
Merge pull request #30 from RafaelDavidMohr/main
fixes a pivot setting bug
2 parents f583634 + 11b9be8 commit 0b81077

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/siggb/linear_algebra.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function echelonize!(matrix::MacaulayMatrix,
1919
hash2col[col2hash[i]] = MonIdx(i)
2020
end
2121

22-
@inbounds for i in 2:matrix.nrows
22+
@inbounds for i in 1:matrix.nrows
2323
row_ind = matrix.sig_order[i]
2424

2525
row_cols = matrix.rows[row_ind]
@@ -34,7 +34,10 @@ function echelonize!(matrix::MacaulayMatrix,
3434
does_red = !iszero(pividx) && rev_sigorder[pividx] < i
3535
does_red && break
3636
end
37-
!does_red && continue
37+
if !does_red
38+
pivots[l_col_idx] = row_ind
39+
continue
40+
end
3841

3942
# buffer the row
4043
row_coeffs = matrix.coeffs[row_ind]

src/siggb/update.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ function update_basis!(basis::Basis,
7676
insert_in_basis_hash_table_pivots!(row, basis_ht, symbol_ht)
7777
lm = basis_ht.exponents[first(row)]
7878
s = new_sig
79-
# println("new $s, $(lm.exps)")
8079

8180
# add everything to basis
8281
l = basis.basis_load + 1

test/algorithms/groebner-bases.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,13 @@ end
5454
Fhom = AlgebraicSolving._homogenize(F)
5555
sgb = sig_groebner_basis(Fhom)
5656
@test AlgebraicSolving._is_gb(sgb)
57+
58+
#= GB test 4 (pivot setting bug) =#
59+
R, (x1, x2, x3, x4) = polynomial_ring(GF(65521), ["x1", "x2", "x3", "x4"], ordering=:degrevlex)
60+
F = [11523*x1^4 + 30378*x1^3*x2 + 30154*x1^2*x2^2 + 10157*x1*x2^3 - 28136*x2^4 - 4771*x1^3*x3 - 21056*x1^2*x2*x3 + 15696*x1*x2^2*x3 - 16144*x2^3*x3 - 1553*x1^2*x3^2 - 30379*x1*x2*x3^2 - 12735*x2^2*x3^2 + 18058*x1*x3^3 + 24670*x2*x3^3 - 16379*x3^4 + 24196*x1^3*x4 - 19411*x1^2*x2*x4 + 17610*x1*x2^2*x4 - 5715*x2^3*x4 - 21186*x1^2*x3*x4 - 22865*x1*x2*x3*x4 - 1939*x2^2*x3*x4 - 5685*x1*x3^2*x4 + 8508*x2*x3^2*x4 + 21819*x3^3*x4 - 24868*x1^2*x4^2 - 18233*x1*x2*x4^2 - 14116*x2^2*x4^2 + 28291*x1*x3*x4^2 - 9068*x2*x3*x4^2 - 15138*x3^2*x4^2 + 8921*x1*x4^3 - 18808*x2*x4^3 - 3005*x3*x4^3 + 7368*x4^4,
61+
31703*x1^4 + 23616*x1^3*x2 + 20696*x1^2*x2^2 - 7125*x1*x2^3 + 15334*x2^4 + 26619*x1^3*x3 + 2173*x1^2*x2*x3 - 31312*x1*x2^2*x3 - 31386*x2^3*x3 - 25244*x1^2*x3^2 - 28729*x1*x2*x3^2 + 27244*x2^2*x3^2 - 24892*x1*x3^3 + 2046*x2*x3^3 + 2516*x3^4 - 18588*x1^3*x4 + 9980*x1^2*x2*x4 - 10104*x1*x2^2*x4 + 21688*x2^3*x4 - 1315*x1^2*x3*x4 - 17824*x1*x2*x3*x4 + 14919*x2^2*x3*x4 - 568*x1*x3^2*x4 - 22509*x2*x3^2*x4 + 18494*x3^3*x4 + 25947*x1^2*x4^2 - 28652*x1*x2*x4^2 - 25547*x2^2*x4^2 + 1637*x1*x3*x4^2 - 20130*x2*x3*x4^2 + 19739*x3^2*x4^2 + 3742*x1*x4^3 + 25425*x2*x4^3 + 6342*x3*x4^3 - 3004*x4^4,
62+
2857*x1^4 + 8898*x1^3*x2 + 16959*x1^2*x2^2 - 28026*x1*x2^3 - 25631*x2^4 + 11030*x1^3*x3 + 29101*x1^2*x2*x3 + 30359*x1*x2^2*x3 + 27330*x2^3*x3 + 19126*x1^2*x3^2 - 26603*x1*x2*x3^2 + 2510*x2^2*x3^2 + 7575*x1*x3^3 - 25033*x2*x3^3 - 21024*x3^4 + 30501*x1^3*x4 + 23834*x1^2*x2*x4 - 1858*x1*x2^2*x4 - 10862*x2^3*x4 + 30320*x1^2*x3*x4 + 19705*x1*x2*x3*x4 + 28359*x2^2*x3*x4 + 17590*x1*x3^2*x4 + 11929*x2*x3^2*x4 + 22830*x3^3*x4 + 13501*x1^2*x4^2 - 24860*x1*x2*x4^2 + 12598*x2^2*x4^2 - 9409*x1*x3*x4^2 - 2827*x2*x3*x4^2 - 8608*x3^2*x4^2 + 30938*x1*x4^3 - 12892*x2*x4^3 + 9165*x3*x4^3 - 5202*x4^4,
63+
-23687*x1^4 + 32692*x1^3*x2 + 20539*x1^2*x2^2 - 27327*x1*x2^3 + 3928*x2^4 - 13018*x1^3*x3 - 13583*x1^2*x2*x3 - 30594*x1*x2^2*x3 - 12584*x2^3*x3 - 9819*x1^2*x3^2 + 14542*x1*x2*x3^2 + 30297*x2^2*x3^2 + 15188*x1*x3^3 + 28438*x2*x3^3 + 13512*x3^4 + 13327*x1^3*x4 + 14335*x1^2*x2*x4 - 15128*x1*x2^2*x4 - 21922*x2^3*x4 - 22104*x1^2*x3*x4 - 23535*x1*x2*x3*x4 - 4393*x2^2*x3*x4 - 20398*x1*x3^2*x4 + 14310*x2*x3^2*x4 - 4426*x3^3*x4 - 23087*x1^2*x4^2 - 21281*x1*x2*x4^2 + 13831*x2^2*x4^2 - 23378*x1*x3*x4^2 + 18852*x2*x3*x4^2 - 11968*x3^2*x4^2 - 31181*x1*x4^3 + 20091*x2*x4^3 - 14043*x3*x4^3 - 10677*x4^4]
64+
sgb = sig_groebner_basis(F)
65+
@test AlgebraicSolving._is_gb(sgb)
5766
end

0 commit comments

Comments
 (0)