From d9cb42dcd6236876f24129638d5e42afe8fe0693 Mon Sep 17 00:00:00 2001 From: pogudingleb Date: Sun, 26 Jan 2025 23:41:30 +0100 Subject: [PATCH] adding zero-dim check --- src/primality_check.jl | 3 +++ test/quotient_basis.jl | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/primality_check.jl b/src/primality_check.jl index f0be38bd..251ae499 100644 --- a/src/primality_check.jl +++ b/src/primality_check.jl @@ -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 = [] diff --git a/test/quotient_basis.jl b/test/quotient_basis.jl index 4a4ce1bc..4d1f0133 100644 --- a/test/quotient_basis.jl +++ b/test/quotient_basis.jl @@ -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