You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@polyvar X[1:N]
current =1
xs = [xi * c for xi in x for c in current]
10-element Vector{Term{Int64, M} where M<:Monomial}:
X₁
X₂
X₃
X₄
⋮
X₈
X₉
X₁₀
julia>dot(xs, rand(10))
ERROR: MethodError: no method matching zero(::Type{Any})
Closest candidates are:zero(::Type{Union{Missing, T}}) where T at missing.jl:105zero(::Union{Type{P}, P}) where P<:Dates.Period at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Dates/src/periods.jl:53zero(::Union{Monomial, Polynomial, Term, Variable}) at /home/mbesancon/.julia/packages/TypedPolynomials/0HQcW/src/operators.jl:5...
Stacktrace:
[1] zero(#unused#::Type{Any})
@ Base ./missing.jl:106
[2] zero(#unused#::Type{Term{Int64, M} where M<:Monomial})
@ MultivariatePolynomials ~/.julia/packages/MultivariatePolynomials/bsuXE/src/term.jl:152
[3] promote_operation(op::typeof(*), #unused#::Type{Term{Int64, M} where M<:Monomial}, #unused#::Type{Float64})
@ MutableArithmetics ~/.julia/packages/MutableArithmetics/bPWR4/src/interface.jl:24
[4] promote_sum_mul(T::Type, S::Type)
@ MutableArithmetics ~/.julia/packages/MutableArithmetics/bPWR4/src/linear_algebra.jl:169
[5] operate(#unused#::typeof(dot), x::Vector{Term{Int64, M} where M<:Monomial}, y::Vector{Float64})
@ MutableArithmetics ~/.julia/packages/MutableArithmetics/bPWR4/src/linear_algebra.jl:430
[6] dot(lhs::Vector{Term{Int64, M} where M<:Monomial}, rhs::Vector{Float64})
@ MutableArithmetics ~/.julia/packages/MutableArithmetics/bPWR4/src/dispatch.jl:13
The text was updated successfully, but these errors were encountered:
The issue is that the eltype of xs is not concrete so zero does not work.
This is because the vector comprehension widen the eltype instead of promoting the elements to a common type.
Anotating the eltype to the promoted type should make it work
The text was updated successfully, but these errors were encountered: