gluons = [] for i in range(n): gluons.append(Particle(h[i], P[i], q_all)) gluons = np.array(gluons) end = timer() time_ini = end - start print("time_ini", time_ini) # manual method start = timer() #J__mu = J__a(gluons[:-1]).reshape(1,4) BG = BGCurrent(gluons[:-1]) J__mu = BG.J__a() eps_mu = gluons[-1].eps_a #A_n__tree_my = J__mu.dot(eps_mu)[0,0] A_n__tree_my = np.einsum('i,i', eps_mu.reshape(4), J__mu.reshape(4)) end = timer() time_my = end - start print("time_my", time_my) # Parke Taylor formula start = timer() A_n__tree_PT = PT(gluons) end = timer() time_PT = np.nan if np.isnan(A_n__tree_PT) else end - start print("time_PT", time_PT) t.test("The two formulas give equal amplitudes (n=" + str(n) + ")", equal(A_n__tree_my, A_n__tree_PT))
BG = BGCurrent(gluons[:-1]) J__mu = BG.J__a() eps_mu = gluons[-1].eps_a #A_n__tree_my = J__mu.dot(eps_mu)[0,0] A_n__tree_my = np.einsum('i,i', eps_mu.reshape(4), J__mu.reshape(4)) end = timer() time_my = end - start # Parke Taylor formula start = timer() A_n__tree_PT = PT(gluons) end = timer() time_PT = np.nan if np.isnan(A_n__tree_PT) else end - start t.test( "CASE " + str(j) + ": The two formulas give equal amplitudes (n=" + str(n) + ", " + h_configs[hi]['desc'] + ", " + q_configs[qi]['desc'] + ")", equal(A_n__tree_my, A_n__tree_PT)) print("time_PT", time_PT) print("time_my", time_my) #t.test("CASE "+str(j)+": The two formulas give equal magnitudes ("+h_configs[hi]['desc']+", "+q_configs[qi]['desc']+")", equal(np.abs(A_n__tree_my)**2, np.abs(A_n__tree_PT)**2)) if Y.get(q_desc, True) == True: Y[q_desc] = [] if Y.get(q_desc + "_PT", True) == True: Y[q_desc + "_PT"] = [] Y[q_desc].append(time_my) Y[q_desc + "_PT"].append(time_PT)