I am trying to get the difference between each pair of element of 2 different numpy arrays (size: 1 X 150000). Here is the code used by me:
#the input numpy array are a and b
c = a - b.reshape((-1,1))
#For an array say a=np.array([1,2,7,6]) and b=np.array([1,2,7,6])
# c = array([[ 0, 2, 6, 5],
[-2, 0, 4, 3],
[-6, -4, 0, -1],
[-5, -3, 1, 0]])
I understand why it gives memory error using this code. How to update the code so that I don't get the error?
I tried using itertools combinations_with_replacement to but still not able to get desired results.