Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use default library for Polyhedra in 0.7 #831

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions src/AbstractPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,45 @@ function load_polyhedra_abstractpolytope() # function to be loaded by Requires

return quote

import CDDLib # default backend
import Polyhedra:polyhedron,
HRep, VRep,
removehredundancy!, removevredundancy!,
hreps, vreps,
intersect,
convexhull,
hcartesianproduct,
points

@static if VERSION < v"0.7-"
import Polyhedra:polyhedron,
HRep, VRep,
removehredundancy!, removevredundancy!,
hreps, vreps,
intersect,
convexhull,
hcartesianproduct,
points

import CDDLib # default backend
import Polyhedra:SimpleHRepresentation, SimpleHRepresentation
end

function default_polyhedra_backend(N::Type{<:AbstractFloat})
return CDDLib.CDDLibrary()
function default_polyhedra_backend(N::Type{<:AbstractFloat})
return CDDLib.CDDLibrary()
end

function default_polyhedra_backend(N::Type{<:Rational})
return CDDLib.CDDLibrary(:exact)
end

else
import .Polyhedra:polyhedron,
HRep, VRep,
removehredundancy!, removevredundancy!,
hreps, vreps,
intersect,
convexhull,
hcartesianproduct,
points,
default_library

function default_polyhedra_backend(N::Type{<:AbstractFloat})
return default_library(2, Float64)
end

function default_polyhedra_backend(N::Type{<:Rational})
return default_library(2, Rational{Int})
end
end

function default_polyhedra_backend(N::Type{<:Rational})
return CDDLib.CDDLibrary(:exact)
end

end # quote
end # function load_polyhedra_hpolytope()