From a494ece18708ac00a6146546debea79eb491c30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 23 Oct 2016 10:04:47 -0400 Subject: [PATCH] cosmetic changes --- src/matrix.jl | 26 +++++++++++++------------- src/polyhedron.jl | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/matrix.jl b/src/matrix.jl index 1b05ffb..0210b2e 100644 --- a/src/matrix.jl +++ b/src/matrix.jl @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/polyhedron.jl b/src/polyhedron.jl index fbe0bb9..9bf3add 100644 --- a/src/polyhedron.jl +++ b/src/polyhedron.jl @@ -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 @@ -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