mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-31 12:41:20 +08:00
used standard eignen solver
This commit is contained in:
@@ -138,10 +138,17 @@ def _ncut_relabel(rag, thresh, num_cuts):
|
||||
"""
|
||||
d, w = _ncut.DW_matrix(rag)
|
||||
error = False
|
||||
|
||||
|
||||
try:
|
||||
m = w.shape[0]
|
||||
vals, vectors = linalg.eigsh(d - w, M=d, which='SM',
|
||||
d2 = d.copy()
|
||||
# Since d is diagonal, we can directly operate on it's data
|
||||
# the inverse
|
||||
d2.data = 1.0/d2.data
|
||||
# the square root
|
||||
d2.data = np.sqrt(d2.data)
|
||||
vals, vectors = linalg.eigsh(d2*(d - w)*d2, which='SM',
|
||||
k=min(100, m - 2))
|
||||
except ArpackNoConvergence as e:
|
||||
# Not all eigenvectors converged, salvage the remaining.
|
||||
|
||||
Reference in New Issue
Block a user