I have 2 numpy arrays a and b as below:
a = np.random.randint(0,10,(3,2)) Out[124]: array([[0, 2], [6, 8], [0, 4]]) b = np.random.randint(0,10
I'm not sure what means a fully factorized solution, but may be this will help:
np.append(a, a, axis=1).reshape(3, 2, 2) - b