AplK/test_aplK.py
2024-08-18 13:09:34 +02:00

32 lines
945 B
Python

from sage.all import *
import cProfile, pstats
import itertools
load('aplK.py')
#############################################
# TEST
def test():
print("TEST AlgebraAplK")
S = SimplicialComplex([[0,1,2]],is_mutable=False)
A = AlgebraAplK(S)
print("Test check if the assignation is valid")
s0 = SimplicialAlgebraplN(0)
s0.inject_variables()
p0 = s0(2)
p1 = s0(1)
p2 = s0(3)
s1 = SimplicialAlgebraplN(1)
s1.inject_variables()
p01 = 2*t0+t1
p02 = 2*t0+3*t1
p12 = t0+3*t1
s2 = SimplicialAlgebraplN(2)
s2.inject_variables()
p012 = 2-t1+t2
values = {(0,): p0, (1,): p1, (2,): p2, (0,1): p01, (0,2): p02, (1,2): p12, (0,1,2): p012}
e1 = A._element_constructor_(values)
print(e1)
#############################################
cProfile.runctx("test()", globals(), locals(), "Profile.prof")
s = pstats.Stats("Profile.prof")
s.strip_dirs().sort_stats("cumtime").print_stats()