Skip to content

Commit 0cf443a

Browse files
authored
Merge pull request #90 from ederc/fix-dim
Fix for dimension
2 parents 2b34126 + 135bd33 commit 0cf443a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/algorithms/dimension.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function dimension(I::Ideal{T}) where T <: MPolyRingElem
4444
unique!(res)
4545
end
4646

47+
length(res) == 0 && return -1
4748
max_length = maximum(mis -> length(findall(mis)), res)
4849
return max_length
4950
end

test/algorithms/dimension.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"])
77
I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
88
@test iszero(dimension(I))
9+
10+
I = Ideal([R(1)])
11+
@test dimension(I) == -1
912
end

0 commit comments

Comments
 (0)