Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conversion issue with TypedPolynomials.Polynomial #47

Open
hofmannmartin opened this issue Jul 7, 2022 · 0 comments
Open

conversion issue with TypedPolynomials.Polynomial #47

hofmannmartin opened this issue Jul 7, 2022 · 0 comments

Comments

@hofmannmartin
Copy link

Great package. I am currently using the TypedPolynomials package for the construction of polynomials, as it is the most performant in my use case. However, a straight froward conversion to a StaticPolynomials.Polynomial fails.

using TypedPolynomials
import StaticPolynomials

@polyvar x y z
p = 3*z^2 + 2*y*x
ps = StaticPolynomials.Polynomial(p)

yields

MethodError: no method matching StaticPolynomials.Polynomial(::Vector{Float64}, ::Matrix{Int64}, ::Tuple{Symbol, Symbol, Symbol}, ::Nothing, ::Nothing)

Closest candidates are:
StaticPolynomials.Polynomial(::Vector, ::Matrix{<:Integer}, !Matched::Vector{Symbol}, ::Union{Nothing, Matrix{<:Integer}}, ::Any) at ~/.julia/packages/StaticPolynomials/TgQjK/src/polynomial.jl:63
StaticPolynomials.Polynomial(::Vector{T}, !Matched::StaticPolynomials.SExponents, ::Any, ::Union{Nothing, StaticPolynomials.SExponents}, ::Any, !Matched::Vector{Int64}) where T at ~/.julia/packages/StaticPolynomials/TgQjK/src/polynomial.jl:26
StaticPolynomials.Polynomial(::Vector, ::Matrix{<:Integer}, !Matched::Vector{Symbol}, ::Union{Nothing, Matrix{<:Integer}}) at ~/.julia/packages/StaticPolynomials/TgQjK/src/polynomial.jl:63

The issue seems to be that the Polynomial constructor expects Vector{Symbol} as third argument, but MultivariatePolynomials.variables returns a tuple in this case. That said I found the following workaround:

using TypedPolynomials, MultivariatePolynomials
import StaticPolynomials

@polyvar x y z
p = 3*z^2 + 2*y*x
ps = StaticPolynomials.Polynomial(p, Variable[variables(p)...], nothing)

What could be a permanent solution, which does not require this workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant