# PCDiagonalScaleRight
Scales a vector by the right scaling as needed by certain time-stepping codes. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode PCDiagonalScaleRight(PC pc, Vec in, Vec out)
```
Logically Collective


## Input Parameters

- ***pc -*** the preconditioner context
- ***in -*** input vector
- ***out -*** scaled vector (maybe the same as in)





## Notes
The system solved via the Krylov method is
```none
        D M A D^{-1} y = D M b  for left preconditioning or
        D A M D^{-1} z = D b for right preconditioning
```


`PCDiagonalScaleLeft()` scales a vector by D. `PCDiagonalScaleRight()` scales a vector by D^{-1}.

If diagonal scaling is turned off and in is not out then in is copied to out


## See Also
 `PCCreate()`, `PCSetUp()`, `PCDiagonalScaleLeft()`, `PCDiagonalScaleSet()`, `PCDiagonalScale()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/interface/precon.c.html#PCDiagonalScaleRight">src/ksp/pc/interface/precon.c</A>


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


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