---
title: "SparseIterate(_:_:_:_:_:_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/sparseiterate(_:_:_:_:_:_:_:_:_:)-4td1l"
---

# SparseIterate(_:_:_:_:_:_:_:_:_:)

Perform a single iteration of the specified iterative method for complex float values with preconditioner.

## Declaration

```swift
func SparseIterate(_ method: SparseIterativeMethod, _ iteration: Int32, _ converged: UnsafePointer<Bool>, _ state: UnsafeMutableRawPointer, _ ApplyOperator: @escaping (Bool, CBLAS_TRANSPOSE, DenseMatrix_Complex_Float, DenseMatrix_Complex_Float) -> Void, _ B: DenseMatrix_Complex_Float, _ R: DenseMatrix_Complex_Float, _ X: DenseMatrix_Complex_Float, _ Preconditioner: SparseOpaquePreconditioner_Complex_Float)
```

## Parameters

- `method`: (Input) Iterative method specification, eg return value of SparseConjugateGradient(). Note that the options related to convergence testing (e.g. `maxIterations`, `atol`, `rtol`) are ignored as convergence tests must be performed by the user.
- `iteration`: (Input) The current iteration number, starting from 0. If iteration<0, then the current iterate is finalised, and the value of X is updated (note that this may force some methods to restart, slowing convergence).
- `converged`: (Input) Convergence status of each solution vector. converged[j]=true indicates that the vector stored as column j of X has converged, and it should be ignored in this iteration.
- `state`: (Input/Output) A pointer to a state-space of size returned by SparseGetStateSize_Complex_Float(). This memory must be 16-byte aligned (any allocation returned by malloc() has this property). It must not be altered by the user between iterations, but may be safely discarded after the final call to SparseIterate().
- `ApplyOperator`: ApplyOperator(accumulate, trans, X, Y) should perform the operation Y = op(A)X if accumulate is false, or Y += op(A)X if accumulate is true.
- `B`: (Input) The right-hand sides to solve for.
- `R`: (Output) Residual estimate. On entry with iteration=0, it must hold the residuals b-Ax (equal to B if X=0). On return from each call with iteration>=0, the first entry(s) of each vector contain various estimates of norms to be used in convergence testing.
- `X`: (Input/Output) The current estimate of the solution vectors X. On entry with iteration=0, this should be an initial estimate for the solution. If no good estimate is available, use X = 0.0. Depending on the method used, X may not be updated at each iteration, or may be used to store some other vector. The user should make a call with iteration<0 once convergence has been achieved to bring X up to date.
- `Preconditioner`: (Input) Preconditioner to apply.

## See Also

### Sparse Iterate Functions with Preconditioner

- [SparseIterate(_:_:_:_:_:_:_:_:_:)](accelerate/sparseiterate(_:_:_:_:_:_:_:_:_:)-99ji7.md)
- [SparseIterate(_:_:_:_:_:_:_:_:_:)](accelerate/sparseiterate(_:_:_:_:_:_:_:_:_:)-1anay.md)
- [SparseIterate(_:_:_:_:_:_:_:_:)](accelerate/sparseiterate(_:_:_:_:_:_:_:_:)-315ym.md)
- [SparseIterate(_:_:_:_:_:_:_:_:)](accelerate/sparseiterate(_:_:_:_:_:_:_:_:)-9v7qh.md)
- [SparseIterate(_:_:_:_:_:_:_:_:_:)](accelerate/sparseiterate(_:_:_:_:_:_:_:_:_:)-1wv28.md)
