Skip to content

Commit c5d3638

Browse files
committed
Reduce memory by using some broadcasting
1 parent 2834910 commit c5d3638

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/classical.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ end
4040
function direct_interpolation(A, T, splitting)
4141

4242
fill!(T.nzval, 1.)
43-
T = A .* T
43+
T .= A .* T
4444
Pp = rs_direct_interpolation_pass1(T, A, splitting)
4545
Pp .= Pp .+ 1
4646

src/splitting.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ end
2323

2424
function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
2525

26-
m,n = size(S)
26+
n = size(S,1)
2727

28-
n_nodes = n
2928
lambda = zeros(Int, n)
3029

3130
Tp = T.colptr
@@ -70,7 +69,7 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
7069
end
7170
end
7271

73-
for top_index = n_nodes:-1:1
72+
for top_index = n:-1:1
7473
i = index_to_node[top_index]
7574
lambda_i = lambda[i] + 1
7675
interval_count[lambda_i] -= 1
@@ -88,7 +87,7 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
8887
rowk = T.rowval[k]
8988

9089
if splitting[rowk] == U_NODE
91-
lambda[rowk] >= n_nodes - 1 && continue
90+
lambda[rowk] >= n - 1 && continue
9291
lambda_k = lambda[rowk] + 1
9392
old_pos = node_to_index[rowk]
9493
new_pos = interval_ptr[lambda_k] + interval_count[lambda_k]# - 1

0 commit comments

Comments
 (0)