-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
using Nemo
R, () = polynomial_ring(QQ, Symbol[])
x = one(R)
evaluate(x, [])gives the following error:
ERROR: BoundsError: attempt to access 0-element Vector{QQMPolyRingElem} at index [1]
Stacktrace:
[1] throw_boundserror(A::Vector{QQMPolyRingElem}, I::Tuple{Int64})
@ Base ./essentials.jl:15
[2] getindex
@ ./essentials.jl:919 [inlined]
[3] evaluate(a::QQMPolyRingElem, bs::Vector{QQMPolyRingElem})
@ Nemo ~/.julia/packages/Nemo/kdloy/src/flint/fmpq_mpoly.jl:600
[4] evaluate(a::QQMPolyRingElem, vals::Vector{Any})
@ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/T6WZD/src/MPoly.jl:862
[5] top-level scope
@ REPL[5]:1while evaluate(x, QQFieldElem[]) gives the desired result.
Indeed, in the functions below, S = parent(bs[1]) fails when bs is empty...
Nemo.jl/src/flint/fmpq_mpoly.jl
Lines 598 to 624 in f9ccb66
| function evaluate(a::QQMPolyRingElem, bs::Vector{QQMPolyRingElem}) | |
| allequal(map(parent, bs)) || error("parents do not match") | |
| R = parent(a) | |
| S = parent(bs[1]) | |
| length(bs) != nvars(R) && | |
| error("Number of variables does not match number of values") | |
| c = S() | |
| fl = @ccall libflint.fmpq_mpoly_compose_fmpq_mpoly(c::Ref{QQMPolyRingElem}, a::Ref{QQMPolyRingElem}, bs::Ptr{Ref{QQMPolyRingElem}}, R::Ref{QQMPolyRing}, S::Ref{QQMPolyRing})::Cint | |
| fl == 0 && error("Something wrong in evaluation.") | |
| return c | |
| end | |
| function evaluate(a::QQMPolyRingElem, bs::Vector{QQPolyRingElem}) | |
| allequal(map(parent, bs)) || error("parents do not match") | |
| R = parent(a) | |
| S = parent(bs[1]) | |
| length(bs) != nvars(R) && | |
| error("Number of variables does not match number of values") | |
| c = S() | |
| fl = @ccall libflint.fmpq_mpoly_compose_fmpq_poly(c::Ref{QQPolyRingElem}, a::Ref{QQMPolyRingElem}, bs::Ptr{Ref{QQPolyRingElem}}, R::Ref{QQMPolyRing})::Cint | |
| fl == 0 && error("Something wrong in evaluation.") | |
| return c | |
| end |
Metadata
Metadata
Assignees
Labels
No labels