scipy/scipy — pull request #270 by djv (2012-07-18 22:58:31+00:00)
Title: Fix edge case in lstsq function

Looking at http://stackoverflow.com/questions/11549486/linearregression-returns-list-within-list-sklearn/ and digging through the code I found that the lstsq function wasn't behaving correctly. It's doc says that:

Returns
-------
x : array, shape (N,) or (N, K) depending on shape of b
Least-squares solution.

for

a : array, shape (M, N)
Left hand side matrix (2-D array).
b : array, shape (M,) or (M, K)
Right hand side matrix or vector (1-D or 2-D array).

But for the case `a.shape==(2,6)` and `b.shape==(2,)` we get `x.shape==(6,1)` instead of `(6,)`.

I've tried to patch the code to work correctly for that case.