I have a = array([1, 2, 3, 4, 5])
and b = array([10, 20, 30, 40, 50])
. I want:
array([[ -9, -19, -29, -39, -49],
[ -8, -18, -28, -38, -48],
[ -7, -17, -27, -37, -47],
[ -6, -16, -26, -36, -46],
[ -5, -15, -25, -35, -45]])
What's the most efficient way to do this? I have
np.transpose([a]) - np.tile(b, (len(a), 1))
However I wonder if there's a more efficient way than this if a
is very large, which wouldn't require copying b
so much (or vice versa).