GNU Scientific Library – Reference Manual: Iterating the Sparse Linear System

Previous: Sparse Iterative Solvers Types, Up: Sparse Iterative Solvers [Index]

#### 43.2.3 Iterating the Sparse Linear System

The following functions are provided to allocate storage for the sparse linear solvers and iterate the system to a solution.

Function: gsl_splinalg_itersolve * gsl_splinalg_itersolve_alloc (const gsl_splinalg_itersolve_type * T, const size_t n, const size_t m)

  This function allocates a workspace for the iterative solution of n-by-n sparse matrix systems. The iterative solver type is specified by T. The argument m specifies the size of the solution candidate subspace {\cal K}_m. The dimension m may be set to 0 in which case a reasonable default value is used.

Function: void gsl_splinalg_itersolve_free (gsl_splinalg_itersolve * w)

  This function frees the memory associated with the workspace w.

Function: const char * gsl_splinalg_itersolve_name (const gsl_splinalg_itersolve * w)

  This function returns a string pointer to the name of the solver.

Function: int gsl_splinalg_itersolve_iterate (const gsl_spmatrix *A, const gsl_vector *b, const double tol, gsl_vector *x, gsl_splinalg_itersolve *w)

  This function performs one iteration of the iterative method for the sparse linear system specfied by the matrix A, right hand side vector b and solution vector x. On input, x must be set to an initial guess for the solution. On output, x is updated to give the current solution estimate. The parameter tol specifies the relative tolerance between the residual norm and norm of b in order to check for convergence. When the following condition is satisfied:

      || A x - b || <= tol * || b ||

  the method has converged, the function returns `GSL_SUCCESS` and the final solution is provided in x. Otherwise, the function returns `GSL_CONTINUE` to signal that more iterations are required. Here, || \cdot || represents the Euclidean norm. The input matrix A may be in triplet or compressed column format.

Function: double gsl_splinalg_itersolve_normr (const gsl_splinalg_itersolve *w)

  This function returns the current residual norm ||r|| = ||A x - b||, which is updated after each call to `gsl_splinalg_itersolve_iterate`.

Previous: Sparse Iterative Solvers Types, Up: Sparse Iterative Solvers [Index]