Skip to content

Commit 72e78a1

Browse files
adds function for dim computation
1 parent 098e373 commit 72e78a1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/algorithms/other-algorithms.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
11
function dimension(I::Ideal{T}) where T <: MPolyRingElem
22

3+
gb = isempty(values(I.gb)) ? groebner_basis(I) : first(values(I.gb))
4+
R = parent(first(gb))
5+
res = [trues(ngens(R))]
6+
7+
lms = (Nemo.leading_monomial).(gb)
8+
for lm in lms
9+
to_del = Int[]
10+
new_miss = BitVector[]
11+
for (i, mis) in enumerate(res)
12+
nz_exps_inds = findall(e -> !iszero(e),
13+
first(Nemo.exponent_vectors(lm)))
14+
ind_var_inds = findall(mis)
15+
if issubset(nz_exps_inds, ind_var_inds)
16+
for j in nz_exps_inds
17+
new_mis = copy(mis)
18+
new_mis[j] = false
19+
push!(new_miss, new_mis)
20+
end
21+
push!(to_del, i)
22+
end
23+
end
24+
deleteat!(res, to_del)
25+
append!(res, new_miss)
26+
unique!(res)
27+
end
28+
29+
max_length = maximum(mis -> length(findall(mis)), res)
30+
return max_length
331
end

0 commit comments

Comments
 (0)