Skip to content

Commit

Permalink
Merge pull request #382 from SciML/check_zerodim
Browse files Browse the repository at this point in the history
Adding zero-dim check to quotient_basis
  • Loading branch information
pogudingleb authored Jan 27, 2025
2 parents 1b7adeb + d9cb42d commit 32f3d24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/primality_check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ function quotient_basis(J::Array{<:MPolyRingElem, 1})
end
n = length(gens(parent(first(J))))
leading_exponents = [first(Nemo.exponent_vectors(Nemo.leading_monomial(p))) for p in J]
if length(filter(e -> count(iszero, e) == n - 1, leading_exponents)) < n
throw(DomainError("Input does not define zerodimensional ideal"))
end
exponents_to_check = [[0 for _ in 1:n]]
exponents_checked = []
basis_exponents = []
Expand Down
4 changes: 4 additions & 0 deletions test/quotient_basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@
@test Set(quotient_basis([x^2, y^2, x * y])) == Set([R(1), y, x])
@test Set(quotient_basis([x^3, y^3, x * y])) == Set([R(1), y, x, y^2, x^2])
@test length(quotient_basis([8x^77 + 1, y^34 - 1])) == 77 * 34

@test_throws DomainError("Input does not define zerodimensional ideal") quotient_basis([
x^2 + y - 3,
])
end

0 comments on commit 32f3d24

Please sign in to comment.