I have two large numpy arrays A, B. How can I efficiently (e.g. using numpy vectorization) compute a matrix C of shape len(A) * len(B) such that C[i,j]=A[i]- C[j].
For example, A is
a
b
c
B is
d
e
f
g
Then expected C is
a-d a-e a-f a-g
b-d b-e b-f b-g
c-d c-e c-f c-g