Skip to content

Commit

Permalink
minimal_nonfaces: fix column number of IncidenceMatrix (#1441)
Browse files Browse the repository at this point in the history
this is a workaround until that is fixed in polymake
add testcase
fixes #1440
  • Loading branch information
benlorenz committed Jul 6, 2022
1 parent 7579601 commit 32eb6c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Combinatorics/SimplicialComplexes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,13 @@ function minimal_nonfaces(::Type{Vector{Set{Int}}}, K::SimplicialComplex)
end
function minimal_nonfaces(::Type{IncidenceMatrix}, K::SimplicialComplex)
# the following line must stay to ensure polymake uses the correct algorithm for the non-faces
nvertices(K)
return pm_object(K).MINIMAL_NON_FACES
nv = nvertices(K)
m = pm_object(K).MINIMAL_NON_FACES
# fix column number (see #1440) until this is fixed in polymake
if size(m, 2) < nv
resize!(m, size(m, 1), nv)
end
return m
end

@doc Markdown.doc"""
Expand Down
5 changes: 4 additions & 1 deletion test/Combinatorics/SimplicialComplexes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
R, _ = PolynomialRing(ZZ, ["a", "x", "i_7", "n"])
@test stanley_reisner_ideal(R, sphere) == ideal([R([1], [[1, 1, 1, 1]])])
@test is_isomorphic(fundamental_group(sphere), free_group())


# from #1440, make sure empty columns at the end are kept
sc = SimplicialComplex([[1, 2, 4], [2, 3, 4]])
@test size(minimal_nonfaces(IncidenceMatrix, sc)) == (1, 4)
end

@testset "standard examples" begin
Expand Down

0 comments on commit 32eb6c0

Please sign in to comment.