Skip to content

Commit

Permalink
ModStdQt ref_ff_rc regression fix (#3405)
Browse files Browse the repository at this point in the history
* adds fix so proper types are passed to content and so on
  • Loading branch information
antonydellavecchia committed Feb 21, 2024
1 parent fe88fbf commit dc5030d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions experimental/ModStd/ModStdQt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ A generic fraction free row echelon form for matrices over multivariate
function ref_ff_rc!(M::MatElem{<:MPolyRingElem})
rk = 0
for i=1:nrows(M)
c = content(M[i, :])
c = content(M[i:i, :])
if !isone(c)
M[i, :] = divexact(M[i, :], c)
M[i, :] = divexact(M[i:i, :], c)
end
end
j = 1
Expand Down Expand Up @@ -524,8 +524,8 @@ function ref_ff_rc!(M::MatElem{<:MPolyRingElem})
continue
end
g, a, b = gcd_with_cofactors(M[k, j], M[i, j])
M[k, :] = b*M[k, :] - a * M[i, :]
M[k, :] = divexact(M[k, :], content(M[k, :]))
M[k, :] = b*M[k:k, :] - a * M[i:i, :]
M[k, :] = divexact(M[k:k, :], content(M[k:k, :]))
end
j += 1
end
Expand Down
7 changes: 7 additions & 0 deletions experimental/ModStd/test/ModStdQt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ end
f = factor_absolute(u^2+v^2*a)
@test length(f) == 2
end

@testset "Examples.ref_ff_rc!" begin
S, (a, b) = polynomial_ring(QQ, ["a", "b"]);
A = matrix(S, [a b; b a])
Oscar.ModStdQt.ref_ff_rc!(A)
@test A == matrix(S, [a b ; 0 1])
end

0 comments on commit dc5030d

Please sign in to comment.