Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Oct 23, 2016
1 parent 142a3c0 commit a494ece
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions src/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ CDDInequalityMatrix{T}(matrix::Ptr{Cdd_MatrixData{T}}) = CDDInequalityMatrix{uns
function (::Type{CDDInequalityMatrix{N, T, S}}){N,T,S}(it::HRepIterator{N, T})
CDDInequalityMatrix(initmatrix(true, it))
end
function (::Type{CDDInequalityMatrix{N, T, S}}){N,T,S}(;eqs=nothing, ineqs=nothing)
function (::Type{CDDInequalityMatrix{N, T, S}}){N,T,S}(; eqs=nothing, ineqs=nothing)
CDDInequalityMatrix(initmatrix(true, eqs, ineqs))
end

Expand Down Expand Up @@ -219,17 +219,17 @@ function extractrow{N,T}(ext::CDDGeneratorMatrix{N,T}, i)
ispoint = b[1]
@assert ispoint == zero(T) || ispoint == one(T)
a = b[2:end]
if ispoint == zero(T)
if ispoint == one(T)
if dd_set_member(mat.linset, i)
Line(a)
SymPoint(a)
else
Ray(a)
a
end
else
if dd_set_member(mat.linset, i)
SymPoint(a)
Line(a)
else
a
Ray(a)
end
end
end
Expand Down Expand Up @@ -289,7 +289,7 @@ end
function (::Type{CDDGeneratorMatrix{N,T,S}}){N,T,S}(it::VRepIterator{N, T})
CDDGeneratorMatrix(initmatrix(false, it))
end
function (::Type{CDDGeneratorMatrix{N,T,S}}){N,T,S}(;rays=nothing, points=nothing)
function (::Type{CDDGeneratorMatrix{N,T,S}}){N,T,S}(; rays=nothing, points=nothing)
CDDGeneratorMatrix(initmatrix(false, rays, points))
end

Expand All @@ -309,26 +309,26 @@ startvrep(ext::CDDGeneratorMatrix) = 1
donevrep(ext::CDDGeneratorMatrix, state) = state > length(ext)
nextvrep(ext::CDDGeneratorMatrix, state) = (extractrow(ext, state), state+1)

function nextray(ext::CDDGeneratorMatrix, i, n)
function nextrayidx(ext::CDDGeneratorMatrix, i, n)
while i <= n && isrowpoint(ext, i)
i += 1
end
i
end
function nextpoint(ext::CDDGeneratorMatrix, i, n)
function nextpointidx(ext::CDDGeneratorMatrix, i, n)
while i <= n && !isrowpoint(ext, i)
i += 1
end
i
end

startray(ext::CDDGeneratorMatrix) = nextray(ext, 1, length(ext))
startray(ext::CDDGeneratorMatrix) = nextrayidx(ext, 1, length(ext))
doneray(ext::CDDGeneratorMatrix, state) = state > length(ext)
nextray(ext::CDDGeneratorMatrix, state) = (extractrow(ext, state), nextray(ext, state+1, length(ext)))
nextray(ext::CDDGeneratorMatrix, state) = (extractrow(ext, state), nextrayidx(ext, state+1, length(ext)))

startpoint(ext::CDDGeneratorMatrix) = nextpoint(ext, 1, length(ext))
startpoint(ext::CDDGeneratorMatrix) = nextpointidx(ext, 1, length(ext))
donepoint(ext::CDDGeneratorMatrix, state) = state > length(ext)
nextpoint(ext::CDDGeneratorMatrix, state) = (extractrow(ext, state), nextpoint(ext, state+1, length(ext)))
nextpoint(ext::CDDGeneratorMatrix, state) = (extractrow(ext, state), nextpointidx(ext, state+1, length(ext)))

function isaninequalityrepresentation(matrix::CDDGeneratorMatrix)
false
Expand Down
4 changes: 2 additions & 2 deletions src/polyhedron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Base.convert{N, T}(::Type{CDDPolyhedron{N, T}}, rep::VRepresentation{N}) = CDDPo
(::Type{CDDPolyhedron{N, T}}){N, T}(it::HRepIterator{N,T}) = CDDPolyhedron{N, T}(CDDInequalityMatrix{N,T,mytype(T)}(it))
(::Type{CDDPolyhedron{N, T}}){N, T}(it::VRepIterator{N,T}) = CDDPolyhedron{N, T}(CDDGeneratorMatrix{N,T,mytype(T)}(it))

function (::Type{CDDPolyhedron{N, T}}){N, T}(;eqs=nothing, ineqs=nothing, points=nothing, rays=nothing)
function (::Type{CDDPolyhedron{N, T}}){N, T}(; eqs=nothing, ineqs=nothing, points=nothing, rays=nothing)
noth = eqs === nothing && ineqs === nothing
notv = points === nothing && rays === nothing
if noth && notv
Expand All @@ -159,7 +159,7 @@ function (::Type{CDDPolyhedron{N, T}}){N, T}(;eqs=nothing, ineqs=nothing, points
error("CDDPolyhedron constructed with a combination of eqs/ineqs with points/rays")
end
if notv
CDDPolyhedron{N, T}(CDDInequalityMatrix{N,T,mytype(T)}(eqs=eqs,ineqs=ineqs))
CDDPolyhedron{N, T}(CDDInequalityMatrix{N,T,mytype(T)}(eqs=eqs, ineqs=ineqs))
else
CDDPolyhedron{N, T}(CDDGeneratorMatrix{N,T,mytype(T)}(points=points, rays=rays))
end
Expand Down

0 comments on commit a494ece

Please sign in to comment.