Fast Fourier Transform, Algorithms, Pattern Matching, Convolution, Combination Sum.
q_new[i] += [0]*(g1-m2) # Pad each column with 0s g2 = n1 + n2 if g2 & (g2-1) != 0: b = int(math.log(g2, 2))+1 g2 = (1 << b) p += [[0]*g1 for i in range(g2-n1)] q_new += [[0]*g1 for i in range(g2-n2)] # Define the omega's for row and columns separately omega_x = np.exp(2j*np.pi/g1) omega_x_inv =