diff --git a/src/lp.jl b/src/lp.jl index a6c9efb..6910ede 100644 --- a/src/lp.jl +++ b/src/lp.jl @@ -1,7 +1,7 @@ import MathProgBase importall MathProgBase.SolverInterface -type Cdd_LPSolutionData{T<:MyType} +mutable struct Cdd_LPSolutionData{T<:MyType} filename::Cdd_DataFileType objective::Cdd_LPObjectiveType solver::Cdd_LPSolverType @@ -40,7 +40,7 @@ function dd_freelpsolution(lp::Ptr{Cdd_LPSolutionData{GMPRational}}) @dd_ccall FreeLPSolution Void (Ptr{Cdd_LPSolutionData{GMPRational}},) lp end -type CDDLPSolution{T<:MyType} +mutable struct CDDLPSolution{T<:MyType} sol::Ptr{Cdd_LPSolutionData{T}} function CDDLPSolution{T}(sol::Ptr{Cdd_LPSolutionData{T}}) where {T <: MyType} @@ -50,7 +50,7 @@ type CDDLPSolution{T<:MyType} end end -CDDLPSolution{T<:MyType}(sol::Ptr{Cdd_LPSolutionData{T}}) = CDDLPSolution{T}(sol) +CDDLPSolution(sol::Ptr{Cdd_LPSolutionData{T}}) where {T<:MyType} = CDDLPSolution{T}(sol) function myfree(sol::CDDLPSolution) dd_freelpsolution(sol.sol) @@ -115,7 +115,7 @@ function getconstrduals(sol::CDDLPSolution{Cdouble}) dual end -type Cdd_LPData{T<:MyType} +mutable struct Cdd_LPData{T<:MyType} filename::Cdd_DataFileType objective::Cdd_LPObjectiveType solver::Cdd_LPSolverType @@ -187,7 +187,7 @@ function dd_freelpdata(lp::Ptr{Cdd_LPData{GMPRational}}) @dd_ccall FreeLPData Void (Ptr{Cdd_LPData{GMPRational}},) lp end -type CDDLP{T<:MyType} +mutable struct CDDLP{T<:MyType} lp::Ptr{Cdd_LPData{T}} function CDDLP{T}(lp::Ptr{Cdd_LPData{T}}) where {T <: MyType} @@ -197,7 +197,7 @@ type CDDLP{T<:MyType} end end -CDDLP{T<:MyType}(lp::Ptr{Cdd_LPData{T}}) = CDDLP{T}(lp) +CDDLP(lp::Ptr{Cdd_LPData{T}}) where {T<:MyType} = CDDLP{T}(lp) function myfree(lp::CDDLP) dd_freelpdata(lp.lp) diff --git a/src/mathprogbase.jl b/src/mathprogbase.jl index a15613b..4e7fc46 100644 --- a/src/mathprogbase.jl +++ b/src/mathprogbase.jl @@ -1,6 +1,6 @@ export CDDPolyhedraModel, CDDSolver -type CDDPolyhedraModel <: AbstractPolyhedraModel +mutable struct CDDPolyhedraModel <: AbstractPolyhedraModel solver_type::Symbol exact::Bool @@ -14,7 +14,7 @@ type CDDPolyhedraModel <: AbstractPolyhedraModel infeasibilityray end -type CDDSolver <: AbstractMathProgSolver +mutable struct CDDSolver <: AbstractMathProgSolver solver_type::Symbol exact::Bool @@ -31,7 +31,7 @@ function PolyhedraModel(s::CDDSolver) end LinearQuadraticModel(s::CDDSolver) = PolyhedraToLPQPBridge(PolyhedraModel(s)) -function loadproblem!{N}(lpm::CDDPolyhedraModel, rep::HRep{N}, obj, sense) +function loadproblem!(lpm::CDDPolyhedraModel, rep::HRep{N}, obj, sense) where N T = lpm.exact ? Rational{BigInt} : Float64 prob = CDDInequalityMatrix{N, T, mytype(T)}(rep) setobjective(prob, obj, sense) diff --git a/src/matrix.jl b/src/matrix.jl index 22ea250..e87154f 100644 --- a/src/matrix.jl +++ b/src/matrix.jl @@ -1,4 +1,4 @@ -type Cdd_MatrixData{T <: MyType} +mutable struct Cdd_MatrixData{T <: MyType} rowsize::Cdd_rowrange linset::Cdd_rowset colsize::Cdd_colrange @@ -60,7 +60,7 @@ function dd_matrixcopy(matrix::Ptr{Cdd_MatrixData{GMPRational}}) @dd_ccall MatrixCopy Ptr{Cdd_MatrixData{GMPRational}} (Ptr{Cdd_MatrixData{GMPRational}},) matrix end -function fillmatrix{T}(inequality::Bool, matrix::Ptr{Ptr{T}}, itr1, linset=IntSet(), offset=0) +function fillmatrix(inequality::Bool, matrix::Ptr{Ptr{T}}, itr1, linset=IntSet(), offset=0) where T for (i, item) in enumerate(itr1) row = unsafe_load(matrix, offset+i) if islin(item) @@ -73,7 +73,7 @@ function fillmatrix{T}(inequality::Bool, matrix::Ptr{Ptr{T}}, itr1, linset=IntSe linset end -function initmatrix{N, T}(inequality::Bool, itr1::AbstractRepIterator{N, T}, itr2=nothing) +function initmatrix(inequality::Bool, itr1::AbstractRepIterator{N, T}, itr2=nothing) where {N, T} n = N+1 m = length(itr1) if !(itr2 === nothing) @@ -93,7 +93,7 @@ end # Representation -type CDDInequalityMatrix{N, T <: PolyType, S <: MyType} <: HRepresentation{N, T} +mutable struct CDDInequalityMatrix{N, T <: PolyType, S <: MyType} <: HRepresentation{N, T} matrix::Ptr{Cdd_MatrixData{S}} function CDDInequalityMatrix{N, T, S}(matrix::Ptr{Cdd_MatrixData{S}}) where {N, T <: PolyType, S <: MyType} @@ -109,7 +109,7 @@ changefulldim{N, T, S}(::Type{CDDInequalityMatrix{N, T, S}}, NewN) = CDDInequali changeboth{N, T, S, NewT}(::Type{CDDInequalityMatrix{N, T, S}}, NewN, ::Type{NewT}) = CDDInequalityMatrix{NewN, NewT, mytype(NewT)} decomposedfast(ine::CDDInequalityMatrix) = false -type CDDGeneratorMatrix{N, T <: PolyType, S <: MyType} <: VRepresentation{N, T} +mutable struct CDDGeneratorMatrix{N, T <: PolyType, S <: MyType} <: VRepresentation{N, T} matrix::Ptr{Cdd_MatrixData{S}} function CDDGeneratorMatrix{N, T, S}(matrix::Ptr{Cdd_MatrixData{S}}) where {N, T <: PolyType, S <: MyType} @@ -142,7 +142,7 @@ cddmatrix{N,T}(::Type{T}, vrep::VRepresentation{N}) = CDDGeneratorMatrix{N,T,myt # Does not work #Base.convert{N,T,S}(::Type{CDDMatrix{N,T,S}}, vrep::VRepresentation{N}) = CDDGeneratorMatrix{N,T,S}(vrep) -function Base.length{N}(matrix::CDDMatrix{N}) +function Base.length(matrix::CDDMatrix{N}) where N mat = unsafe_load(matrix.matrix) @assert Int(mat.colsize) == N+1 Int(mat.rowsize) @@ -160,9 +160,9 @@ end # H-representation -CDDInequalityMatrix{N,T}(rep::Rep{N,T}) = CDDInequalityMatrix{N,polytypefor(T), mytypefor(T)}(rep) +CDDInequalityMatrix(rep::Rep{N,T}) where {N,T} = CDDInequalityMatrix{N,polytypefor(T), mytypefor(T)}(rep) -CDDInequalityMatrix{T}(matrix::Ptr{Cdd_MatrixData{T}}) = CDDInequalityMatrix{unsafe_load(matrix).colsize-1, polytype(T), T}(matrix) +CDDInequalityMatrix(matrix::Ptr{Cdd_MatrixData{T}}) where {T} = CDDInequalityMatrix{unsafe_load(matrix).colsize-1, polytype(T), T}(matrix) function CDDInequalityMatrix{N, T, S}(it::HRepIterator{N, T}) where {N, T, S} CDDInequalityMatrix(initmatrix(true, it)) @@ -175,7 +175,7 @@ nhreps(matrix::CDDInequalityMatrix) = length(matrix) neqs(matrix::CDDInequalityMatrix) = dd_set_card(unsafe_load(matrix.matrix).linset) nineqs(matrix::CDDInequalityMatrix) = length(matrix) - neqs(matrix) -function Base.copy{N, T, S}(matrix::CDDInequalityMatrix{N, T, S}) +function Base.copy(matrix::CDDInequalityMatrix{N, T, S}) where {N, T, S} CDDInequalityMatrix{N, T, S}(dd_matrixcopy(matrix.matrix)) end @@ -213,7 +213,7 @@ function extractrow(ine::CDDInequalityMatrix, i) HalfSpace(a, β) end end -function extractrow{N,T}(ext::CDDGeneratorMatrix{N,T}, i) +function extractrow(ext::CDDGeneratorMatrix{N,T}, i) where {N,T} mat = unsafe_load(ext.matrix) b = extractrow(mat, i) ispoint = b[1] @@ -233,7 +233,7 @@ function extractrow{N,T}(ext::CDDGeneratorMatrix{N,T}, i) end end end -function isrowpoint{N,T}(ext::CDDGeneratorMatrix{N,T}, i) +function isrowpoint(ext::CDDGeneratorMatrix{N,T}, i) where {N,T} mat = unsafe_load(ext.matrix) b = extractrow(unsafe_load(ext.matrix), i) ispoint = b[1] @@ -269,7 +269,7 @@ function isaninequalityrepresentation(matrix::CDDInequalityMatrix) true end -function setobjective{N, T}(matrix::CDDInequalityMatrix{N, T}, c, sense) +function setobjective(matrix::CDDInequalityMatrix{N, T}, c, sense) where {N, T} dd_setmatrixobjective(matrix.matrix, sense == :Max ? dd_LPmax : dd_LPmin) obj = [zero(T); Vector{T}(c)] dd_copyArow(unsafe_load(matrix.matrix).rowvec, obj) @@ -277,11 +277,11 @@ end # V-representation -CDDGeneratorMatrix{N,T}(rep::Rep{N,T}) = CDDGeneratorMatrix{N,polytypefor(T), mytypefor(T)}(rep) +CDDGeneratorMatrix(rep::Rep{N,T}) where {N,T} = CDDGeneratorMatrix{N,polytypefor(T), mytypefor(T)}(rep) -CDDGeneratorMatrix{T}(matrix::Ptr{Cdd_MatrixData{T}}) = CDDGeneratorMatrix{unsafe_load(matrix).colsize-1, polytype(T), T}(matrix) +CDDGeneratorMatrix(matrix::Ptr{Cdd_MatrixData{T}}) where {T} = CDDGeneratorMatrix{unsafe_load(matrix).colsize-1, polytype(T), T}(matrix) -function Base.copy{N, T, S}(matrix::CDDGeneratorMatrix{N, T, S}) +function Base.copy(matrix::CDDGeneratorMatrix{N, T, S}) where {N, T, S} CDDGeneratorMatrix{N, T, S}(dd_matrixcopy(matrix.matrix)) end @@ -360,7 +360,7 @@ function extractA(mat::Cdd_MatrixData{GMPRational}) Array{GMPRational}(A) end -function Base.show{T}(io::IO, matrix::Cdd_MatrixData{T}) +function Base.show(io::IO, matrix::Cdd_MatrixData{T}) where T if matrix.representation == dd_Inequality println(io, "H-representation") else diff --git a/src/mytype.jl b/src/mytype.jl index 0122cbc..f478d06 100644 --- a/src/mytype.jl +++ b/src/mytype.jl @@ -2,13 +2,13 @@ import Base.+, Base.-, Base.*, Base.promote_rule, Base.==, Base.zero, Base.zeros # It is immutable so that it is stored by value in the structures # GMPRational and GMPRationalMut and not by reference -immutable GMPInteger +struct GMPInteger alloc::Cint size::Cint data::Ptr{UInt32} end -type GMPRationalMut +mutable struct GMPRationalMut num::GMPInteger den::GMPInteger @@ -51,7 +51,7 @@ Base.zero(::Type{GMPRationalMut}) = GMPRationalMut(0) # I cannot have a finalizer for an immutable so you are responsibe to free it # if you use it using e.g. myfree define below -immutable GMPRational <: Real +struct GMPRational <: Real num::GMPInteger den::GMPInteger function GMPRational(m::GMPRationalMut) @@ -73,7 +73,7 @@ Base.convert(::Type{GMPRational}, x::GMPRationalMut) = GMPRational(x) GMPRational() = GMPRational(GMPRationalMut()) -GMPRational{T<:Integer,S<:Integer}(a::S, b::T) = GMPRational(GMPRationalMut(a, b)) +GMPRational(a::S, b::T) where {T<:Integer,S<:Integer} = GMPRational(GMPRationalMut(a, b)) Base.convert{T<:Real}(::Type{GMPRational}, a::T) = GMPRational(GMPRationalMut(a)) Base.convert(::Type{GMPRational}, a::GMPRational) = a diff --git a/src/operations.jl b/src/operations.jl index 30d5453..25fc5f4 100644 --- a/src/operations.jl +++ b/src/operations.jl @@ -20,21 +20,21 @@ function dd_inputappend(poly::Ptr{Cdd_PolyhedraData{GMPRational}}, matrix::Ptr{C polyptr[] end -function Base.push!{N, T<:PolyType}(poly::CDDPolyhedra{N, T}, ine::CDDInequalityMatrix{N, T}) +function Base.push!(poly::CDDPolyhedra{N, T}, ine::CDDInequalityMatrix{N, T}) where {N, T<:PolyType} if !poly.inequality switchinputtype!(poly) end poly.poly = dd_inputappend(poly.poly, ine.matrix) end -function Base.push!{N, T<:PolyType}(poly::CDDPolyhedra{N, T}, ext::CDDGeneratorMatrix{N, T}) +function Base.push!(poly::CDDPolyhedra{N, T}, ext::CDDGeneratorMatrix{N, T}) where {N, T<:PolyType} if poly.inequality switchinputtype!(poly) end poly.poly = dd_inputappend(poly.poly, ext.matrix) end -function Base.push!{N,T,S}(poly::CDDPolyhedra{N,T}, rep::Representation{N,S}) +function Base.push!(poly::CDDPolyhedra{N,T}, rep::Representation{N,S}) where {N,T,S} Base.push!(poly, cddmatrix(T, rep)) end @@ -44,13 +44,13 @@ end function dd_matrixappend(matrix1::Ptr{Cdd_MatrixData{GMPRational}}, matrix2::Ptr{Cdd_MatrixData{GMPRational}}) @dd_ccall MatrixAppend Ptr{Cdd_MatrixData{GMPRational}} (Ptr{Cdd_MatrixData{GMPRational}}, Ptr{Cdd_MatrixData{GMPRational}}) matrix1 matrix2 end -function matrixappend{N, T, S}(matrix1::CDDInequalityMatrix{N, T, S}, matrix2::CDDInequalityMatrix{N, T, S}) +function matrixappend(matrix1::CDDInequalityMatrix{N, T, S}, matrix2::CDDInequalityMatrix{N, T, S}) where {N, T, S} CDDInequalityMatrix{N, T, S}(dd_matrixappend(matrix1.matrix, matrix2.matrix)) end -function matrixappend{N, T, S}(matrix1::CDDGeneratorMatrix{N, T, S}, matrix2::CDDGeneratorMatrix{N, T, S}) +function matrixappend(matrix1::CDDGeneratorMatrix{N, T, S}, matrix2::CDDGeneratorMatrix{N, T, S}) where {N, T, S} CDDGeneratorMatrix{N, T, S}(dd_matrixappend(matrix1.matrix, matrix2.matrix)) end -function matrixappend{N, S, T}(matrix::CDDMatrix{N, T}, repr::Representation{N, S}) +function matrixappend(matrix::CDDMatrix{N, T}, repr::Representation{N, S}) where {N, S, T} matrixappend(matrix, cddmatrix(T, repr)) end @@ -231,7 +231,7 @@ function dd_fourierelimination(matrix::Ptr{Cdd_MatrixData{GMPRational}}) myerror(err[]) newmatrix end -function fourierelimination{N, T, S}(matrix::CDDInequalityMatrix{N, T, S}) +function fourierelimination(matrix::CDDInequalityMatrix{N, T, S}) where {N, T, S} CDDInequalityMatrix{N-1, T, S}(dd_fourierelimination(matrix.matrix)) end function fourierelimination(ine::HRepresentation) @@ -252,7 +252,7 @@ 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([N])) +function blockelimination(matrix::CDDInequalityMatrix{N, T, S}, delset=IntSet([N])) where {N, T, S} if last(delset) > N error("Invalid variable to eliminate") end diff --git a/src/polyhedra.jl b/src/polyhedra.jl index a672fd3..0a3ed47 100644 --- a/src/polyhedra.jl +++ b/src/polyhedra.jl @@ -1,4 +1,4 @@ -type Cdd_PolyhedraData{T<:MyType} +mutable struct Cdd_PolyhedraData{T<:MyType} representation::Cdd_RepresentationType # given representation homogeneous::Cdd_boolean @@ -60,7 +60,7 @@ function dd_matrix2poly(matrix::Ptr{Cdd_MatrixData{GMPRational}}) poly end -type CDDPolyhedra{N, T<:PolyType, S} +mutable struct CDDPolyhedra{N, T<:PolyType, S} poly::Ptr{Cdd_PolyhedraData{S}} inequality::Bool # The input type is inequality @@ -73,14 +73,14 @@ type CDDPolyhedra{N, T<:PolyType, S} end -function myfree{N}(poly::CDDPolyhedra{N, Cdouble}) +function myfree(poly::CDDPolyhedra{N, Cdouble}) where N @ddf_ccall FreePolyhedra Void (Ptr{Cdd_PolyhedraData{Cdouble}},) poly.poly end -function myfree{N}(poly::CDDPolyhedra{N, Rational{BigInt}}) +function myfree(poly::CDDPolyhedra{N, Rational{BigInt}}) where N @dd_ccall FreePolyhedra Void (Ptr{Cdd_PolyhedraData{GMPRational}},) poly.poly end -CDDPolyhedra{N, T, S}(matrix::CDDMatrix{N, T, S}) = CDDPolyhedra{N, T, S}(matrix) +CDDPolyhedra(matrix::CDDMatrix{N, T, S}) where {N, T, S} = CDDPolyhedra{N, T, S}(matrix) CDDPolyhedra(rep::Representation) = CDDPolyhedra(CDDMatrix(rep)) function Base.convert{N, T, S}(::Type{CDDPolyhedra{N, T, S}}, matrix::CDDMatrix{N, T, S}) diff --git a/src/polyhedron.jl b/src/polyhedron.jl index 67d8121..d5e5cd4 100644 --- a/src/polyhedron.jl +++ b/src/polyhedron.jl @@ -1,7 +1,7 @@ export CDDLibrary, CDDPolyhedron import Base.isempty, Base.push! -type CDDLibrary <: PolyhedraLibrary +mutable struct CDDLibrary <: PolyhedraLibrary precision::Symbol function CDDLibrary(precision::Symbol=:float) @@ -12,7 +12,7 @@ type CDDLibrary <: PolyhedraLibrary end end -type CDDPolyhedron{N, T<:PolyType} <: Polyhedron{N, T} +mutable struct CDDPolyhedron{N, T<:PolyType} <: Polyhedron{N, T} ine::Nullable{CDDInequalityMatrix{N,T}} ext::Nullable{CDDGeneratorMatrix{N,T}} poly::Nullable{CDDPolyhedra{N,T}} @@ -38,7 +38,7 @@ changeboth{N, T, NewT}(::Type{CDDPolyhedron{N, T}}, NewN, ::Type{NewT}) = CDDPol decomposedhfast(p::CDDPolyhedron) = false decomposedvfast(p::CDDPolyhedron) = false -CDDPolyhedron{N, T}(matrix::CDDMatrix{N, T}) = CDDPolyhedron{N, T}(matrix) +CDDPolyhedron(matrix::CDDMatrix{N, T}) where {N, T} = CDDPolyhedron{N, T}(matrix) Base.convert{N, T}(::Type{CDDPolyhedron{N, T}}, rep::Representation{N, T}) = CDDPolyhedron{N, T}(cddmatrix(T, rep)) # Helpers @@ -78,20 +78,20 @@ function clearfield!(p::CDDPolyhedron) p.noredundantinequality = false p.noredundantgenerator = false end -function updateine!{N}(p::CDDPolyhedron{N}, ine::CDDInequalityMatrix{N}) +function updateine!(p::CDDPolyhedron{N}, ine::CDDInequalityMatrix{N}) where N clearfield!(p) p.ine = ine end -function updateext!{N}(p::CDDPolyhedron{N}, ext::CDDGeneratorMatrix{N}) +function updateext!(p::CDDPolyhedron{N}, ext::CDDGeneratorMatrix{N}) where N clearfield!(p) p.ext = ext end -function updatepoly!{N}(p::CDDPolyhedron{N}, poly::CDDPolyhedra{N}) +function updatepoly!(p::CDDPolyhedron{N}, poly::CDDPolyhedra{N}) where N clearfield!(p) p.poly = poly end -function Base.copy{N, T}(p::CDDPolyhedron{N, T}) +function Base.copy(p::CDDPolyhedron{N, T}) where {N, T} pcopy = nothing if !isnull(p.ine) pcopy = CDDPolyhedron{N, T}(copy(get(p.ine))) @@ -124,15 +124,15 @@ function polytypeforprecision(precision::Symbol) precision == :float ? Cdouble : Rational{BigInt} end -function Polyhedra.polyhedron{N}(repit::Union{Representation{N},HRepIterator{N},VRepIterator{N}}, lib::CDDLibrary) +function Polyhedra.polyhedron(repit::Union{Representation{N},HRepIterator{N},VRepIterator{N}}, lib::CDDLibrary) where N T = polytypeforprecision(lib.precision) CDDPolyhedron{N, T}(repit) end -function Polyhedrapolyhedron{N}(hps::EqIterator{N}, hss::IneqIterator{N}, lib::CDDLibrary) +function Polyhedrapolyhedron(hps::EqIterator{N}, hss::IneqIterator{N}, lib::CDDLibrary) where N T = polytypeforprecision(lib.precision) CDDPolyhedron{N, T}(hps, hss) end -function Polyhedrapolyhedron{N}(ps::PointIterator{N}, rs::RayIterator{N}, lib::CDDLibrary) +function Polyhedrapolyhedron(ps::PointIterator{N}, rs::RayIterator{N}, lib::CDDLibrary) where N T = polytypeforprecision(lib.precision) CDDPolyhedron{N, T}(ps, rs) end @@ -159,7 +159,7 @@ CDDPolyhedron{N, T}(eqs::EqIterator{N, T}, ineqs::IneqIterator{N, T}) where {N, CDDPolyhedron{N, T}(it::VRepIterator{N, T}) where {N, T} = CDDPolyhedron{N, T}(CDDGeneratorMatrix{N, T, mytype(T)}(it)) CDDPolyhedron{N, T}(ps::PointIterator{N, T}, rs::RayIterator{N, T}) where {N, T} = CDDPolyhedron{N, T}(CDDGeneratorMatrix{N, T, mytype(T)}(ps, rs)) -function (::Type{CDDPolyhedron{N, T}}){N, T}(; eqs=nothing, ineqs=nothing, points=nothing, rays=nothing) +function CDDPolyhedron{N, T}(; eqs=nothing, ineqs=nothing, points=nothing, rays=nothing) where {N, T} noth = eqs === nothing && ineqs === nothing notv = points === nothing && rays === nothing if noth && notv @@ -178,7 +178,7 @@ end function hrepiscomputed(p::CDDPolyhedron) !isnull(p.ine) end -function hrep{N, T}(p::CDDPolyhedron{N, T}) +function hrep(p::CDDPolyhedron{N, T}) where {N, T} getine(p) end @@ -199,7 +199,7 @@ end function vrepiscomputed(p::CDDPolyhedron) !isnull(p.ext) end -function vrep{N, T}(p::CDDPolyhedron{N, T}) +function vrep(p::CDDPolyhedron{N, T}) where {N, T} getext(p) end @@ -242,7 +242,7 @@ function eliminate(ine::CDDInequalityMatrix, delset, method=:Auto) end end -function eliminate{N, T}(p::CDDPolyhedron{N, T}, delset, method::Symbol=:Auto) +function eliminate(p::CDDPolyhedron{N, T}, delset, method::Symbol=:Auto) where {N, T} CDDPolyhedron{N-length(delset), T}(eliminate(getine(p), delset, method)) end @@ -295,19 +295,19 @@ function removevredundancy!(p::CDDPolyhedron) end end -function Base.push!{N}(p::CDDPolyhedron{N}, ine::HRepresentation{N}) +function Base.push!(p::CDDPolyhedron{N}, ine::HRepresentation{N}) where N updateine!(p, matrixappend(getine(p), ine)) #push!(getpoly(p, true), ine) # too slow because it computes double description #updatepoly!(p, getpoly(p)) # invalidate others end -function Base.push!{N}(p::CDDPolyhedron{N}, ext::VRepresentation{N}) +function Base.push!(p::CDDPolyhedron{N}, ext::VRepresentation{N}) where N updateext!(p, matrixappend(getext(p), ext)) #push!(getpoly(p, false), ext) # too slow because it computes double description #updatepoly!(p, getpoly(p)) # invalidate others end # TODO other solvers -function defaultLPsolverfor{N,T}(p::CDDPolyhedron{N,T}, solver=nothing) +function defaultLPsolverfor(p::CDDPolyhedron{N,T}, solver=nothing) where {N,T} if vrepiscomputed(p) SimpleVRepSolver() else diff --git a/src/settype.jl b/src/settype.jl index 99cf955..14058f0 100644 --- a/src/settype.jl +++ b/src/settype.jl @@ -25,7 +25,7 @@ end # CDDSet -type CDDSet +mutable struct CDDSet s::Cset_type maxel::Clong end