Skip to content

Commit 028f4a0

Browse files
authored
Misc cleanup (no functional changes). (#92)
1 parent 11a060c commit 028f4a0

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.jl.cov
22
*.jl.*.cov
33
*.jl.mem
4+
/Manifest.toml

src/classical.jl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
struct Solver{S,T,P,PS}
2-
strength::S
3-
CF::T
4-
presmoother::P
5-
postsmoother::PS
6-
max_levels::Int
7-
max_coarse::Int
8-
end
91

102
function ruge_stuben(_A::Union{TA, Symmetric{Ti, TA}, Hermitian{Ti, TA}},
113
::Type{Val{bs}}=Val{1};
@@ -17,18 +9,13 @@ function ruge_stuben(_A::Union{TA, Symmetric{Ti, TA}, Hermitian{Ti, TA}},
179
max_coarse = 10,
1810
coarse_solver = Pinv, kwargs...) where {Ti,Tv,bs,TA<:SparseMatrixCSC{Ti,Tv}}
1911

20-
s = Solver(strength, CF, presmoother,
21-
postsmoother, max_levels, max_levels)
22-
2312
if _A isa Symmetric && Ti <: Real || _A isa Hermitian
2413
A = _A.data
25-
At = A
2614
symmetric = true
2715
levels = Vector{Level{TA, Adjoint{Ti, TA}, TA}}()
2816
else
2917
symmetric = false
3018
A = _A
31-
At = adjoint(A)
3219
levels = Vector{Level{TA, Adjoint{Ti, TA}, TA}}()
3320
end
3421
w = MultiLevelWorkspace(Val{bs}, eltype(A))
@@ -54,7 +41,7 @@ function extend_heirarchy!(levels, strength, CF, A::SparseMatrixCSC{Ti,Tv}, symm
5441
splitting = CF(S)
5542
P, R = direct_interpolation(At, T, splitting)
5643
push!(levels, Level(A, P, R))
57-
A = R * A * P
44+
return R * A * P
5845
end
5946

6047
function direct_interpolation(At, T, splitting)

src/preconditioner.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ mul!(b, p::Preconditioner, x) = mul!(b, p.ml.levels[1].A, x)
2222
function \(p::Preconditioner, b)
2323
ldiv!(similar(b), p, b)
2424
end
25-
*(p::Preconditioner, b) = p.ml.levels[1].A * x

src/strength.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function (c::Classical)(At::SparseMatrixCSC{Tv,Ti}) where {Ti,Tv}
99
θ = c.θ
1010

1111
m, n = size(At)
12-
T = deepcopy(At)
12+
T = copy(At)
1313

1414
for i = 1:n
1515
_m = find_max_off_diag(T, i)
@@ -83,7 +83,7 @@ function (s::SymmetricStrength{T})(A, bsr_flag = false) where {T}
8383
A.colptr, A.rowval, ones(eltype(A), size(A.rowval)))
8484
return S, S
8585
else
86-
S = deepcopy(A)
86+
S = copy(A)
8787
end
8888
n = size(A, 1)
8989
diags = Vector{eltype(A)}(undef, n)

0 commit comments

Comments
 (0)