---
title: SparseLSMR()
framework: accelerate
role: symbol
role_heading: Function
path: accelerate/sparselsmr()
---

# SparseLSMR()

Returns a default least squares minimum residual (LSMR) method.

## Declaration

```swift
func SparseLSMR() -> SparseIterativeMethod
```

## Return Value

Return Value A SparseIterativeMethod structure that represents a default LSMR method.

## Discussion

Discussion LSMR is a minimal residual (MINRES) method for solving least squares. Use LSMR to solve equations of the form Ax = b where an exact solution doesn’t exist. The returned solution minimizes ‖ b-Ax ‖₂. Although LSMR is equivalent to applying MINRES to the normal equations AᵀAx = Aᵀb in exact arithmetic, it has superior numerical behavior and is the preferred method. Due to the implicit squaring of the condition of A in the normal equations, LSMR may struggle to converge in single precision. Use double-precision arithmetic where possible. For symmetric positive-definite systems, use SparseConjugateGradient(_:). For square, full-rank unsymmetric or indefinite equations, use SparseGMRES(_:).

## See Also

### Sparse Iterative Methods for Overdetermined and Underdetermined Systems

- [SparseLSMR(_:)](accelerate/sparselsmr(_:).md)
- [SparseLSMROptions](accelerate/sparselsmroptions.md)
