Update test_battery.py
This commit is contained in:
parent
16316bb3da
commit
36771c7d0d
@ -3,14 +3,14 @@ import itertools
|
|||||||
load('aplK.py')
|
load('aplK.py')
|
||||||
load("minimalModel_parallel.py")
|
load("minimalModel_parallel.py")
|
||||||
|
|
||||||
"""
|
|
||||||
S = simplicial_complexes.K3Surface()
|
#S = simplicial_complexes.K3Surface()
|
||||||
S.set_immutable()
|
#S.set_immutable()
|
||||||
cochainComplex = S.chain_complex(base_ring=QQ).dual()
|
#cochainComplex = S.chain_complex(base_ring=QQ).dual()
|
||||||
A = AlgebraAplK(S)
|
#A = AlgebraAplK(S)
|
||||||
smodel = load("sullivan_model_K3_deg3.sobj")
|
#smodel = load("sullivan_model_K3_deg3.sobj")
|
||||||
smorphism = load("model_morphism_K3_deg3.sobj")
|
#smorphism = load("model_morphism_K3_deg3.sobj")
|
||||||
"""
|
|
||||||
######### RUN MINIMAL MODEL ALGORITHM
|
######### RUN MINIMAL MODEL ALGORITHM
|
||||||
"""
|
"""
|
||||||
[sullivan_model, model_morphism, cohomology_correspondence] = minimal_model(S, max_depth=12000, max_dim=3)
|
[sullivan_model, model_morphism, cohomology_correspondence] = minimal_model(S, max_depth=12000, max_dim=3)
|
||||||
@ -108,44 +108,50 @@ for f in range(n+1):
|
|||||||
#print(p.integral() == dq.integral(), flush=True)
|
#print(p.integral() == dq.integral(), flush=True)
|
||||||
"""
|
"""
|
||||||
######### TEST DIFFERENTIAL/INTEGRAL COMMUTATION APL(K)
|
######### TEST DIFFERENTIAL/INTEGRAL COMMUTATION APL(K)
|
||||||
"""
|
|
||||||
def zip_with_constants(a, l):
|
def zip_with_constants(a,s,c, l):
|
||||||
return [(a, i) for i in l]
|
return [(a,s,c, i) for i in l]
|
||||||
|
|
||||||
@parallel(ncpus=Integer(24))
|
@parallel(ncpus=Integer(24))
|
||||||
def check(A,S):
|
def check_dif_int(A, S, cochainComplex, v):
|
||||||
"""
|
#print("Lifting random cochain dim ", dim, flush=True)
|
||||||
|
a = A.lift_cochain(A.vector_to_cochain(v,dim))
|
||||||
#S = simplicial_complexes.Sphere(6)
|
a.check() # the method raises an error if the aplk element is not properly built (i.e, the faces do not match)
|
||||||
S = simplicial_complexes.K3Surface()
|
#print("Check Apl(K) structure of the lifted element: ",a.check(), flush=True)
|
||||||
S.set_immutable()
|
da = a.differential()
|
||||||
cochainComplex = S.chain_complex(base_ring=QQ).dual()
|
Diff = cochainComplex.differential(dim)
|
||||||
A = AlgebraAplK(S)
|
cda = A.cochain_to_vector(da.integral(),dim+1)
|
||||||
for dim in range(4):
|
equal = Diff*v == cda
|
||||||
for i in range(1):
|
#print("Diff*v == cda.integral()", equal, flush=True)
|
||||||
v = random_vector(QQ, len(S.n_cells(dim)))
|
if not equal:
|
||||||
print("Lifting random cochain dim ", dim, flush=True)
|
raise Exception("the integrals are not equal ", flush=True)
|
||||||
a = A.lift_cochain(A.vector_to_cochain(v,dim))
|
return -1
|
||||||
print("Check Apl(K) structure of the lifted element: ",a.check(), flush=True)
|
for cell in S.n_cells(dim+1):
|
||||||
da = a.differential()
|
d = da.elements[cell.tuple()]
|
||||||
Diff = cochainComplex.differential(dim)
|
#s = (-1)**(dim*(dim-1)//2) # [FHT, RHT, p.129]
|
||||||
cda = A.cochain_to_vector(da.integral(),dim+1)
|
di = sum([((-1)**(f))*a.elements[cell.face(f).tuple()].integral() for f in range(cell.dimension()+1)])
|
||||||
equal = Diff*v == cda
|
equal = di == d.integral()
|
||||||
print("Diff*v == cda.integral()", equal, flush=True)
|
if equal:
|
||||||
if not equal:
|
None
|
||||||
|
#print("di == d.integral(): ", equal, flush=True)
|
||||||
|
else:
|
||||||
raise Exception("the integrals are not equal ", flush=True)
|
raise Exception("the integrals are not equal ", flush=True)
|
||||||
|
return -1
|
||||||
for cell in S.n_cells(dim+1):
|
return 0
|
||||||
d = da.elements[cell.tuple()]
|
|
||||||
#s = (-1)**(dim*(dim-1)//2) # [FHT, RHT, p.129]
|
|
||||||
di = sum([((-1)**(f))*a.elements[cell.face(f).tuple()].integral() for f in range(cell.dimension()+1)])
|
|
||||||
equal = di == d.integral()
|
|
||||||
if equal:
|
|
||||||
print("di == d.integral(): ", equal, flush=True)
|
|
||||||
else:
|
|
||||||
raise Exception("the integrals are not equal ", flush=True)
|
|
||||||
|
|
||||||
|
|
||||||
|
S = simplicial_complexes.Sphere(7)
|
||||||
|
#S = simplicial_complexes.K3Surface()
|
||||||
|
S.set_immutable()
|
||||||
|
A = AlgebraAplK(S)
|
||||||
|
cochainComplex = S.chain_complex(base_ring=QQ).dual()
|
||||||
|
N = 1
|
||||||
|
for dim in range(5):
|
||||||
|
l = [random_vector(QQ, len(S.n_cells(dim))) for i in range(N)]
|
||||||
|
data = zip_with_constants(A, S, cochainComplex, l)
|
||||||
|
print("Start parallel test at dimension " + str(dim), flush=True)
|
||||||
|
results = [i[1] for i in check_dif_int(data)]
|
||||||
|
|
||||||
|
print("Test finished", flush=True)
|
||||||
|
|
||||||
######### TEST DIFFERENTIAL/INTEGRAL COMMUTATION WITH RANDOM COCHAINS
|
######### TEST DIFFERENTIAL/INTEGRAL COMMUTATION WITH RANDOM COCHAINS
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user