Update test_battery.py

This commit is contained in:
calquezar 2024-08-22 17:33:20 +02:00
parent 70f5a78d4d
commit 6d963b5a3e

View File

@ -3,14 +3,34 @@ import itertools
load('aplK.py')
load("minimalModel_parallel.py")
#S = simplicial_complexes.K3Surface()
#S.set_immutable()
#cochainComplex = S.chain_complex(base_ring=QQ).dual()
#A = AlgebraAplK(S)
"""
S = simplicial_complexes.K3Surface()
S.set_immutable()
cochainComplex = S.chain_complex(base_ring=QQ).dual()
A = AlgebraAplK(S)
"""
#smodel = load("sullivan_model_K3_deg3.sobj")
#smorphism = load("model_morphism_K3_deg3.sobj")
######### TEST PRIMITIVE BASIS APLn
"""
s = SimplicialAlgebraplN(2)
s.inject_variables()
p = (t0+t1)**2*y1*y2
p = p.reduce()
q0 = p.propagate([1,2,3],3).reduce()
q2 = p.propagate([0,1,3],3).reduce()
dq0 = q0.differential().reduce()
dq2 = q2.differential().reduce()
S = simplicial_complexes.Sphere(4)
A = AlgebraAplK(S)
n = A.null_element(A)
dq0_pbasis = dq0._get_primitive_basis()
dq0_face_basis = n._face_basis(dq0_pbasis,0)
dq2_pbasis = dq2._get_primitive_basis()
dq2_face_basis = n._face_basis(dq2_pbasis,2)
"""
######### TEST INTEGRAND/INTEGRAL APLn
"""
@ -32,25 +52,25 @@ print("Test finished")
"""
######### TEST SOLVE PRIMITIVE WITH RANDOM COCHAINS
"""
S = simplicial_complexes.Sphere(4)
#S = simplicial_complexes.K3Surface()
#S = simplicial_complexes.Sphere(4)
S = simplicial_complexes.K3Surface()
S.set_immutable()
A = AlgebraAplK(S)
cochainComplex = S.chain_complex(base_ring=QQ).dual()
N = 4
N = 1
for dim in range(1,4):
for r in range(N):
print("Working on dimension ", dim, flush=True)
v = random_vector(QQ, len(S.n_cells(dim)))
print("Lifting random cochain", flush=True)
a = A.lift_cochain(A.vector_to_cochain(v,dim))
print("Checking Apl(K) structure", flush=True)
a.check()
#print("Checking Apl(K) structure", flush=True)
#a.check()
#if a.check():
# print("lift ok", flush=True)
da = a.differential()
print("Checking Apl(K) structure of the differential", flush=True)
da.check()
#print("Checking Apl(K) structure of the differential", flush=True)
#da.check()
#if da.check():
# print("da ok", flush=True)
#p_basis = da._get_primitive_basis()
@ -71,6 +91,10 @@ for dim in range(1,4):
else:
print("OK", flush=True)
print("Test finished", flush=True)
"""
######### TEST SOLVE PRIMITIVE WITH RANDOM COCHAINS (PARALLEL TEST)
"""
def zip_with_constants(a, b, c, l):
return [(a, b, c, i) for i in l]
@ -80,12 +104,12 @@ def check_solve_primitive(A, dim, Diff, v):
#print("Lift random cochain to Apl(K)", flush=True)
a = A.lift_cochain(A.vector_to_cochain(v,dim))
#print("Checking Apl(K) structure of the random element ", flush=True)
a.check()
#a.check()
#print(a.check(), flush=True)
da = a.differential()
b = da.solve_primitive()
print("Checking Apl(K) structure of the primitive element ", flush=True)
b.check()
#print("Checking Apl(K) structure of the primitive element ", flush=True)
#b.check()
print("Checking b.differential()==da ", flush=True)
equal = b.differential()==da
if not equal:
@ -103,7 +127,7 @@ S = simplicial_complexes.K3Surface()
S.set_immutable()
A = AlgebraAplK(S)
cochainComplex = S.chain_complex(base_ring=QQ).dual()
N = 96
N = 24
for dim in range(1,4):
Diff = cochainComplex.differential(dim)
random_cochains = [random_vector(QQ, len(S.n_cells(dim))) for i in range(N)]
@ -112,14 +136,28 @@ for dim in range(1,4):
results = [i[1] for i in check_solve_primitive(data)]
print("Test finished", flush=True)
######### RUN MINIMAL MODEL ALGORITHM
"""
######### RUN MINIMAL MODEL ALGORITHM
#S = simplicial_complexes.Torus()
#T = simplicial_complexes.Sphere(1)
#S = T.join(S)
#S.set_immutable()
S = simplicial_complexes.K3Surface()
S.set_immutable()
#cochainComplex = S.chain_complex(base_ring=QQ).dual()
#A = AlgebraAplK(S)
[sullivan_model, model_morphism, cohomology_correspondence] = minimal_model(S, max_depth=12000, max_dim=3)
print(sullivan_model, flush=True)
save(sullivan_model, "sullivan_model_K3_deg3")
save(model_morphism,"model_morphism_K3_deg3")
save(cohomology_correspondence,"cohomology_correspondence_K3_deg3")
"""
print("Test finished", flush=True)
######### TEST APLK STRUCTURE
"""
@parallel(ncpus=Integer(24))