Update test_aplK.py
This commit is contained in:
parent
e74e9e805c
commit
af473e56bc
137
test_aplK.py
137
test_aplK.py
@ -1,9 +1,12 @@
|
|||||||
|
from sage.all import *
|
||||||
|
import cProfile, pstats
|
||||||
|
import itertools
|
||||||
|
load('aplK.py')
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
# TEST
|
# TEST
|
||||||
load("aplK.py")
|
def test():
|
||||||
print("TEST AlgebraAplK")
|
print("TEST AlgebraAplK")
|
||||||
|
|
||||||
"""
|
|
||||||
S = SimplicialComplex([[0,1,2]],is_mutable=False)
|
S = SimplicialComplex([[0,1,2]],is_mutable=False)
|
||||||
A = AlgebraAplK(S)
|
A = AlgebraAplK(S)
|
||||||
print("Test check if the assignation is valid")
|
print("Test check if the assignation is valid")
|
||||||
@ -20,128 +23,10 @@ p12 = t0+3*t1
|
|||||||
s2 = SimplicialAlgebraplN(2)
|
s2 = SimplicialAlgebraplN(2)
|
||||||
s2.inject_variables()
|
s2.inject_variables()
|
||||||
p012 = 2-t1+t2
|
p012 = 2-t1+t2
|
||||||
#values = {(0,): p0, (1,): p1, (2,): p2, (0,1): p01, (0,2): p02, (1,2): p12, (0,1,2): p012}
|
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)
|
e1 = A._element_constructor_(values)
|
||||||
"""
|
print(e1)
|
||||||
######################################################################
|
|
||||||
"""
|
|
||||||
S = SimplicialComplex([[0,1,2,3]],is_mutable=False)
|
|
||||||
A = AlgebraAplK(S)
|
|
||||||
s3 = SimplicialAlgebraplN(3)
|
|
||||||
s3.inject_variables()
|
|
||||||
p0123 = (t1**2)*y1+t3*y0+y2+t1*y2+t2*y1
|
|
||||||
s2 = SimplicialAlgebraplN(2)
|
|
||||||
s2.inject_variables()
|
|
||||||
p012 = p0123.face(3)
|
|
||||||
p013 = p0123.face(2)
|
|
||||||
p023 = p0123.face(1)
|
|
||||||
p123 = p0123.face(0)
|
|
||||||
s1 = SimplicialAlgebraplN(1)
|
|
||||||
s1.inject_variables()
|
|
||||||
p01 = p012.face(2)
|
|
||||||
p02 = p012.face(1)
|
|
||||||
p03 = p013.face(1)
|
|
||||||
p12 = p012.face(0)
|
|
||||||
p13 = p013.face(0)
|
|
||||||
p23 = p123.face(0)
|
|
||||||
s0 = SimplicialAlgebraplN(0)
|
|
||||||
s0.inject_variables()
|
|
||||||
p0 = p01.face(1)
|
|
||||||
p1 = p01.face(0)
|
|
||||||
p2 = p12.face(0)
|
|
||||||
p3 = p03.face(0)
|
|
||||||
|
|
||||||
values = {(0,): p0, (1,): p1, (2,): p2, (3,):p3,
|
|
||||||
(0,1): p01, (0,2): p02, (0,3): p03, (1,2): p12, (1,3): p13, (2,3): p23,
|
|
||||||
(0,1,2): p012, (0,1,3):p013, (0,2,3): p023, (1,2,3):p123,
|
|
||||||
(0,1,2,3):p0123}
|
|
||||||
e1 = A._element_constructor_(values)
|
|
||||||
de1 = e1.differential()
|
|
||||||
"""
|
|
||||||
#####################################################################
|
|
||||||
"""
|
|
||||||
S = SimplicialComplex([[0,1,2],[0,2,3]],is_mutable=False)
|
|
||||||
A = AlgebraAplK(S)
|
|
||||||
s2 = SimplicialAlgebraplN(2)
|
|
||||||
s2.inject_variables()
|
|
||||||
p012 = t0*y2+t2*y0
|
|
||||||
p023 = t0*y1+t1*y0
|
|
||||||
s1 = SimplicialAlgebraplN(1)
|
|
||||||
s1.inject_variables()
|
|
||||||
p01 = p012.face(2)
|
|
||||||
p02 = p012.face(1)
|
|
||||||
p03 = p023.face(1)
|
|
||||||
p12 = p012.face(0)
|
|
||||||
p23 = p023.face(0)
|
|
||||||
s0 = SimplicialAlgebraplN(0)
|
|
||||||
s0.inject_variables()
|
|
||||||
p0 = p01.face(1)
|
|
||||||
p1 = p01.face(0)
|
|
||||||
p2 = p12.face(0)
|
|
||||||
p3 = p03.face(0)
|
|
||||||
|
|
||||||
values = {(0,): p0, (1,): p1, (2,): p2, (3,):p3,
|
|
||||||
(0,1): p01, (0,2): p02, (0,3): p03, (1,2): p12, (2,3): p23,
|
|
||||||
(0,1,2): p012, (0,2,3): p023}
|
|
||||||
e1 = A._element_constructor_(values)
|
|
||||||
de1 = e1.differential()
|
|
||||||
"""
|
|
||||||
#####################################################################
|
|
||||||
S = SimplicialComplex([[0,1,2,3],[0,2,3,4]],is_mutable=False)
|
|
||||||
A = AlgebraAplK(S)
|
|
||||||
s3.inject_variables()
|
|
||||||
p0123 = (t1**2)*y1+t3*y0+y2+t1*y2+t2*y1
|
|
||||||
p0234 = (t1**2)*y1+t3*y0+y2+t1*y2+t2*y1
|
|
||||||
s2 = SimplicialAlgebraplN(2)
|
|
||||||
s2.inject_variables()
|
|
||||||
p012 = p0123.face(3)
|
|
||||||
p013 = p0123.face(2)
|
|
||||||
p023 = p0123.face(1)
|
|
||||||
p123 = p0123.face(0)
|
|
||||||
p024 = p0234.face(2)
|
|
||||||
p034 = p0234.face(1)
|
|
||||||
p234 = p0234.face(0)
|
|
||||||
s1 = SimplicialAlgebraplN(1)
|
|
||||||
s1.inject_variables()
|
|
||||||
p01 = p012.face(2)
|
|
||||||
p02 = p012.face(1)
|
|
||||||
p03 = p013.face(1)
|
|
||||||
p04 = p024.face(1)
|
|
||||||
p12 = p012.face(0)
|
|
||||||
p13 = p013.face(0)
|
|
||||||
p23 = p123.face(0)
|
|
||||||
p24 = p024.face(2)
|
|
||||||
p34 = p034.face(0)
|
|
||||||
s0 = SimplicialAlgebraplN(0)
|
|
||||||
s0.inject_variables()
|
|
||||||
p0 = p01.face(1)
|
|
||||||
p1 = p01.face(0)
|
|
||||||
p2 = p12.face(0)
|
|
||||||
p3 = p03.face(0)
|
|
||||||
p4 = p04.face(0)
|
|
||||||
|
|
||||||
values = {(0,): p0, (1,): p1, (2,): p2, (3,):p3, (4,):p4,
|
|
||||||
(0,1): p01, (0,2): p02, (0,3): p03, (0,4): p04, (1,2): p12, (1,3):p13, (2,3): p23,
|
|
||||||
(0,1,2): p012, (0,2,3): p023}
|
|
||||||
e1 = A._element_constructor_(values)
|
|
||||||
de1 = e1.differential()
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
"""
|
|
||||||
for k in de1.elements.keys():
|
|
||||||
e = de1.elements[k]
|
|
||||||
print(k, e)
|
|
||||||
if e:
|
|
||||||
print(e.total_degree())
|
|
||||||
"""
|
|
||||||
e2 = e1.solve_primitive()
|
|
||||||
print("de1: ",de1)
|
|
||||||
print("e2: ",e2)
|
|
||||||
print("e1: ",e1)
|
|
||||||
|
|
||||||
if e1 == e2.differential():
|
|
||||||
print("the differential of e2 is EQUAL to e1")
|
|
||||||
else:
|
|
||||||
print("the differential of e1 is NOT EQUAL to e1")
|
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
|
cProfile.runctx("test()", globals(), locals(), "Profile.prof")
|
||||||
|
s = pstats.Stats("Profile.prof")
|
||||||
|
s.strip_dirs().sort_stats("cumtime").print_stats()
|
||||||
Loading…
Reference in New Issue
Block a user