---
title: "SparseGMRES(_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/sparsegmres(_:)"
---

# SparseGMRES(_:)

Returns a generalized minimal residual (GMRES) method with specified options.

## Declaration

```swift
func SparseGMRES(_ options: SparseGMRESOptions) -> SparseIterativeMethod
```

## Parameters

- `options`: The options to use when creating the GMRES method, such as the maximum number of iterations to perform.

## Return Value

Return Value A SparseIterativeMethod structure that represents a generalized minimal residual (GMRES) method.

## Discussion

Discussion Use GMRES to solve Ax = b when A is symmetric indefinite or unsymmetric. For symmetric positive-definite systems, use SparseConjugateGradient(_:). For rectangular or singular systems, use SparseLSMR(_:).

## See Also

### Sparse Iterative Methods for Symmetric Indefinite and Unsymmetric Coefficient Matrices

- [SparseGMRES()](accelerate/sparsegmres().md)
- [SparseGMRESOptions](accelerate/sparsegmresoptions.md)
