diff --git a/src/Interfaces/AbstractPolyhedron_functions.jl b/src/Interfaces/AbstractPolyhedron_functions.jl index 61fb11d699..9d606f77af 100644 --- a/src/Interfaces/AbstractPolyhedron_functions.jl +++ b/src/Interfaces/AbstractPolyhedron_functions.jl @@ -41,6 +41,28 @@ isconvextype(::Type{<:AbstractPolyhedron}) = true is_polyhedral(::AbstractPolyhedron) = true +""" + constraints_list(A::AbstractMatrix{N}, b::AbstractVector) + +Convert a matrix-vector representation to a linear-constraint representation. + +### Input + +- `A` -- matrix +- `b` -- vector + +### Output + +A list of linear constraints. +""" +function constraints_list(A::AbstractMatrix, b::AbstractVector) + m = size(A, 1) + @assert m == length(b) "a matrix with $m rows is incompatible with a " * + "vector of length $(length(b))" + + return [HalfSpace(A[i, :], b[i]) for i in 1:m] +end + """ ∈(x::AbstractVector, P::AbstractPolyhedron) diff --git a/src/Sets/HalfSpace.jl b/src/Sets/HalfSpace.jl index c5fa9b19f7..aabb762c6b 100644 --- a/src/Sets/HalfSpace.jl +++ b/src/Sets/HalfSpace.jl @@ -310,28 +310,6 @@ function constraints_list(hs::HalfSpace) return [hs] end -""" - constraints_list(A::AbstractMatrix{N}, b::AbstractVector) - -Convert a matrix-vector representation to a linear-constraint representation. - -### Input - -- `A` -- matrix -- `b` -- vector - -### Output - -A list of linear constraints. -""" -function constraints_list(A::AbstractMatrix, b::AbstractVector) - m = size(A, 1) - @assert m == length(b) "a matrix with $m rows is incompatible with a " * - "vector of length $(length(b))" - - return [HalfSpace(A[i, :], b[i]) for i in 1:m] -end - """ constrained_dimensions(hs::HalfSpace)