Linear Solvers - SLES: Examples

The Scalable Linear Equations Solvers (SLES) component provides an easy-to-use interface to the combination of a Krylov subspace iterative method and a preconditioner (in the KSP and PC components, respectively) or a sequential direct solver. SLES users can set various Krylov and preconditioning options at runtime via the options database (e.g., -pc_type jacobi -ksp_type gmres ). SLES users can also set KSP and PC options directly in application codes by first extracting the KSP and/or PC context from the SLES context via SLESGetKSP()/ SLESGetPC() and then directly calling the KSP and PC routines (e.g., KSPSetType()/ PCSetType() ). Both KSP and PC components can be used directly to create and destroy solvers; this is not needed for users but is intended for library developers.

ex1.c: Solves a tridiagonal linear system with SLES
ex2.c: Solves a linear system in parallel with SLES
ex3.c: Solves a linear system in parallel with SLES
ex4.c: Uses a different preconditioner matrix and linear system matrix in the SLES solvers
ex5.c: Solves two linear systems in parallel with SLES
ex7.c: Block Jacobi preconditioner for solving a linear system in parallel with SLES
ex8.c: Illustrates use of the preconditioner ASM
ex9.c: The solution of 2 different linear systems with different linear solvers
ex10.c: Reads a PETSc matrix and vector from a file and solves a linear system
ex11.c: Solves a linear system in parallel with SLES
ex12.c: Solves a linear system in parallel with SLES
ex13.c: Solves a variable Poisson problem with SLES
ex15.c: Solves a linear system in parallel with SLES
ex16.c: Solves a sequence of linear systems with different right-hand-side vectors
ex22.c: Solves 3D Laplacian using multigrid
ex23.c: Solves a tridiagonal linear system
ex25.c: Solves 1D variable coefficient Laplacian using multigrid
ex26.c: Solves a linear system in parallel with ESI
ex27.c: Reads a PETSc matrix and vector from a file and solves the normal equations
makefile