Skip to content

Commit

Permalink
Tweak PolynomialSystem constructor for static compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
saschatimme committed Dec 28, 2018
1 parent a14c0fa commit 164579d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/polynomial_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ struct PolynomialSystem{N, NVars, NParams, PolyTuple<:Tuple}
end

function PolynomialSystem(polys::AbstractVector{<:MP.AbstractPolynomial}; parameters=nothing, variables=diffvars(MP.variables(polys), parameters))
PolynomialSystem(ntuple(i -> Polynomial(polys[i]; variables=variables, parameters=parameters), length(polys))...)
N = length(polys)
polys = ntuple(i -> Polynomial(polys[i]; variables=variables, parameters=parameters), N)
NVars = nvariables(polys[1])
NParams = nparameters(polys[1])
PolynomialSystem{N, NVars, NParams, typeof(polys)}(polys)
end
function PolynomialSystem(polys::MP.AbstractPolynomial...; kwargs...)
PolynomialSystem(collect(polys); kwargs...)
Expand All @@ -50,6 +54,7 @@ function PolynomialSystem(polys::Polynomial...)
PolynomialSystem{N, NVars, NParams, typeof(polys)}(polys)
end


@deprecate system(polys::AbstractVector{<:MP.AbstractPolynomial}) PolynomialSystem(polys)
@deprecate system(polys::AbstractVector{<:MP.AbstractPolynomial}, vars) PolynomialSystem(polys, variables=vars)
@deprecate system(polys...) PolynomialSystem(polys...)
Expand Down

0 comments on commit 164579d

Please sign in to comment.