Skip to content

Commit

Permalink
fixed f_vector(::Polyhedron) for non-trivial lineality space and adde…
Browse files Browse the repository at this point in the history
…d test; removed outdated comment
  • Loading branch information
alexej-jordan committed Sep 30, 2021
1 parent 634fc76 commit 0af6d7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Polytopes/Polyhedron/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/Polytopes/Polyhedron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0af6d7c

Please sign in to comment.