118
118
function _recursive_normalized_cut (W, thres, num_cuts)
119
119
m, n = size (W)
120
120
(m <= 1 ) && return ones (Int, m) # trivial
121
- D = Diagonal (vec (sum (W, dims= 2 )))
121
+ D = Diagonal (vec (sum (W; dims= 2 )))
122
122
123
123
# check that the diagonal is not degenerated as otherwise invDroot errors
124
124
dnz = abs .(diag (D)) .>= 1E-16
@@ -137,7 +137,7 @@ function _recursive_normalized_cut(W, thres, num_cuts)
137
137
# At least some versions of ARPACK have a bug, this is a workaround
138
138
invDroot = sqrt .(inv (D)) # equal to Cholesky factorization for diagonal D
139
139
if n > 12
140
- _, Q = eigs (invDroot' * (D - W) * invDroot, nev= 12 , which= SR ())
140
+ _, Q = eigs (invDroot' * (D - W) * invDroot; nev= 12 , which= SR ())
141
141
(size (Q, 2 ) <= 1 ) && return collect (1 : m) # no 2nd eigenvector
142
142
ret = convert (Vector, real (view (Q, :, 2 )))
143
143
else
@@ -149,7 +149,7 @@ function _recursive_normalized_cut(W, thres, num_cuts)
149
149
min_cost = Inf
150
150
best_thres = - 1
151
151
vmin, vmax = extrema (v)
152
- for t in range (vmin, stop= vmax, length= num_cuts)
152
+ for t in range (vmin; stop= vmax, length= num_cuts)
153
153
cut = v .> t
154
154
cost = _normalized_cut_cost (cut, W, D)
155
155
if cost < min_cost
0 commit comments