wildart / ComputationalHomology.jl

This package provides various computational homology tools for cellular complexes.
Other
12 stars 3 forks source link

Wrong homology groups #3

Open rballeba opened 2 years ago

rballeba commented 2 years ago

Good morning,

I was trying to compute a well known homology group (a torus with 3 circumferences identified to 3 lines) and I got an error in its computation using this library. The same triangulation worked as expected in the library Polymake so I guess there is some kind of error in the implementation (or it may be that I'm not using it well).

I give you the code to reproduce the error:

using ComputationalHomology

dim_0_simplices = [Simplex(i) for i in 0:5]
dim_1_simplices = [Simplex(0, 1), Simplex(0, 2), Simplex(0, 3), Simplex(0,4),
Simplex(0,5),Simplex(1, 2), Simplex(1,3), 
    Simplex(1, 4), Simplex(1, 5), Simplex(2, 3), 
    Simplex(2, 4), Simplex(2, 5), Simplex(3,4), 
    Simplex(3, 5), Simplex(4, 5)]
dim_2_simplices = [Simplex(0,1,3), Simplex(0, 1, 4), Simplex(0, 2, 3), 
    Simplex(0, 2, 5), Simplex(0, 3, 4), Simplex(0, 3, 5), Simplex(1, 2, 4), 
    Simplex(1, 2, 5), Simplex(1, 3, 4), Simplex(1, 4, 5), Simplex(2, 3, 5), Simplex(2, 4, 5)]
cplx = SimplicialComplex((vcat(vcat(dim_0_simplices, dim_1_simplices), dim_2_simplices)...))

h = homology(Int, cplx)

betti(h) 

>> (1,1)
using Polymake

dim_0_simplices = [Set([i]) for i in 0:5]
dim_1_simplices = [Set((0, 1)), Set((0, 2)), Set((0, 3)), Set((0,4)),
Set((0,5)),Set((1, 2)), Set((1,3)), 
    Set((1, 4)), Set((1, 5)), Set((2, 3)), 
    Set((2, 4)), Set((2, 5)), Set((3,4)), 
    Set((3, 5)), Set((4, 5))]
dim_2_simplices = [Set((0,1,3)), Set((0, 1, 4)), Set((0, 2, 3)), 
    Set((0, 2, 5)), Set((0, 3, 4)), Set((0, 3, 5)), Set((1, 2, 4)),
    Set((1, 2, 5)), Set((1, 3, 4)), Set((1, 4, 5)), Set((2, 3, 5)), Set((2, 4, 5))]

cplx = topaz.SimplicialComplex(INPUT_FACES=vcat(vcat(dim_0_simplices, dim_1_simplices), dim_2_simplices))

f = cplx.HOMOLOGY

>>
 ({} 0)
({} 1)
({} 3)

I leave here a link with the triangulation in question:

https://math.stackexchange.com/questions/821380/why-is-this-not-a-triangulation-of-the-torus

rballeba commented 2 years ago

The only problem seems that it does not return the betti number of dimension 2.