|
1 |
| -# ------------------------------------------------------------------------------ |
2 |
| -# adapted from https://gitlab.inria.fr/newrur/code/-/blob/main/Julia/RationalUnivariateRepresentation.jl/src/RationalUnivariateRepresentation.jl?ref_type=heads#L180 |
3 |
| -# thanks to Alexander Demin |
4 |
| -""" |
5 |
| - quotient_basis(J::Array{QQMPolyRingElem, 1}) |
6 |
| -
|
7 |
| -Takes as input a Groebner basis J of a zero-dimensional ideal and |
8 |
| -returns a monomial basis of the quotient ring |
9 |
| -(more precisely, the list of standard monomials) |
10 |
| -""" |
11 |
| -function quotient_basis(J::Array{<:MPolyRingElem, 1}) |
12 |
| - if !Groebner.isgroebner(J) |
13 |
| - throw(DomainError("Input is not a Groebner basis")) |
14 |
| - end |
15 |
| - n = length(gens(parent(first(J)))) |
16 |
| - leading_exponents = [first(Nemo.exponent_vectors(Nemo.leading_monomial(p))) for p in J] |
17 |
| - if length(filter(e -> count(iszero, e) == n - 1, leading_exponents)) < n |
18 |
| - throw(DomainError("Input does not define zerodimensional ideal")) |
19 |
| - end |
20 |
| - exponents_to_check = [[0 for _ in 1:n]] |
21 |
| - exponents_checked = [] |
22 |
| - basis_exponents = [] |
23 |
| - while length(exponents_to_check) > 0 |
24 |
| - e = popfirst!(exponents_to_check) |
25 |
| - push!(exponents_checked, e) |
26 |
| - if !any(map(le -> all(e .>= le), leading_exponents)) |
27 |
| - push!(basis_exponents, e) |
28 |
| - for i in 1:n |
29 |
| - next_e = copy(e) |
30 |
| - next_e[i] += 1 |
31 |
| - if !(next_e in exponents_checked) && !(next_e in exponents_to_check) |
32 |
| - push!(exponents_to_check, next_e) |
33 |
| - end |
34 |
| - end |
35 |
| - end |
36 |
| - end |
37 |
| - return [prod(gens(parent(first(J))) .^ e) for e in basis_exponents] |
38 |
| -end |
39 |
| - |
40 | 1 | # ------------------------------------------------------------------------------
|
41 | 2 |
|
42 | 3 | function check_primality_zerodim(J::Array{QQMPolyRingElem, 1})
|
43 | 4 | J = Groebner.groebner(J)
|
44 |
| - basis = quotient_basis(J) |
| 5 | + basis = Groebner.quotient_basis(J) |
45 | 6 | dim = length(basis)
|
46 | 7 | S = Nemo.matrix_space(Nemo.QQ, dim, dim)
|
47 | 8 | matrices = []
|
|
0 commit comments