Skip to content

Commit

Permalink
fix doctests, numpy.linalg.linalg.LinAlgError -> numpy.linalg.LinAlgE…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
boeddeker committed Apr 17, 2022
1 parent 7d50b04 commit db303ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nara_wpe/wpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def _stable_solve(A, B):
>>> C1 = np.linalg.solve(A, B)
Traceback (most recent call last):
...
numpy.linalg.linalg.LinAlgError: Singular matrix
numpy.linalg.LinAlgError: Singular matrix
>>> C2, *_ = np.linalg.lstsq(A, B)
>>> C3 = _stable_solve(A, B)
>>> C4 = _lstsq(A, B)
Expand All @@ -338,7 +338,7 @@ def _stable_solve(A, B):
>>> C2, *_ = np.linalg.lstsq(A, B)
Traceback (most recent call last):
...
numpy.linalg.linalg.LinAlgError: 3-dimensional array given. Array must be two-dimensional
numpy.linalg.LinAlgError: 3-dimensional array given. Array must be two-dimensional
>>> C3 = _stable_solve(A, B)
>>> C4 = _lstsq(A, B)
>>> np.testing.assert_allclose(C1, C3)
Expand All @@ -349,11 +349,11 @@ def _stable_solve(A, B):
>>> C1 = np.linalg.solve(A, B)
Traceback (most recent call last):
...
numpy.linalg.linalg.LinAlgError: Singular matrix
numpy.linalg.LinAlgError: Singular matrix
>>> C2, *_ = np.linalg.lstsq(A, B)
Traceback (most recent call last):
...
numpy.linalg.linalg.LinAlgError: 3-dimensional array given. Array must be two-dimensional
numpy.linalg.LinAlgError: 3-dimensional array given. Array must be two-dimensional
>>> C3 = _stable_solve(A, B)
>>> C4 = _lstsq(A, B)
>>> np.testing.assert_allclose(C3, C4)
Expand All @@ -377,7 +377,7 @@ def _stable_solve(A, B):
# lstsq is much slower, use it only when necessary
try:
C[i] = np.linalg.solve(A[i], B[i])
except np.linalg.linalg.LinAlgError:
except np.linalg.LinAlgError:
C[i] = np.linalg.lstsq(A[i], B[i])[0]
return C.reshape(*shape_B)

Expand Down

0 comments on commit db303ea

Please sign in to comment.