Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions src/repop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,20 @@ Transform the polyhedron represented by ``p`` into ``\\alpha p`` by transforming
each element of the V-representation (points, symmetric points, rays and lines)
`x` into ``\\alpha x``.
"""
function Base.:(*)(α::Number, p::Polyhedron)
function Base.:(*)(α::Number, p::Polyhedron{T}) where T
if vrepiscomputed(p) || iszero(α)
return (α * LinearAlgebra.I) * p
else
return p / (inv(α) * LinearAlgebra.I)
# If `α` is `Int` and `T` is `Rational{BigInt}`,
# `inv(α)` would be `Float64` and then we'll have `BigFloat`.
return p / (inv(convert(T, α)) * LinearAlgebra.I)
end
end
function Base.:(*)(α::Number, p::VRepresentation)
return (α * LinearAlgebra.I) * p
end
function Base.:(*)(α::Number, p::HRepresentation)
return p / (inv(α) * LinearAlgebra.I)
function Base.:(*)(α::Number, p::HRepresentation{T}) where {T}
return p / (inv(convert(T, α)) * LinearAlgebra.I)
end

"""
Expand Down
2 changes: 1 addition & 1 deletion test/liftedrep.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "Lifted Representation" begin
function test_lifted_representation()
change_fulldim_test(LiftedHRepresentation)
change_fulldim_test(LiftedVRepresentation)

Expand Down
2 changes: 1 addition & 1 deletion test/lphrep.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "LPHRep" begin
function test_lphrep()
hs = HalfSpace([1, 0], 1)
hp = HyperPlane([0, 1], 1)
h = hs ∩ hp
Expand Down
2 changes: 1 addition & 1 deletion test/matrep.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "MixMatRep" begin
function test_MixMatRep()
change_fulldim_test(MixedMatHRep)
change_fulldim_test(MixedMatVRep)

Expand Down
Loading