Skip to content

Commit 20f129e

Browse files
committed
interpolation: work with integer vector for FLINT interp
1 parent f0ab351 commit 20f129e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/algorithms/param-curve.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function rational_curve_parametrization(
8484

8585
# Compute DEG+2 evaluations of x in the param (whose total deg is bounded by DEG)
8686
PARAM = Vector{Vector{QQPolyRingElem}}(undef, DEG+2)
87-
_values = Vector{QQFieldElem}(undef, DEG+2)
87+
_values = Vector{ZZRingElem}(undef, DEG+2)
8888
i = 1
8989
free_ind = collect(1:DEG+2)
9090
used_ind = zeros(Bool, DEG+2)
@@ -96,7 +96,7 @@ function rational_curve_parametrization(
9696
# Evaluation of the generator at values x s.t. 0 <= |x|-i <= length(free_ind)/2
9797
# plus one point at -(length(free_ind)+1)/2 if the length if odd.
9898
# This reduces a bit the bitsize of the evaluation
99-
curr_values = QQ.([-(i-1+(length(free_ind)+1)÷2):-i;i:(i-1+length(free_ind)÷2)])
99+
curr_values = ZZ.([-(i-1+(length(free_ind)+1)÷2):-i;i:(i-1+length(free_ind)÷2)])
100100
LFeval = Ideal.(_evalvar(F, N-1, curr_values))
101101
# Compute parametrization of each evaluation
102102
Lr = Vector{RationalParametrization}(undef, length(free_ind))
@@ -137,11 +137,11 @@ function rational_curve_parametrization(
137137
info_level>0 && print("Interpolate parametrizations: $count/$N\r")
138138
COEFFS = Vector{QQPolyRingElem}(undef, DEG+1)
139139
for deg in 0:DEG
140-
_evals = [coeff(PARAM[i][count], deg) for i in 1:length(PARAM)]
141-
# Remove denominators for faster interpolation
142-
den = lcm(denominator.(_evals))
143-
_evals *= den
144-
COEFFS[deg+1] = interpolate(A, _values, _evals) / (lc*den)
140+
_evals = [coeff(PARAM[i][count], deg) for i in eachindex(PARAM)]
141+
# Remove denominators for faster interpolation with FLINT
142+
den = foldl(lcm, denominator.(_evals))
143+
scaled_evals = [ZZ(_evals[i] * den) for i in eachindex(_evals)]
144+
COEFFS[deg+1] = interpolate(A, _values, scaled_evals) / (lc*den)
145145
end
146146
ctx = MPolyBuildCtx(T)
147147
for (i, c) in enumerate(COEFFS)

0 commit comments

Comments
 (0)