Consider the following code:
>>x=np.array([1,3]).reshape(2,1)
array([[1],
[3]])
>>M=np.array([[1,2],[3,4]])
array([[1, 2],
[3, 4]])
>>y=M[:,0]
>>x-y
array([[ 0, 2],
[-2, 0]])
I would intuitively feel this should give a (2,1) vector of zeros.
I am not saying, however, that this is how it should be done and everything else is stupid. I would simply love if someone could offer some logic that I can remember so things like this don't keep producing bugs in my code.
Note that I am not asking how I can achieve what I want (I could reshape y), but I am hoping to get some deeper understanding of why Python/Numpy works as it does. Maybe I am doing something conceptually wrong?