Contents

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

Perform a single iteration of the specified iterative method for complex double values.

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)

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_Double(). 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.

    accumulate

    (input) Indicates whether to perform Y += op(A)X (if true) or Y = op(A)X (if false).

    trans

    (input) Indicates whether op(A) is the application of A (trans=CblasNoTrans) or A^T (trans=CblasTrans).

    X

    The matrix to multiply.

    Y

    The 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 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.

    For CG and GMRES

    R(0,j) holds an estimate of || b-Ax ||_2 for the j-th rhs.

    For LSMR - R(0,j)

    R(0,j) holds an estimate of || A^T(b-Ax) ||_2 for the j-th rhs.

    For LSMR - R(1,j)

    R(1,j) holds an estimate of || b-Ax ||_2 for the j-th rhs.

    For LSMR - R(2,j)

    R(2,j) holds an estimate of || A ||_F, the Frobenius norm of A, estimated using calculations related to the j-th rhs.

    For LSMR - R(3,j)

    R(3,j) holds an estimate of cond(A), the condition number of A, estimated using calculations related to the j-th rhs.

    Other entries of R may be used by the routine as a workspace. On return from a call with iteration<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.

See Also

Sparse Iterate Functions with Preconditioner