Skip to content

Commit 5c432ed

Browse files
committed
first draft for rational_solutions function (case where no linear form is introduced is now handled)
1 parent ab2f709 commit 5c432ed

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

src/algorithms/solvers.jl

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,18 @@ function rational_solutions(
268268
info_level = info_level,
269269
precision = precision)
270270
param_t = I.rat_param
271-
if length(param_t.vars) == parent(I).nvars
272-
nvars = length(param_t.vars)
273-
lpol = filter(l->degree(l) == 1, keys(factor(param_t.elim).fac))
274-
nb = length(lpol)
275271

276-
rat_elim = [-coeff(l, 0)// coeff(l, 1) for l in lpol]
277-
rat_den = map(l->evaluate(param_t.denom, l), rat_elim)
278-
rat_num = map(r->map(l->evaluate(l, r), param_t.param), rat_elim)
272+
nvars = length(param_t.vars)
273+
lpol = filter(l->degree(l) == 1, keys(factor(param_t.elim).fac))
274+
nb = length(lpol)
275+
276+
rat_elim = [-coeff(l, 0)// coeff(l, 1) for l in lpol]
277+
rat_den = map(l->evaluate(param_t.denom, l), rat_elim)
278+
rat_num = map(r->map(l->evaluate(l, r), param_t.param), rat_elim)
279279

280-
rat_sols = Vector{Vector{fmpq}}(undef, nb)
280+
rat_sols = Vector{Vector{fmpq}}(undef, nb)
281+
282+
if length(param_t.vars) == parent(I).nvars
281283

282284
for i in 1:nb
283285
rat_sols[i] = Vector{fmpq}(undef, nvars)
@@ -286,11 +288,20 @@ function rational_solutions(
286288
end
287289
rat_sols[i][nvars] = rat_elim[i]
288290
end
291+
289292
else
290-
println("Not implemented yet")
291-
return []
293+
294+
for i in 1:nb
295+
rat_sols[i] = Vector{fmpq}(undef, nvars - 1)
296+
for j in 1:(nvars-1)
297+
rat_sols[i][j] = rat_num[i][j] // rat_den[i]
298+
end
299+
end
300+
292301
end
302+
293303
return rat_sols
304+
294305
end
295306

296307
@doc Markdown.doc"""

0 commit comments

Comments
 (0)