Skip to content

Commit 4c887d7

Browse files
wdevazelhesperimosocordiae
authored andcommitted
Deals with scipy's new version, where eigsh can call eigh. (#94)
1 parent c79875c commit 4c887d7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

metric_learn/lfda.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ def _sum_outer(x):
139139
def _eigh(a, b, dim):
140140
try:
141141
return scipy.sparse.linalg.eigsh(a, k=dim, M=b, which='LA')
142-
except (ValueError, scipy.sparse.linalg.ArpackNoConvergence):
143-
pass
144-
try:
145-
return scipy.linalg.eigh(a, b)
146142
except np.linalg.LinAlgError:
147-
pass
143+
pass # scipy already tried eigh for us
144+
except (ValueError, scipy.sparse.linalg.ArpackNoConvergence):
145+
try:
146+
return scipy.linalg.eigh(a, b)
147+
except np.linalg.LinAlgError:
148+
pass
148149
return scipy.linalg.eig(a, b)

0 commit comments

Comments
 (0)