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

Faster brute-force search in support-vector computation of VPolygon #3277

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Changes from all commits
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
12 changes: 7 additions & 5 deletions src/Sets/VPolygon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,16 @@ function _brute_force_support_vector(d::AbstractVector, P::VPolygon)
end

function _brute_force_support_vector(d::AbstractVector{M}, vlist::Vector{VT}) where {M, T, VT<:AbstractVector{T}}
i_max = 1
N = promote_type(M, T)
max_idx = 1
@inbounds max_ρ = dot(d, vlist[1])
@inbounds for i in 2:length(vlist)
if dot(d, vlist[i] - vlist[i_max]) > zero(N)
i_max = i
ρ_i = dot(d, vlist[i])
if ρ_i > max_ρ
max_idx = i
max_ρ = ρ_i
end
end
return i_max
return max_idx
end

function _binary_support_vector(d::AbstractVector, P::VPolygon)
Expand Down