SparseIterate(_:_:_:_:_:_:_:_:_:)
Perform a single iteration of the specified iterative method for complex double values with preconditioner.
Declaration
func SparseIterate(_ method: SparseIterativeMethod, _ iteration: Int32, _ converged: UnsafePointer<Bool>, _ state: UnsafeMutableRawPointer, _ ApplyOperator: @escaping (Bool, CBLAS_TRANSPOSE, DenseMatrix_Complex_Double, DenseMatrix_Complex_Double) -> Void, _ B: DenseMatrix_Complex_Double, _ R: DenseMatrix_Complex_Double, _ X: DenseMatrix_Complex_Double, _ Preconditioner: SparseOpaquePreconditioner_Complex_Double)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 ofXis updated (note that this may force some methods to restart, slowing convergence). - converged:
(Input) Convergence status of each solution vector.
converged[j]=trueindicates that the vector stored as columnjofXhas converged, and it should be ignored in this iteration. - state:
(Input/Output) A pointer to a state-space of size returned by
SparseGetStateSize_Complex_Double(). This memory must be 16-byte aligned (any allocation returned bymalloc()has this property). It must not be altered by the user between iterations, but may be safely discarded after the final call toSparseIterate(). - ApplyOperator:
ApplyOperator(accumulate, trans, X, Y)should perform the operationY = op(A)Xifaccumulateisfalse, orY += op(A)Xifaccumulateistrue.accumulate(input) Indicates whether to perform
Y += op(A)X(if true) orY = op(A)X(if false).trans(input) Indicates whether
op(A)is the application ofA(trans=CblasNoTrans) orA^T(trans=CblasTrans).XThe matrix to multiply.
YThe matrix in which to accumulate or store the result.
- B:
(Input) The right-hand sides to solve for.
- R:
(Output) Residual estimate. On entry with
iteration=0, it must hold the residualsb-Ax(equal toBifX=0). On return from each call withiteration>=0, the first entry(s) of each vector contain various estimates of norms to be used in convergence testing.- For CG and GMRES
R(0,j)holds an estimate of|| b-Ax ||_2for the j-th rhs.- For LSMR -
R(0,j) R(0,j)holds an estimate of|| A^T(b-Ax) ||_2for the j-th rhs.- For LSMR -
R(1,j) R(1,j)holds an estimate of|| b-Ax ||_2for the j-th rhs.- For LSMR -
R(2,j) R(2,j)holds an estimate of|| A ||_F, the Frobenius norm ofA, estimated using calculations related to the j-th rhs.- For LSMR -
R(3,j) R(3,j)holds an estimate ofcond(A), the condition number ofA, estimated using calculations related to the j-th rhs.Other entries of
Rmay be used by the routine as a workspace. On return from a call withiteration<0, the exact residual vector b-Ax is returned.
- 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.