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

Changing DP.Polyvar -> DP.Variable as suggested #829

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/contraction/JuMP.jl
lkapelevich marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function get_lagrange_polys(pts::Matrix{T}, deg::Int) where {T <: Real}
end

# returns the multivariate Chebyshev polynomials in x up to degree deg
function get_chebyshev_polys(x::Vector{DP.PolyVar{true}}, deg::Int)
function get_chebyshev_polys(x::Vector{DP.Variable{true}}, deg::Int)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just have this as Vector{<:DP.Variable}, the DP types seem to have acquired even more parameters

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also below on line 114 Vector(undef, PolyUtils.get_L(n, deg)) seems to work and it would be nice not to have to update these DP types in the future

Copy link
Member

@blegat blegat Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, <:DP.Variable seems safer or even <:MultivariatePolynomials.AbstractVariable

if deg > 8
@warn("get_chebyshev_polys is not numerically stable for large degree")
end
Expand All @@ -124,7 +124,7 @@ function get_chebyshev_polys(x::Vector{DP.PolyVar{true}}, deg::Int)
return V
end

function get_chebyshev_univ(monovec::Vector{DP.PolyVar{true}}, deg::Int)
function get_chebyshev_univ(monovec::Vector{DP.Variable{true}}, deg::Int)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto Vector{<:DP.Variable}, ditto Vector(undef, deg + 1) on line 134

if deg > 8
@warn("get_chebyshev_univ is not numerically stable for large degree")
end
Expand Down
4 changes: 2 additions & 2 deletions examples/semidefinitepoly/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import SumOfSquares
import PolyJuMP

struct SemidefinitePolyJuMP{T <: Real} <: ExampleInstanceJuMP{T}
x::Vector{<:DP.PolyVar}
x::Vector{<:DP.Variable}
H::Matrix{<:DP.Polynomial}
is_feas::Bool # whether model should be primal-dual feasible; only for testing
use_wsosmatrix::Bool # use wsosinterppossemideftri cone, else PSD formulation
use_dual::Bool # use dual formulation, else primal formulation
end

function SemidefinitePolyJuMP{Float64}(
x::Vector{DP.PolyVar{true}},
x::Vector{DP.Variable{true}},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto thoughts on Vector{<:DP.Variable}

poly::DP.Polynomial,
args...,
)
Expand Down
Loading