# 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.

CSC versus CSR

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!(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.

source
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.

source

## Gauss-Seidel

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.

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

Performs exactly maxiter Gauss-Seidel iterations.

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

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

source

## Successive over-relaxation (SOR)

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.

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

source
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.

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

source

## Symmetric successive over-relaxation (SSOR)

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.

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

source
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.

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

source
Tip

All stationary methods can be used a iterators.