Skip to content

Commit 78c4a87

Browse files
committed
Type stability
1 parent 3a914bf commit 78c4a87

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/classical.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct Solver{S,T,P,PS}
77
max_coarse::Int64
88
end
99

10-
function ruge_stuben(A::SparseMatrixCSC;
10+
function ruge_stuben{Ti,Tv}(A::SparseMatrixCSC{Ti,Tv};
1111
strength = Classical(0.25),
1212
CF = RS(),
1313
presmoother = GaussSeidel(),
@@ -18,7 +18,7 @@ function ruge_stuben(A::SparseMatrixCSC;
1818
s = Solver(strength, CF, presmoother,
1919
postsmoother, max_levels, max_levels)
2020

21-
levels = Vector{Level}()
21+
levels = Vector{Level{Ti,Tv}}()
2222

2323
while length(levels) < max_levels
2424
A = extend_heirarchy!(levels, strength, CF, A)
@@ -29,7 +29,7 @@ function ruge_stuben(A::SparseMatrixCSC;
2929
MultiLevel(levels, A, presmoother, postsmoother)
3030
end
3131

32-
function extend_heirarchy!(levels::Vector{Level}, strength, CF, A)
32+
function extend_heirarchy!{Ti,Tv}(levels::Vector{Level{Ti,Tv}}, strength, CF, A::SparseMatrixCSC{Ti,Tv})
3333
S, T = strength_of_connection(strength, A)
3434
splitting = split_nodes(CF, S)
3535
P, R = direct_interpolation(A, T, splitting)

src/multilevel.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ struct Level{Ti,Tv}
44
R::SparseMatrixCSC{Ti,Tv}
55
end
66

7-
struct MultiLevel{L, S, Pre, Post, Ti, Tv}
8-
levels::Vector{L}
7+
struct MultiLevel{S, Pre, Post, Ti, Tv}
8+
levels::Vector{Level{Ti,Tv}}
99
final_A::SparseMatrixCSC{Ti,Tv}
1010
coarse_solver::S
1111
presmoother::Pre
@@ -16,7 +16,7 @@ abstract type CoarseSolver end
1616
struct Pinv <: CoarseSolver
1717
end
1818

19-
MultiLevel(l::Vector{Level}, A, presmoother, postsmoother; coarse_solver = Pinv()) =
19+
MultiLevel{Ti,Tv}(l::Vector{Level{Ti,Tv}}, A::SparseMatrixCSC{Ti,Tv}, presmoother, postsmoother; coarse_solver = Pinv()) =
2020
MultiLevel(l, A, coarse_solver, presmoother, postsmoother)
2121
Base.length(ml) = length(ml.levels) + 1
2222

0 commit comments

Comments
 (0)