I just want to know how to compare one row of a matrix with all the rows of the other matrix efficiently in python.
x=np.array(([-1,-1,-1,-1],[-1,-1,1,1])) #Patterns to be stored
t=np.array(([1,1,1,1])) #test vector
w=0*np.random.rand(4,4)
x_col1=x[0:1].T #Transpose of the 1st row
x_col2=x[1:2].T #Transpose of the second row
w=w+x[0:1].T*x[0]
w=w+x[1:2].T*x[1]
y_in=t*w
Here x is a 2x4 matrix and y_in is a 4x4 matrix. I just need to cut a single row from x and want to compare it with all the rows with y_in.