(self, m, n, n_rhs)
| 971 | (0, 0, 0) |
| 972 | ]) |
| 973 | def test_empty_a_b(self, m, n, n_rhs): |
| 974 | a = np.arange(m * n).reshape(m, n) |
| 975 | b = np.ones((m, n_rhs)) |
| 976 | x, residuals, rank, s = linalg.lstsq(a, b, rcond=None) |
| 977 | if m == 0: |
| 978 | assert_((x == 0).all()) |
| 979 | assert_equal(x.shape, (n, n_rhs)) |
| 980 | assert_equal(residuals.shape, ((n_rhs,) if m > n else (0,))) |
| 981 | if m > n and n_rhs > 0: |
| 982 | # residuals are exactly the squared norms of b's columns |
| 983 | r = b - np.dot(a, x) |
| 984 | assert_almost_equal(residuals, (r * r).sum(axis=-2)) |
| 985 | assert_equal(rank, min(m, n)) |
| 986 | assert_equal(s.shape, (min(m, n),)) |
| 987 | |
| 988 | def test_incompatible_dims(self): |
| 989 | # use modified version of docstring example |
nothing calls this directly
no test coverage detected