Skip to content

Commit c2a6698

Browse files
haampieandreasnoack
authored andcommitted
Jacobi, Gauss-Seidel & SOR iteration for SparseMatrixCSC using iterators (#156)
* Jacobi, Gauss-Seidel & SOR iteration for SparseMatrixCSC using iterators * Added SSOR for symmetric matrices * wip * Wrap up sparse stationary methods * Use column-wise approach for dense solvers as well
1 parent b2ac278 commit c2a6698

File tree

6 files changed

+782
-244
lines changed

6 files changed

+782
-244
lines changed

benchmark/benchmark-linear-systems.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,19 @@ function minres(n = 100_000)
8484
@benchmark IterativeSolvers.minres($A, $b, maxiter = 100)
8585
end
8686

87+
function sparse_stationary(n = 10_000)
88+
A = sprand(n, n, 5 / n)
89+
A += A' + 4.0I
90+
x = ones(n)
91+
b = A * x
92+
ω = 1.1
93+
94+
b1 = @benchmark $sor!(sol, $A, $b, $ω, maxiter = 20) setup = (sol = zeros($n))
95+
b2 = @benchmark $ssor!(sol, $A, $b, $ω, maxiter = 20) setup = (sol = zeros($n))
96+
b3 = @benchmark $jacobi!(sol, $A, $b, maxiter = 20) setup = (sol = zeros($n))
97+
b4 = @benchmark $gauss_seidel!(sol, $A, $b, maxiter = 20) setup = (sol = zeros($n))
98+
99+
b1, b2, b3, b4
100+
end
101+
87102
end

src/IterativeSolvers.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ include("factorization.jl")
1616
include("hessenberg.jl")
1717

1818
#Linear solvers
19+
include("stationary_sparse.jl")
1920
include("stationary.jl")
2021
include("cg.jl")
2122
include("minres.jl")

0 commit comments

Comments
 (0)