This will subtract col 0 from all cols of a 2-d array:
# subtract col 0 from all cols
def ll2llr (m):
return m - m[:,0][:,np.newaxis]
In general, how to subtract the (n-1)d slice at index 0 from all elements of an
n-d array?
(I think a 3d version is:
m - m[:,:,0][:,:,np.newaxis]
)