Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7db19f8

Browse files
committed
STY: small fixes
1 parent d658176 commit 7db19f8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sklearn/utils/lobpcg.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111

1212
import numpy as np
1313

14-
from scipy.linalg import inv, eigh, cho_factor, cho_solve, cholesky
14+
from scipy.linalg import inv, eigh, cho_factor, cho_solve, cholesky, LinAlgError
1515
from scipy.sparse.linalg import aslinearoperator, LinearOperator
1616

1717
__all__ = ['lobpcg']
1818

1919

2020
def save(ar, fileName):
2121
# Used only when verbosity level > 10.
22-
from numpy import savetxt
23-
savetxt(fileName, ar, precision=8)
22+
np.savetxt(fileName, ar, precision=8)
2423

2524

2625
def as2d(ar):
@@ -318,7 +317,7 @@ def lobpcg(A, X,
318317
try:
319318
# gramYBY is a Cholesky factor from now on...
320319
gramYBY = cho_factor(gramYBY)
321-
except linearlyDependentConstraints:
320+
except LinAlgError:
322321
raise ValueError('cannot handle linearly dependent constraints')
323322

324323
_applyConstraints(blockVectorX, gramYBY, blockVectorBY, blockVectorY)

0 commit comments

Comments
 (0)