[Numpy-discussion] Confused by spec of numpy.linalg.solve

Bob Dowling rjd4+numpy at cam.ac.uk
Tue Apr 1 16:39:29 EDT 2014


On 04/01/2014 04:25 PM, Nathaniel Smith wrote:
> On Tue, Apr 1, 2014 at 3:57 PM, Sebastian Berg
> <sebastian at sipsolutions.net> wrote:
>> If `a` has exactly one dimension more then `b`, the first case is used.
>> Otherwise (..., M, K) is used instead. To make sure you always get the
>> expected result, it may be best to make sure that the number of
>> broadcasting (...) dimensions of `a` and `b` are identical (I am not
>> sure if you expect this to be the case or not). The shape itself does
>> not matter, only the (relative) number of dimensions does for the
>> decision which of the two signatures is used.
> Oh, really? This seems really unfortunate

It also seems quite counter-intuitive.  It means that an array "a" of 
shape (3,3) will behave radically differently to one of shape (1,3,3).  
But thank you for the explanation.



More information about the NumPy-Discussion mailing list