:orphan:
# PCSOR
(S)SOR (successive over relaxation, Gauss-Seidel) preconditioning 
## Options Database Keys

- ***-pc_sor_symmetric -*** Activates symmetric version
- ***-pc_sor_backward -*** Activates backward version
- ***-pc_sor_forward -*** Activates forward version
- ***-pc_sor_local_forward -*** Activates local forward version
- ***-pc_sor_local_symmetric -*** Activates local symmetric version  (default version)
- ***-pc_sor_local_backward -*** Activates local backward version
- ***-pc_sor_omega <omega> -*** Sets omega
- ***-pc_sor_diagonal_shift <shift> -*** shift the diagonal entries; useful if the matrix has zeros on the diagonal
- ***-pc_sor_its <its> -*** Sets number of iterations   (default 1)
- ***-pc_sor_lits <lits> -*** Sets number of local iterations  (default 1)





## Notes
Only implemented for the `MATAIJ`  and `MATSEQBAIJ` matrix formats.

Not a true parallel SOR, in parallel this implementation corresponds to block
Jacobi with SOR on each block.

For `MATAIJ` matrices if a diagonal entry is zero (and the diagonal shift is zero) then by default the inverse of that
zero will be used and hence the `KSPSolve()` will terminate with `KSP_DIVERGED_NANORINF`. If the option
`KSPSetErrorIfNotConverged()` or -ksp_error_if_not_converged the code will terminate as soon as it detects the
zero pivot.

For `MATSEQBAIJ` matrices this implements point-block SOR, but the omega, its, lits options are not supported.

For `MATSEQBAIJ` the diagonal blocks are inverted using dense LU with partial pivoting. If a zero pivot is detected
the computation is stopped with an error

If used with `KSPRICHARDSON` and no monitors the convergence test is skipped to improve speed, thus it always iterates
the maximum number of iterations you've selected for `KSP`. It is usually used in this mode as a smoother for multigrid.

If omega != 1, you will need to set the `MAT_USE_INODES` option to `PETSC_FALSE` on the matrix.


## See Also
 `PCCreate()`, `PCSetType()`, `PCType`, `PC`, `PCJACOBI`,
`PCSORSetIterations()`, `PCSORSetSymmetric()`, `PCSORSetOmega()`, `PCEISENSTAT`, `MatSetOption()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/sor/sor.c.html#PCSOR">src/ksp/pc/impls/sor/sor.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/sor/sor.c)


[Index of all PC routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
