Sign up to request clarification or add additional context in comments.
Comments
0
You can use list comprehension like this example:
x1 = np.array([0, 1])
x2 = np.array([1,2,3])
final = [[j+k for j in x2] for k in x1]
# Or, maybe:
# final = np.array([[j+k for j in x2] for k in x1])
# >>> array([[1, 2, 3], [2, 3, 4]])
x1[:,None]+x2.