From 0af6d7c457154fefeb7f6a44a0916f58a200a9ed Mon Sep 17 00:00:00 2001 From: Alexej Jordan Date: Thu, 30 Sep 2021 02:09:17 +0200 Subject: [PATCH] fixed f_vector(::Polyhedron) for non-trivial lineality space and added test; removed outdated comment --- src/Polytopes/Polyhedron/properties.jl | 11 ++--------- test/Polytopes/Polyhedron.jl | 1 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Polytopes/Polyhedron/properties.jl b/src/Polytopes/Polyhedron/properties.jl index dc24487e0d37..1ff248d3fd99 100644 --- a/src/Polytopes/Polyhedron/properties.jl +++ b/src/Polytopes/Polyhedron/properties.jl @@ -480,14 +480,6 @@ julia> lineality_space(UH) """ lineality_space(P::Polyhedron) = VectorIterator{RayVector{Polymake.Rational}}(dehomogenize(P.pm_polytope.LINEALITY_SPACE)) -# function affine_hull(P::Polyhedron) -# a = P.pm_polytope.AFFINE_HULL -# x = -a[:, 1] -# y = a[:, 2:end] -# v = sum((x[i] * y[i, :] for i in 1:length(x))) -# return (PointVector(v), VectorIterator{RayVector{Polymake.Rational}}(y)) -# end - @doc Markdown.doc""" affine_hull(P::Polytope) @@ -666,7 +658,8 @@ julia> f_vector(cube(5)) ``` """ function f_vector(P::Polyhedron) - f_vec=[length(collect(faces(P,i))) for i in 0:dim(P)-1] + ldim = lineality_dim(P) + f_vec=vcat(zeros(Int64, ldim), [length(faces(P,i)) for i in ldim:dim(P)-1]) return f_vec end diff --git a/test/Polytopes/Polyhedron.jl b/test/Polytopes/Polyhedron.jl index 5b22b60a4c37..b15915bda912 100644 --- a/test/Polytopes/Polyhedron.jl +++ b/test/Polytopes/Polyhedron.jl @@ -31,6 +31,7 @@ @test intersect(Q0, Q0) == Q0 @test Q0+Q0 == minkowski_sum(Q0, Q0) @test f_vector(Pos) == [1,3,3] + @test f_vector(L) == [0, 1, 2] @test codim(square) == 0 @test codim(point) == 3 @test !isfulldimensional(point)