# Stationary methods

Stationary methods are typically used as smoothers in multigrid methods, where only very few iterations are applied to get rid of high-frequency components in the error. The implementations of stationary methods have this goal in mind, which means there is no other stopping criterion besides the maximum number of iterations.

Julia stores matrices column-major. In order to avoid cache misses, the implementations of our stationary methods traverse the matrices column-major. This deviates from classical textbook implementations. Also the SOR and SSOR methods cannot be computed efficiently in-place, but require a temporary vector.

When it comes to `SparseMatrixCSC`

, we precompute in all stationary methods an integer array of the indices of the diagonal to avoid expensive searches in each iteration.

## Jacobi

`IterativeSolvers.jacobi`

— Function.`jacobi(A, b) -> x`

Same as `jacobi!`

, but allocates a solution vector `x`

initialized with zeros.

`IterativeSolvers.jacobi!`

— Function.`jacobi!(x, A::AbstractMatrix, b; maxiter=10) -> x`

Performs exactly `maxiter`

Jacobi iterations.

Allocates a single temporary vector and traverses `A`

columnwise.

Throws `LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

`jacobi!(x, A::SparseMatrixCSC, b; maxiter=10) -> x`

Performs exactly `maxiter`

Jacobi iterations.

Allocates a temporary vector and precomputes the diagonal indices.

Throws `LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

## Gauss-Seidel

`IterativeSolvers.gauss_seidel`

— Function.`gauss_seidel(A, b) -> x`

Same as `gauss_seidel!`

, but allocates a solution vector `x`

initialized with zeros.

`IterativeSolvers.gauss_seidel!`

— Function.`gauss_seidel!(x, A::AbstractMatrix, b; maxiter=10) -> x`

Performs exactly `maxiter`

Gauss-Seidel iterations.

Works fully in-place and traverses `A`

columnwise.

Throws `LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

`gauss_seidel!(x, A::SparseMatrixCSC, b; maxiter=10) -> x`

Performs exactly `maxiter`

Gauss-Seidel iterations.

Works fully in-place, but precomputes the diagonal indices.

`LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

## Successive over-relaxation (SOR)

`IterativeSolvers.sor`

— Function.`sor(A, b, ω::Real) -> x`

Same as `sor!`

, but allocates a solution vector `x`

initialized with zeros.

`IterativeSolvers.sor!`

— Function.`sor!(x, A::AbstractMatrix, b, ω::Real; maxiter=10) -> x`

Performs exactly `maxiter`

SOR iterations with relaxation parameter `ω`

.

Allocates a single temporary vector and traverses `A`

columnwise.

`LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

`sor!(x, A::SparseMatrixCSC, b, ω::Real; maxiter=10)`

Performs exactly `maxiter`

SOR iterations with relaxation parameter `ω`

.

Allocates a temporary vector and precomputes the diagonal indices.

`LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

## Symmetric successive over-relaxation (SSOR)

`IterativeSolvers.ssor`

— Function.`ssor(A, b, ω::Real) -> x`

Same as `ssor!`

, but allocates a solution vector `x`

initialized with zeros.

`IterativeSolvers.ssor!`

— Function.`ssor!(x, A::AbstractMatrix, b, ω::Real; maxiter=10) -> x`

Performs exactly `maxiter`

SSOR iterations with relaxation parameter `ω`

. Each iteration is basically a forward *and* backward sweep of SOR.

Allocates a single temporary vector and traverses `A`

columnwise.

`LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

`ssor!(x, A::SparseMatrixCSC, b, ω::Real; maxiter=10)`

Performs exactly `maxiter`

SSOR iterations with relaxation parameter `ω`

. Each iteration is basically a forward *and* backward sweep of SOR.

Allocates a temporary vector and precomputes the diagonal indices.

`LinearAlgebra.SingularException`

when the diagonal has a zero. This check is performed once beforehand.

All stationary methods can be used a iterators.