<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/SparseLSMR(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@SparseLSMR#$@SA@SparseLSMROptions#"
  },
  "title" : "SparseLSMR(_:)"
}
-->

# SparseLSMR(_:)

Returns a least squares minimum residual method with specified options.

```
func SparseLSMR(_ options: SparseLSMROptions) -> SparseIterativeMethod
```

## Parameters

`options`

The LSMR options to use when creating the LSMR method.

## Return Value

A [`SparseIterativeMethod`](/documentation/Accelerate/SparseIterativeMethod) structure that represents a default LSMR method.

## 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(_:)`](/documentation/Accelerate/SparseConjugateGradient(_:)). For square, full-rank unsymmetric or indefinite equations, use [`SparseGMRES(_:)`](/documentation/Accelerate/SparseGMRES(_:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)