Skip to content

Commit

Permalink
Supports projection with non-IntSet
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed May 22, 2017
1 parent ba5410c commit d4f1bbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ function dd_blockelimination(matrix::Ptr{Cdd_MatrixData{GMPRational}}, delset::C
myerror(err[])
newmatrix
end
function blockelimination{N, T, S}(matrix::CDDInequalityMatrix{N, T, S}, delset::IntSet=IntSet([N]))
function blockelimination{N, T, S}(matrix::CDDInequalityMatrix{N, T, S}, delset=IntSet([N]))
if last(delset) > N
error("Invalid variable to eliminate")
end
# offset of 1 because 1 is for the first column of the matrix
# (indicating the linearity) so 2 is the first dimension
CDDInequalityMatrix{N-length(delset), T, S}(dd_blockelimination(matrix.matrix, CDDSet(delset, N+1, 1).s))
end
function blockelimination(ine::HRepresentation, delset::IntSet=IntSet([fulldim(ine)]))
function blockelimination(ine::HRepresentation, delset=IntSet([fulldim(ine)]))
blockelimination(Base.convert(CDDInequalityMatrix, ine), delset)
end

Expand Down
8 changes: 4 additions & 4 deletions src/polyhedron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ end


implementseliminationmethod(p::CDDPolyhedron, ::Type{Val{:FourierMotzkin}}) = true
function eliminate(p::CDDPolyhedron, delset::IntSet, ::Type{Val{:FourierMotzkin}})
function eliminate(p::CDDPolyhedron, delset, ::Type{Val{:FourierMotzkin}})
eliminate(p, delset, :FourierMotzkin)
end
implementseliminationmethod(p::CDDPolyhedron, ::Type{Val{:BlockElimination}}) = true
function eliminate(p::CDDPolyhedron, delset::IntSet, ::Type{Val{:BlockElimination}})
function eliminate(p::CDDPolyhedron, delset, ::Type{Val{:BlockElimination}})
eliminate(p, delset, :BlockElimination)
end

function eliminate(ine::CDDInequalityMatrix, delset::IntSet, method=:Auto)
function eliminate(ine::CDDInequalityMatrix, delset, method=:Auto)
if length(delset) > 0
if method == :Auto
fourier = false
Expand Down Expand Up @@ -232,7 +232,7 @@ function eliminate(ine::CDDInequalityMatrix, delset::IntSet, method=:Auto)
end
end

function eliminate{N, T}(p::CDDPolyhedron{N, T}, delset::IntSet, method::Symbol=:Auto)
function eliminate{N, T}(p::CDDPolyhedron{N, T}, delset, method::Symbol=:Auto)
CDDPolyhedron{N-length(delset), T}(eliminate(getine(p), delset, method))
end

Expand Down
6 changes: 3 additions & 3 deletions src/settype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function dd_set_card(st::Cset_type)
@cdd_ccall set_card Clong (Cset_type,) st
end

function dd_settype(st::Cset_type, s::IntSet, offset::Integer=0)
function dd_settype(st::Cset_type, s, offset::Integer=0)
for el in s
dd_set_addelem(st, Clong(offset+el))
end
Expand All @@ -30,12 +30,12 @@ type CDDSet
maxel::Clong
end

function CDDSet(s::IntSet, maxel::Clong, offset::Integer=0)
function CDDSet(s, maxel::Clong, offset::Integer)
st = dd_set_initialize(maxel)
dd_settype(st, s, offset)
CDDSet(st, maxel)
end
CDDSet(s::IntSet, maxel, offset::Integer=0) = CDDSet(s, Clong(maxel), offset)
CDDSet(s, maxel, offset::Integer) = CDDSet(s, Clong(maxel), offset)

function Base.convert(::Type{IntSet}, st::CDDSet)
s = IntSet()
Expand Down

0 comments on commit d4f1bbf

Please sign in to comment.