Skip to content

Commit b3e9bdb

Browse files
committed
Clean up comments
1 parent 190b69f commit b3e9bdb

File tree

2 files changed

+0
-209
lines changed

2 files changed

+0
-209
lines changed

src/classical.jl

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,6 @@ end
5959
function rs_direct_interpolation_pass1(T, A, splitting)
6060

6161
Bp = zeros(Int, size(A.colptr))
62-
#=Sp = S.colptr
63-
Sj = S.rowval
64-
n_nodes = size(A, 1)
65-
nnz = 0
66-
for i = 1:n_nodes
67-
if splitting[i] == C_NODE
68-
nnz += 1
69-
else
70-
for jj = Sp[i]:Sp[i+1]
71-
jj > length(Sj) && continue
72-
if splitting[Sj[jj]] == C_NODE && Sj[jj] != i
73-
nnz += 1
74-
end
75-
end
76-
end
77-
Bp[i+1] = nnz
78-
end=#
7962
n = size(A, 1)
8063
nnz = 0
8164
for i = 1:n
@@ -175,105 +158,7 @@ function rs_direct_interpolation_pass1(T, A, splitting)
175158
m[i] = sum
176159
sum += splitting[i]
177160
end
178-
#@show m
179-
#@show Bj
180-
#l = issymmetric(S)? Bp[n]: Bp[n] + 1
181-
#@show l
182-
#for i = 1:l
183-
#Bj[i] == 0 && continue
184-
# Bj[i] = m[Bj[i]]
185-
#end
186161
Bj .= m[Bj]
187162

188-
#=Ap = A.colptr
189-
Aj = A.rowval
190-
Ax = A.nzval
191-
Sp = S.colptr
192-
Sj = S.rowval
193-
Sx = S.nzval
194-
Bj = zeros(Ti, Bp[end])
195-
Bx = zeros(Float64, Bp[end])
196-
n_nodes = size(A, 1)
197-
198-
for i = 1:n_nodes
199-
if splitting[i] == C_NODE
200-
Bj[Bp[i]] = i
201-
Bx[Bp[i]] = 1
202-
else
203-
sum_strong_pos = 0
204-
sum_strong_neg = 0
205-
for jj = Sp[i]: Sp[i+1]
206-
jj > length(Sj) && continue
207-
if splitting[Sj[jj]] == C_NODE && Sj[jj] != i
208-
if Sx[jj] < 0
209-
sum_strong_neg += Sx[jj]
210-
else
211-
sum_strong_pos += Sx[jj]
212-
end
213-
end
214-
end
215-
216-
sum_all_pos = 0
217-
sum_all_neg = 0
218-
diag = 0
219-
for jj = Ap[i]:Ap[i+1]
220-
jj > length(Aj) && continue
221-
if Aj[jj] == i
222-
@show Ax[jj]
223-
diag += Ax[jj]
224-
else
225-
if Ax[jj] < 0
226-
sum_all_neg += Ax[jj]
227-
else
228-
sum_all_pos += Ax[jj]
229-
end
230-
end
231-
end
232-
233-
alpha = sum_all_neg / sum_strong_neg
234-
beta = sum_all_pos / sum_strong_pos
235-
@show alpha
236-
@show beta
237-
@show diag
238-
239-
if sum_strong_pos == 0
240-
diag += sum_all_pos
241-
beta = 0
242-
end
243-
244-
neg_coeff = -1 * alpha / diag
245-
pos_coeff = -1 * beta / diag
246-
247-
@show neg_coeff
248-
@show pos_coeff
249-
250-
nnz = Bp[i]
251-
for jj = Sp[i]:Sp[i+1]
252-
jj > length(Sj) && continue
253-
if splitting[Sj[jj]] == C_NODE && Sj[jj] != i
254-
Bj[nnz] = Sj[jj]
255-
if Sx[jj] < 0
256-
Bx[nnz] = neg_coeff * Sx[jj]
257-
else
258-
Bx[nnz] = pos_coeff * Sx[jj]
259-
end
260-
@show Bx[nnz]
261-
nnz += 1
262-
end
263-
end
264-
end
265-
end
266-
267-
m = zeros(Ti, n_nodes)
268-
sum = 0
269-
for i = 1:n_nodes
270-
m[i] = sum
271-
sum += splitting[i]
272-
end
273-
for i = 1:Bp[n_nodes]
274-
Bj[i] == 0 && continue
275-
Bj[i] = m[Bj[i]]
276-
end =#
277-
278163
Bx, Bj, Bp
279164
end

src/splitting.jl

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -141,97 +141,3 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
141141
end
142142
splitting
143143
end
144-
145-
146-
# Now add elements to C and F, in descending order of lambda
147-
#=for top_index = n_nodes:-1:1
148-
i = index_to_node[top_index]
149-
lambda_i = lambda[i] + 1
150-
151-
# if (n_nodes == 4)
152-
# std::cout << "selecting node #" << i << " with lambda " << lambda[i] << std::endl;
153-
154-
# remove i from its interval
155-
interval_count[lambda_i] -= 1
156-
157-
if splitting[i] == F_NODE
158-
continue
159-
else
160-
161-
@assert splitting[i] == U_NODE
162-
163-
splitting[i] = C_NODE
164-
165-
# For each j in S^T_i /\ U
166-
for jj = Tp[i]:Tp[i+1]-1
167-
#jj > length(Tp) && continue
168-
169-
j = Tj[jj]
170-
171-
if splitting[j] == U_NODE
172-
splitting[j] = F_NODE
173-
174-
# For each k in S_j /\ U
175-
for kk = Sp[j]: Sp[j+1]-1
176-
# kk > length(Sj) && continue
177-
k = Sj[kk]
178-
179-
if splitting[k] == U_NODE
180-
# move k to the end of its current interval
181-
lambda[k] >= n_nodes - 1 && continue
182-
183-
lambda_k = lambda[k] + 1
184-
old_pos = node_to_index[k]
185-
new_pos = interval_ptr[lambda_k] + interval_count[lambda_k]# - 1
186-
187-
node_to_index[index_to_node[old_pos]] = new_pos
188-
node_to_index[index_to_node[new_pos]] = old_pos
189-
(index_to_node[old_pos], index_to_node[new_pos]) = (index_to_node[new_pos], index_to_node[old_pos])
190-
191-
# update intervals
192-
interval_count[lambda_k] -= 1
193-
interval_count[lambda_k+1] += 1 # invalid write!
194-
interval_ptr[lambda_k+1] = new_pos - 1
195-
196-
# increment lambda_k
197-
lambda[k] += 1
198-
end
199-
end
200-
end
201-
end
202-
203-
# For each j in S_i /\ U
204-
for jj = Sp[i]: Sp[i+1] - 1
205-
# jj > length(Sj) && continue
206-
207-
j = Sj[jj]
208-
209-
if splitting[j] == U_NODE # decrement lambda for node j
210-
211-
lambda[j] == 0 && continue
212-
213-
# assert(lambda[j] > 0);//this would cause problems!
214-
215-
# move j to the beginning of its current interval
216-
lambda_j = lambda[j] + 1
217-
old_pos = node_to_index[j]
218-
new_pos = interval_ptr[lambda_j]
219-
220-
node_to_index[index_to_node[old_pos]] = new_pos
221-
node_to_index[index_to_node[new_pos]] = old_pos
222-
(index_to_node[old_pos],index_to_node[new_pos]) = (index_to_node[new_pos],index_to_node[old_pos])
223-
224-
# update intervals
225-
interval_count[lambda_j] -= 1
226-
interval_count[lambda_j-1] += 1
227-
interval_ptr[lambda_j] += 1
228-
interval_ptr[lambda_j-1] = interval_ptr[lambda_j] - interval_count[lambda_j-1]
229-
230-
# decrement lambda_j
231-
lambda[j] -= 1
232-
end
233-
end
234-
end
235-
end
236-
splitting
237-
end=#

0 commit comments

Comments
 (0)