Skip to content

Commit 616cacb

Browse files
author
Remi Prebet
committed
check genericity second variable
1 parent 20f129e commit 616cacb

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/algorithms/param-curve.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@doc Markdown.doc"""
22
rational_curve_parametrization(I::Ideal{T} where T <: MPolyRingElem, <keyword arguments>)
33
4-
Given an ideal `I` with solution set X being of dimension 1 over the complex numbers, return
5-
a rational curve parametrization of the one-dimensional irreducible components of X.
4+
Given a **radical** ideal `I` with solution set X being of dimension 1 over the complex numbers,
5+
return a rational curve parametrization of the one-dimensional irreducible components of X.
66
77
In the output, the variables `x`,`y` of the parametrization correspond to the last two
88
entries of the `vars` attribute, in that order.
@@ -76,10 +76,12 @@ function rational_curve_parametrization(
7676
while any(is_divisible_by.(val, Ref(lucky_prime)))
7777
val = rand(-bif_bound:bif_bound, 2)
7878
end
79-
Fnew = vcat(F, val[1]*gens(R)[N-1] + val[2])
80-
new_lucky_prime = _generate_lucky_primes(Fnew, one(ZZ)<<30, one(ZZ)<<31-1, 1) |> first
81-
local INEW = Ideal(change_base_ring.(Ref(GF(new_lucky_prime)), Fnew))
82-
@assert(dimension(INEW) == 0 && hilbert_degree(INEW) == DEG, "The curve is not in generic position")
79+
for ivar in [N-1, N]
80+
Fnew = vcat(F, val[1]*gens(R)[ivar] + val[2])
81+
new_lucky_prime = _generate_lucky_primes(Fnew, one(ZZ)<<30, one(ZZ)<<31-1, 1) |> first
82+
local INEW = Ideal(change_base_ring.(Ref(GF(new_lucky_prime)), Fnew))
83+
@assert(dimension(INEW) == 0 && hilbert_degree(INEW) == DEG, "The curve is not in generic position")
84+
end
8385
end end
8486

8587
# Compute DEG+2 evaluations of x in the param (whose total deg is bounded by DEG)
@@ -91,7 +93,7 @@ function rational_curve_parametrization(
9193
lc = nothing
9294
while length(free_ind) > 0
9395
if i > 2*(DEG+2)
94-
error("Too many bad specializations: permute variables or use_lfs=true")
96+
error("Too many bad specializations. Check radicality, else permute variables or use_lfs=true")
9597
end
9698
# Evaluation of the generator at values x s.t. 0 <= |x|-i <= length(free_ind)/2
9799
# plus one point at -(length(free_ind)+1)/2 if the length if odd.

test/algorithms/param-curves.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,11 @@
5959

6060
I = Ideal([R(1)])
6161
@test rational_curve_parametrization(I).vars == Symbol[]
62-
end
62+
63+
# Non-generic variables
64+
A,(x,t,u) = polynomial_ring(QQ, [:x,:u,:t])
65+
I = Ideal([t^2+u, u-x])
66+
@test_throws AssertionError rational_curve_parametrization(I)
67+
I = Ideal([u^2+t, t-x])
68+
@test_throws AssertionError rational_curve_parametrization(I)
69+
end

0 commit comments

Comments
 (0)