Function

SparseConjugateGradient(_:)

Returns a conjugate gradient method with specified options.

Declaration

func SparseConjugateGradient(_ options: SparseCGOptions) -> SparseIterativeMethod

Parameters

options

The options to use when creating the conjugate gradient method, for example the maximum number of iterations to perform.

Return Value

A SparseIterativeMethod structure representing a default conjugate gradient method.

Discussion

Use CG to solve Ax = b when A is symmetric positive-definite. (The method may break down or fail to converge if A is not positive-definite.)

For square, full-rank, unsymmetric or indefinite equations, use SparseGMRES(_:) instead. For rectangular or singular systems, use SparseLSMR(_:).

See Also

Sparse Iterative Methods

struct SparseCGOptions

Options for creating a conjugate gradient method.

func SparseGMRES() -> SparseIterativeMethod

Returns a generalized minimal residual method.

func SparseGMRES(SparseGMRESOptions) -> SparseIterativeMethod

Returns a generalized minimal residual method with specified options.

struct SparseGMRESOptions

Options for creating a generalized minimal residual method.

func SparseLSMR() -> SparseIterativeMethod

Returns a default least squares minimum residual method.

func SparseLSMR(SparseLSMROptions) -> SparseIterativeMethod

Returns a least squares minimum residual method with specified options.

struct SparseLSMROptions

Options for creating a least squares minimum residual method.