|
19 | 19 | from .array_helpers import assert_exactly_equal, ndindex, asarray
|
20 | 20 | from .hypothesis_helpers import (xps, dtypes, shapes, kwargs, matrix_shapes,
|
21 | 21 | square_matrix_shapes, symmetric_matrices,
|
22 |
| - positive_definite_matrices, MAX_ARRAY_SIZE) |
| 22 | + positive_definite_matrices, MAX_ARRAY_SIZE, |
| 23 | + invertible_matrices) |
23 | 24 |
|
24 | 25 | from . import _array_module
|
25 | 26 |
|
@@ -169,12 +170,16 @@ def test_eigvalsh(x):
|
169 | 170 |
|
170 | 171 | # TODO: Test that res actually corresponds to the eigenvalues of x
|
171 | 172 |
|
172 |
| -@given( |
173 |
| - x=xps.arrays(dtype=xps.floating_dtypes(), shape=shapes), |
174 |
| -) |
| 173 | +@given(x=invertible_matrices()) |
175 | 174 | def test_inv(x):
|
176 |
| - # res = _array_module.linalg.inv(x) |
177 |
| - pass |
| 175 | + res = _array_module.linalg.inv(x) |
| 176 | + |
| 177 | + assert res.shape == x.shape, "inv() did not return the correct shape" |
| 178 | + assert res.dtype == x.dtype, "inv() did not return the correct dtype" |
| 179 | + |
| 180 | + _test_stacks(_array_module.linalg.inv, x, {}, res) |
| 181 | + |
| 182 | + # TODO: Test that the result is actually the inverse |
178 | 183 |
|
179 | 184 | @given(
|
180 | 185 | x1=xps.arrays(dtype=xps.floating_dtypes(), shape=shapes),
|
|
0 commit comments