Skip to content

Commit 926b343

Browse files
committed
Optimize removing diag
1 parent c5d3638 commit 926b343

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/splitting.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,21 @@ end
1616
end
1717
RS_CF_splitting(sparse(i,j,v,n,n), sparse(j,i,v,n,n))
1818
end=#
19+
20+
function remove_diag!(a)
21+
n = size(a, 1)
22+
for i = 1:n
23+
for j in nzrange(a, i)
24+
if a.rowval[j] == i
25+
a.nzval[j] = 0
26+
end
27+
end
28+
end
29+
dropzeros!(a)
30+
end
31+
1932
function split_nodes(::RS, S)
20-
S = S - spdiagm(diag(S))
33+
remove_diag!(S)
2134
RS_CF_splitting(S, S')
2235
end
2336

0 commit comments

Comments
 (0)