# KSPSetDiagonalScale

Tells KSP to symmetrically diagonally scale the system before solving. This actually CHANGES the matrix (and right hand side).

### Synopsis

    #include "petscksp.h"
    PetscErrorCode PETSCKSP_DLLEXPORT KSPSetDiagonalScale(KSP ksp,PetscTruth scale)

Collective on KSP

### Input Parameter

| ksp | - the KSP context
| scale | - PETSC_TRUE or PETSC_FALSE

### Options Database Key

| -ksp_diagonal_scale | -
| -ksp_diagonal_scale_fix | - scale the matrix back AFTER the solve

BE CAREFUL with this routine: it actually scales the matrix and right hand side that define the system. After the system is solved the matrix and right hand side remain scaled.

This routine is only used if the matrix and preconditioner matrix are the same thing.

This should NOT be used within the SNES solves if you are using a line search.

If you use this with the PCType Eisenstat preconditioner than you can use the PCEisenstatNoDiagonalScaling() option, or -pc_eisenstat_no_diagonal_scaling to save some unneeded, redundant flops.

### Keywords

KSP, set, options, prefix, database

### See Also

KSPGetDiagonalScale(), KSPSetDiagonalScaleFix()

Level:intermediate
Location: src/ksp/ksp/interface/itfunc.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages