Example #1
0
def test_nested_boundary_simplicialcomplex():
    sigma = SimplicialComplex()
    sigma.add_simplex_fromfile('test_simplexfromfile.txt')

    for k in range(sigma.maxK + 1):
        print str(k) + '-th Chain group:'
        for k_sim in sigma.get_allkth_simplices(k):
            delta_k = Boundary()
            delta_k.compute_boundary(k_sim)
            print 'Boundary of: ', str(k_sim), ': ', str(delta_k)
Example #2
0
def test_nested_boundary_simplicialcomplex():
    sigma = SimplicialComplex()
    sigma.add_simplex_fromfile('test_simplexfromfile.txt')

    for k in xrange(sigma.maxK + 1):
        print str(k) + '-th Chain group:'
        for k_sim in sigma.get_allkth_simplices(k):
            delta_k = Boundary()
            delta_k.compute_boundary(k_sim)
            print 'Boundary of: ', str(k_sim), ': ', str(delta_k)
Example #3
0
def test_kth_boundary_group():
    sigma = SimplicialComplex()
    # sigma.add_simplex_fromfile('test_simplexfromfile.txt')
    sigma.add_simplex_fromfile("../../data/test_simplexfromfile.txt")

    # for k in range(sigma.maxK):  # not maxK + 1
    for k in range(0, 3):  # not maxK + 1
        print str(k) + '-th Boundary group:'
        Bk = KthBoundaryGroup(k)
        Bk.construct_from_simplex(sigma.get_allkth_simplices(k + 1), sigma.simplex_idmap,
                                  sigma.get_allkth_simplices(k))  # Send all the k+1 simplices to it
        print Bk.get_transformation_matrix()
        Bk.print_columnobjects()
        Bk.print_rowobjects()
Example #4
0
def test_manual_simplex():
    sim = KSimplex([1, 2, 3])
    C = SimplicialComplex()
    C.add_simplex(sim)
    for i in range(2):
        sim = KSimplex(range(i + 1))
        C.add_simplex(sim)
    C.add_simplex(KSimplex([2, 3]))
    print C
Example #5
0
def test_manual_simplex():
    sim = KSimplex([1, 2, 3])
    C = SimplicialComplex()
    C.add_simplex(sim)
    for i in range(2):
        sim = KSimplex(range(i + 1))
        C.add_simplex(sim)
    C.add_simplex(KSimplex([2, 3]))
    print C
__author__ = 'Naheed'
from src.simplex import KSimplex, SimplicialComplex
from src.BoundaryGroup import KthBoundaryGroup
from src.homology import another_bettinum, bettiNumber
from HomologyGroup import Homology

if __name__ == '__main__':
    # FilePath = "../../data/simplices.out"
    FilePath = "../../data/test_simplexfromfile.txt"

    sigma = SimplicialComplex()
    sigma.add_simplex_fromfile(FilePath)

    # for k in range(sigma.maxK):  # not maxK + 1
    for k in range(0, 1):  # not maxK
        # print str(k + 1) + '-th Transformation Matrix:'
        Bk = KthBoundaryGroup(k)
        Bk.construct_from_simplex(sigma.get_allkth_simplices(k + 1), sigma.simplex_idmap,
                                  sigma.get_allkth_simplices(k))  # Send all the k+1 simplices to it
        # print Bk.get_transformation_matrix()
        # print Bk.get_columnobjects()
        # print Bk.get_rowobjects()
        m = k + 1
        # print str(m + 1) + '-th Transformation Matrix:'
        Bk1 = KthBoundaryGroup(m)
        Bk1.construct_from_simplex(sigma.get_allkth_simplices(m + 1), sigma.simplex_idmap,
                                   sigma.get_allkth_simplices(m))  # Send all the k+1 simplices to it
        # print Bk1.get_transformation_matrix()
        #
        # print Bk1.get_columnobjects()
        # print Bk1.get_rowobjects()
Example #7
0
def test_file_simplex():
    sigma = SimplicialComplex()
    sigma.add_simplex_fromfile('test_simplexfromfile.txt')
    print sigma
Example #8
0
__author__ = 'Naheed'
from src.simplex import KSimplex, SimplicialComplex
from src.BoundaryGroup import KthBoundaryGroup
from src.homology import another_bettinum, bettiNumber
from HomologyGroup import Homology

if __name__ == '__main__':
    FilePath = "../../data/simplices.out"
    # FilePath = "../../data/test_simplexfromfile.txt"

    sigma = SimplicialComplex()
    sigma.add_simplex_fromfile(FilePath)

    # for k in range(sigma.maxK):  # not maxK + 1
    for k in range(-1, sigma.maxK + 1):  # not maxK
        # print str(k + 1) + '-th Transformation Matrix:'
        Bk = KthBoundaryGroup(k)
        Bk.construct_from_simplex(
            sigma.get_allkth_simplices(k + 1), sigma.simplex_idmap,
            sigma.get_allkth_simplices(k))  # Send all the k+1 simplices to it
        # print Bk.get_transformation_matrix()
        # print Bk.get_columnobjects()
        # print Bk.get_rowobjects()
        m = k + 1
        # print str(m + 1) + '-th Transformation Matrix:'
        Bk1 = KthBoundaryGroup(m)
        Bk1.construct_from_simplex(
            sigma.get_allkth_simplices(m + 1), sigma.simplex_idmap,
            sigma.get_allkth_simplices(m))  # Send all the k+1 simplices to it
        # print Bk1.get_transformation_matrix()
        #
Example #9
0
def test_file_simplex():
    sigma = SimplicialComplex()
    sigma.add_simplex_fromfile('test_simplexfromfile.txt')
    print sigma