Skip to content

Commit 190b69f

Browse files
committed
Clean up
1 parent 7b7e5d9 commit 190b69f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/classical.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ end
3131

3232
function extend_heirarchy!(levels::Vector{Level}, strength, CF, A)
3333
S, T = strength_of_connection(strength, A)
34-
splitting = split_nodes(CF, S, T)
34+
splitting = split_nodes(CF, S)
3535
P, R = direct_interpolation(A, T, splitting)
3636
push!(levels, Level(A, P, R))
3737
A = R * A * P

src/splitting.jl

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,24 @@ const U_NODE = 2
44

55
struct RS
66
end
7-
split_nodes(x, S) = split_nodes(x, S, S')
8-
split_nodes(::RS, S::SparseMatrixCSC, T::SparseMatrixCSC) = RS_CF_splitting(S - spdiagm(diag(S)), T - spdiagm(diag(T)))
7+
#=function split_nodes(::RS, S)
8+
n = size(S, 1)
9+
for i = 1:n
10+
for j in nzrange(S, i)
11+
row = S.rowval[j]
12+
if row == i
13+
S.nzval[j] = 0
14+
end
15+
end
16+
end
17+
i, j, v = findnz(S)
18+
RS_CF_splitting(sparse(i,j,v,n,n), sparse(j,i,v,n,n))
19+
end=#
20+
function split_nodes(::RS, S)
21+
T = S'
22+
RS_CF_splitting(S - spdiagm(diag(S)), T - spdiagm(diag(T)))
23+
end
24+
925
function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
1026

1127
m,n = size(S)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ S, T = AMG.strength_of_connection(AMG.Classical(0.25), a)
3939
0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0,
4040
1, 0]
4141

42-
@test split_nodes(RS(), ref_S, ref_S') == Int.(vec(ref_split))
42+
@test split_nodes(RS(), ref_S) == Int.(vec(ref_split))
4343

4444
end
4545

0 commit comments

Comments
 (0)