def iterate_over_4op(a, b, c, d, gamma_sin, eta_sin, lambda2, lambda3=None): if lambda3 is None : lambda3=[] matrix = [] classmat = [] a1 = copy.deepcopy(a) b1 = copy.deepcopy(b) c1 = copy.deepcopy(c) d1 = copy.deepcopy(d) for i1 in range(len(a)): for i2 in range(len(b)): for i3 in range(len(c)): for i4 in range(len(d)): matrixtmp = [] #important item4,item3,item2,item1 = make_dagger(d[i4],c[i3],b[i2],a[i1],0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) for i5 in range(len(a1)): for i6 in range(len(b1)): for i7 in range(len(c1)): for i8 in range(len(d1)): item5,item6,item7,item8 = make_dagger(a1[i5],b1[i6],c1[i7],d1[i8],4,2) string2 = [item5,item6,item7,item8] #class_mat.append(copy.deepcopy(string2) full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2, lambda3) #print 'val of box', full_val matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) #print matrix return matrix, classmat
def orthogonalize(a, b, Sa, gamma_sin, eta_sin, lambda2): c= [] print Sa y = return_truncatedX(Sa, 0) print 'before transpose\n', y y = np.transpose(y) print 'after transpose\n', y #x, d, y = np.linalg.svd(Sa, full_matrices=0, compute_uv=1) c = ortho_overlap(a, b, y, gamma_sin, eta_sin, lambda2) print '\nC\n', c #c = np.transpose(c) print 'check dim \n', c, y c= np.dot(c, y) matrix = [] matrixtmp=[] for item1 in a: for item2 in b: c1 = [] c2= [] for i in range(len(item1)-1, -1, -1): c1.append(copy.deepcopy(item1[i])) c2 = copy.deepcopy(item2) prepare(c1, c2) full_con, const_con = ewt.ewt(c1,c2) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) #store them in a list matrixtmp.append(full_val) #append in another list matrix.append(matrixtmp) matrixtmp = [] #multiply with [SX] submat = np.dot(c, matrix) print 'submat\n', submat return submat
def iterate_over_4op1(a, b, c, d, gamma_sin, eta_sin, lambda2): matrix = [] classmat = [] a1 = copy.deepcopy(a) b1 = copy.deepcopy(b) c1 = copy.deepcopy(c) d1 = copy.deepcopy(d) for item1 in a: for item2 in b: for item3 in c: for item4 in d: matrixtmp = [] #important item4, item3, item2, item1 = make_dagger( item4, item3, item2, item1, 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) for item5 in a1: for item6 in b1: for item7 in c1: for item8 in d1: item5, item6, item7, item8 = make_dagger( item5, item6, item7, item8, 4, 2) string2 = [item5, item6, item7, item8] #class_mat.append(copy.deepcopy(string2) full_con, const_con = ewt.ewt( copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate( full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) return matrix, classmat
def iterate_over_4op1(a, b, c, d, gamma_sin, eta_sin, lambda2): matrix = [] classmat = [] a1 = copy.deepcopy(a) b1 = copy.deepcopy(b) c1 = copy.deepcopy(c) d1 = copy.deepcopy(d) for item1 in a: for item2 in b: for item3 in c: for item4 in d: matrixtmp = [] #important item4,item3,item2,item1 = make_dagger(item4,item3,item2,item1,0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) for item5 in a1: for item6 in b1: for item7 in c1: for item8 in d1: item5,item6,item7,item8 = make_dagger(item5,item6,item7,item8,4,2) string2 = [item5,item6,item7,item8] #class_mat.append(copy.deepcopy(string2) full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) return matrix, classmat
def ortho_overlap(c1, c2, xi, gamma_sin, eta_sin, lambda2): matrix = [] matrixtmp = [] for item2 in c2: for item1 in c1: #contract all c1 with c2 a = [] for i in range(len(item2) - 1, -1, -1): a.append(item2[i]) #a= copy.deepcopy(item2) b = copy.deepcopy(item1) print a, b prepare(a, b) for item in a: print 'dag', item.dag, 'pos', item.pos, 'string', item.string, 'kind', item.kind for item in b: print 'dag', item.dag, 'pos', item.pos, 'string', item.string, 'kind', item.kind full_con, const_con = ewt.ewt(a, b) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) #store them in a list print full_val matrixtmp.append(full_val) #append in another list matrix.append(matrixtmp) #empty first list matrixtmp = [] matrixStmp = [] matrixS = [] for j in range(len(matrix)): for i in range(len(xi)): #take dot from the xth item in list x1 print 'check the dmention:\n', xi[i], matrix[j], '\n size\n', len( xi) dot = np.sum(np.dot(xi[i], matrix[j])) print 'dot\n', dot matrixStmp.append(dot) #store in another list matrixS.append(matrixStmp) print 'matrixS\n', matrixS, 'xi\n', xi, 'matrix\n', matrix matrixStmp = [] #x+1 #list store in another return matrixS
def ortho_overlap(c1, c2, xi, gamma_sin, eta_sin, lambda2): matrix = [] matrixtmp = [] for item2 in c2: for item1 in c1: #contract all c1 with c2 a= [] for i in range(len(item2)-1, -1, -1): a.append(item2[i]) #a= copy.deepcopy(item2) b= copy.deepcopy(item1) print a, b prepare(a,b) for item in a: print 'dag', item.dag, 'pos', item.pos, 'string', item.string, 'kind', item.kind for item in b: print 'dag', item.dag, 'pos', item.pos, 'string', item.string, 'kind', item.kind full_con, const_con = ewt.ewt(a, b) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) #store them in a list print full_val matrixtmp.append(full_val) #append in another list matrix.append(matrixtmp) #empty first list matrixtmp = [] matrixStmp = [] matrixS = [] for j in range(len(matrix)): for i in range(len(xi)): #take dot from the xth item in list x1 print 'check the dmention:\n', xi[i], matrix[j], '\n size\n', len(xi) dot = np.sum(np.dot(xi[i], matrix[j])) print 'dot\n', dot matrixStmp.append(dot) #store in another list matrixS.append(matrixStmp) print 'matrixS\n', matrixS, 'xi\n', xi, 'matrix\n', matrix matrixStmp =[] #x+1 #list store in another return matrixS
def iterate_over_4op(a, b, c, d, gamma_sin, eta_sin, lambda2, lambda3=None): if lambda3 is None: lambda3 = [] matrix = [] classmat = [] a1 = copy.deepcopy(a) b1 = copy.deepcopy(b) c1 = copy.deepcopy(c) d1 = copy.deepcopy(d) for i1 in range(len(a)): for i2 in range(len(b)): for i3 in range(len(c)): for i4 in range(len(d)): matrixtmp = [] #important item4, item3, item2, item1 = make_dagger( d[i4], c[i3], b[i2], a[i1], 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) for i5 in range(len(a1)): for i6 in range(len(b1)): for i7 in range(len(c1)): for i8 in range(len(d1)): item5, item6, item7, item8 = make_dagger( a1[i5], b1[i6], c1[i7], d1[i8], 4, 2) string2 = [item5, item6, item7, item8] #class_mat.append(copy.deepcopy(string2) full_con, const_con = ewt.ewt( copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate( full_con, const_con, gamma_sin, eta_sin, lambda2, lambda3) #print 'val of box', full_val matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) #print matrix return matrix, classmat
def orthogonalize(a, b, Sa, gamma_sin, eta_sin, lambda2): c = [] print Sa y = return_truncatedX(Sa, 0) print 'before transpose\n', y y = np.transpose(y) print 'after transpose\n', y #x, d, y = np.linalg.svd(Sa, full_matrices=0, compute_uv=1) c = ortho_overlap(a, b, y, gamma_sin, eta_sin, lambda2) print '\nC\n', c #c = np.transpose(c) print 'check dim \n', c, y c = np.dot(c, y) matrix = [] matrixtmp = [] for item1 in a: for item2 in b: c1 = [] c2 = [] for i in range(len(item1) - 1, -1, -1): c1.append(copy.deepcopy(item1[i])) c2 = copy.deepcopy(item2) prepare(c1, c2) full_con, const_con = ewt.ewt(c1, c2) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) #store them in a list matrixtmp.append(full_val) #append in another list matrix.append(matrixtmp) matrixtmp = [] #multiply with [SX] submat = np.dot(c, matrix) print 'submat\n', submat return submat
def iterate_over_4op_special(orb1,orb2,orb3,orb4, gamma_sin, eta_sin, lambda2, typ): matrix = [] classmat = [] a = copy.deepcopy(orb1) b = copy.deepcopy(orb2) c = copy.deepcopy(orb3) d = copy.deepcopy(orb4) a1 = copy.deepcopy(orb1) b1 = copy.deepcopy(orb2) c1 = copy.deepcopy(orb3) d1 = copy.deepcopy(orb4) if (typ==1): for index1 in range(len(a)): for index2 in range(index1, len(b)): for item3 in c: for item4 in d: matrixtmp = [] #important item4,item3,item2,item1 = make_dagger(item4,item3,b[index2],a[index1],0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) for index5 in range(len(a1)): for index6 in range(index5, len(b1)): for item7 in c1: for item8 in d1: item5,item6,item7,item8 = make_dagger(a1[index5], b1[index6], item7, item8,4,2) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) elif typ==2: for item1 in a: for item2 in b: for index3 in range(len(c)): for index4 in range(index3, len(d)): matrixtmp = [] #important item4,item3,item2,item1 = make_dagger(d[index4], c[index3], item2, item1,0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) for item5 in a1: for item6 in b1: for index7 in range(len(c1)): for index8 in range(index7, len(d1)): item5,item6,item7,item8 = make_dagger(item5, item6, c1[index7],d1[index8],4,2) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) elif typ == 3: matrixtmp = [] #important item4,item3,item2,item1 = make_dagger(d[0], c[0], b[0],a[0],0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) item5,item6,item7,item8 = make_dagger(a1[0], b1[0], c1[0], d1[0],4,2) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) item4,item3,item2,item1 = make_dagger(d[0], c[0], b[0],a[0],0,1) string1 = [item4,item3,item2,item1] item5,item6,item7,item8 = make_dagger(b1[0], a1[0], c1[0], d1[0],4,2) classmat.append([item1, item2, item3, item4]) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) matrixtmp = [] item4,item3,item2,item1 = make_dagger(d[0], c[0], a[0],b[0],0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) item5,item6,item7,item8 = make_dagger(a1[0], b1[0], c1[0], d1[0],4,2) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) item4,item3,item2,item1 = make_dagger(d[0], c[0], a[0],b[0],0,1) string1 = [item4,item3,item2,item1] item5,item6,item7,item8 = make_dagger(b1[0], a1[0], c1[0], d1[0],4,2) classmat.append([item1, item2, item3, item4]) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) elif typ ==4: flag1=1 for i1 in range(2): if flag1 ==1: a2 = copy.deepcopy(orb1) b2 = copy.deepcopy(orb2) flag1=0 else : a2=copy.deepcopy(orb2) b2=copy.deepcopy(orb1) for item1 in a2: for item2 in b2: for item3 in c: for item4 in d: flag2=1 matrixtmp = [] #important item4,item3,item2,item1 = make_dagger(item4, item3,item2,item1,0,1) string1 = [item4,item3,item2,item1] classmat.append([item1, item2, item3, item4]) for i2 in range(2): if flag2 == 1: a1 = copy.deepcopy(orb1) b1 = copy.deepcopy(orb2) flag2=0 else : a1=copy.deepcopy(orb2) b1=copy.deepcopy(orb1) for item5 in a1: for item6 in b1: for item7 in c1: for item8 in d1: item5,item6,item7,item8 = make_dagger(item5, item6,item7,item8,4,2) string2 = [item5,item6,item7,item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) return matrix, classmat
def single_excited_overlap(holes, active, particles, matrix_no, gamma_sin, eta_sin, lambda2): #for i_a ia case : classmat= [] if matrix_no==2 or matrix_no==3: #take 1 i or 1 a whatever is required :according to the no_matrix with an if condition if matrix_no == 3: if particles: orb1 = copy.deepcopy(particles[0]) orb2 = copy.deepcopy(particles[0]) else : print "matrix type 2 cannot be formed : particles or holes not present \n" return 0 elif matrix_no == 2: if holes: orb1 = copy.deepcopy(holes[0]) orb2 = copy.deepcopy(holes[0]) else : print "matrix type 3 cant be formed : holes or particles not present \n" return 0 #make the daggered matrix of u or the undaggered version: save them in a and b matrix according to the no_matrix active_d = copy.deepcopy(active) for item in active_d : item.dag = 1 matrix = [] active_n = copy.deepcopy(active) for item in active_n : item.dag = 0 #run the loop for u: make a triangle matrix for item1 in active_d: matrixtmp = []#important to empty otherwise add extra terms p1 = 1 #the two cases of i->u or a->u if matrix_no == 3: item1.dag = '1' orb1.dag = '0' string1 = [item1, orb1] classmat.append([orb1, item1]) if matrix_no == 2: item1.dag = '0' orb1.dag = '1' string1 = [orb1, item1] classmat.append([item1, orb1]) for item in string1: item.string = 1 item.pos = p1 p1+=1 for item2 in active_n: p2 = p1 full_con = [] #the two cases of i->u or a->u if matrix_no == 3: item2.dag = '0' orb2.dag = '1' string2 = [orb2, item2] if matrix_no == 2: item2.dag = '1' orb2.dag = '0' string2 = [item2, orb2] for item in string2: item.string = 2 item.pos = p2 p2+=1 full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) #print full_con, const_con full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) #make the triangle matrix : multiply the terms of the same term, add them to the next list by multiplying to the sign and constant return matrix, classmat
def single_excited_overlap(holes, active, particles, matrix_no, gamma_sin, eta_sin, lambda2): #for i_a ia case : classmat = [] if matrix_no == 2 or matrix_no == 3: #take 1 i or 1 a whatever is required :according to the no_matrix with an if condition if matrix_no == 3: if particles: orb1 = copy.deepcopy(particles[0]) orb2 = copy.deepcopy(particles[0]) else: print "matrix type 2 cannot be formed : particles or holes not present \n" return 0 elif matrix_no == 2: if holes: orb1 = copy.deepcopy(holes[0]) orb2 = copy.deepcopy(holes[0]) else: print "matrix type 3 cant be formed : holes or particles not present \n" return 0 #make the daggered matrix of u or the undaggered version: save them in a and b matrix according to the no_matrix active_d = copy.deepcopy(active) for item in active_d: item.dag = 1 matrix = [] active_n = copy.deepcopy(active) for item in active_n: item.dag = 0 #run the loop for u: make a triangle matrix for item1 in active_d: matrixtmp = [] #important to empty otherwise add extra terms p1 = 1 #the two cases of i->u or a->u if matrix_no == 3: item1.dag = '1' orb1.dag = '0' string1 = [item1, orb1] classmat.append([orb1, item1]) if matrix_no == 2: item1.dag = '0' orb1.dag = '1' string1 = [orb1, item1] classmat.append([item1, orb1]) for item in string1: item.string = 1 item.pos = p1 p1 += 1 for item2 in active_n: p2 = p1 full_con = [] #the two cases of i->u or a->u if matrix_no == 3: item2.dag = '0' orb2.dag = '1' string2 = [orb2, item2] if matrix_no == 2: item2.dag = '1' orb2.dag = '0' string2 = [item2, orb2] for item in string2: item.string = 2 item.pos = p2 p2 += 1 full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) #print full_con, const_con full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) #make the triangle matrix : multiply the terms of the same term, add them to the next list by multiplying to the sign and constant return matrix, classmat
def iterate_over_4op_special(orb1, orb2, orb3, orb4, gamma_sin, eta_sin, lambda2, typ): matrix = [] classmat = [] a = copy.deepcopy(orb1) b = copy.deepcopy(orb2) c = copy.deepcopy(orb3) d = copy.deepcopy(orb4) a1 = copy.deepcopy(orb1) b1 = copy.deepcopy(orb2) c1 = copy.deepcopy(orb3) d1 = copy.deepcopy(orb4) if (typ == 1): for index1 in range(len(a)): for index2 in range(index1, len(b)): for item3 in c: for item4 in d: matrixtmp = [] #important item4, item3, item2, item1 = make_dagger( item4, item3, b[index2], a[index1], 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) for index5 in range(len(a1)): for index6 in range(index5, len(b1)): for item7 in c1: for item8 in d1: item5, item6, item7, item8 = make_dagger( a1[index5], b1[index6], item7, item8, 4, 2) string2 = [item5, item6, item7, item8] full_con, const_con = ewt.ewt( copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate( full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) elif typ == 2: for item1 in a: for item2 in b: for index3 in range(len(c)): for index4 in range(index3, len(d)): matrixtmp = [] #important item4, item3, item2, item1 = make_dagger( d[index4], c[index3], item2, item1, 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) for item5 in a1: for item6 in b1: for index7 in range(len(c1)): for index8 in range(index7, len(d1)): item5, item6, item7, item8 = make_dagger( item5, item6, c1[index7], d1[index8], 4, 2) string2 = [item5, item6, item7, item8] full_con, const_con = ewt.ewt( copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate( full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) elif typ == 3: matrixtmp = [] #important item4, item3, item2, item1 = make_dagger(d[0], c[0], b[0], a[0], 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) item5, item6, item7, item8 = make_dagger(a1[0], b1[0], c1[0], d1[0], 4, 2) string2 = [item5, item6, item7, item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) item4, item3, item2, item1 = make_dagger(d[0], c[0], b[0], a[0], 0, 1) string1 = [item4, item3, item2, item1] item5, item6, item7, item8 = make_dagger(b1[0], a1[0], c1[0], d1[0], 4, 2) classmat.append([item1, item2, item3, item4]) string2 = [item5, item6, item7, item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) matrixtmp = [] item4, item3, item2, item1 = make_dagger(d[0], c[0], a[0], b[0], 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) item5, item6, item7, item8 = make_dagger(a1[0], b1[0], c1[0], d1[0], 4, 2) string2 = [item5, item6, item7, item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) item4, item3, item2, item1 = make_dagger(d[0], c[0], a[0], b[0], 0, 1) string1 = [item4, item3, item2, item1] item5, item6, item7, item8 = make_dagger(b1[0], a1[0], c1[0], d1[0], 4, 2) classmat.append([item1, item2, item3, item4]) string2 = [item5, item6, item7, item8] full_con, const_con = ewt.ewt(copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate(full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) elif typ == 4: flag1 = 1 for i1 in range(2): if flag1 == 1: a2 = copy.deepcopy(orb1) b2 = copy.deepcopy(orb2) flag1 = 0 else: a2 = copy.deepcopy(orb2) b2 = copy.deepcopy(orb1) for item1 in a2: for item2 in b2: for item3 in c: for item4 in d: flag2 = 1 matrixtmp = [] #important item4, item3, item2, item1 = make_dagger( item4, item3, item2, item1, 0, 1) string1 = [item4, item3, item2, item1] classmat.append([item1, item2, item3, item4]) for i2 in range(2): if flag2 == 1: a1 = copy.deepcopy(orb1) b1 = copy.deepcopy(orb2) flag2 = 0 else: a1 = copy.deepcopy(orb2) b1 = copy.deepcopy(orb1) for item5 in a1: for item6 in b1: for item7 in c1: for item8 in d1: item5, item6, item7, item8 = make_dagger( item5, item6, item7, item8, 4, 2) string2 = [ item5, item6, item7, item8 ] full_con, const_con = ewt.ewt( copy.deepcopy(string1), copy.deepcopy(string2)) full_val = func_ewt.evaluate( full_con, const_con, gamma_sin, eta_sin, lambda2) matrixtmp.append(full_val) matrix.append(copy.deepcopy(matrixtmp)) return matrix, classmat