petsc-3.12.4 2020-02-04
Report Typos and Errors

# MatDiagonalScale

Scales a matrix on the left and right by diagonal matrices that are stored as vectors. Either of the two scaling matrices can be NULL.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatDiagonalScale(Mat mat,Vec l,Vec r)

Collective on Mat

### Input Parameters

| mat | - the matrix to be scaled
| l | - the left scaling vector (or NULL)
| r | - the right scaling vector (or NULL)

### Notes

MatDiagonalScale() computes A = LAR, where L = a diagonal matrix (stored as a vector), R = a diagonal matrix (stored as a vector) The L scales the rows of the matrix, the R scales the columns of the matrix.

### See Also

MatScale(), MatShift(), MatDiagonalSet()

### Level

intermediate

### Location

src/mat/interface/matrix.c

### Examples

src/snes/examples/tutorials/ex70.c.html
src/ts/examples/tutorials/ex50.c.html
src/tao/unconstrained/examples/tutorials/spectraladjointassimilation.c.html
src/tao/pde_constrained/examples/tutorials/elliptic.c.html
src/tao/pde_constrained/examples/tutorials/parabolic.c.html
src/tao/pde_constrained/examples/tutorials/hyperbolic.c.html

### Implementations

MatDiagonalScale_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatDiagonalScale_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatDiagonalScale_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatDiagonalScale_SeqBAIJ in src/mat/impls/baij/seq/baij2.c
MatDiagonalScale_SeqBAIJMKL in src/mat/impls/baij/seq/baijmkl/baijmkl.c
MatDiagonalScale_Composite in src/mat/impls/composite/mcomposite.c
MatDiagonalScale_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatDiagonalScale_SeqDense in src/mat/impls/dense/seq/dense.c
MatDiagonalScale_Elemental in src/mat/impls/elemental/matelem.cxx
MatDiagonalScale_IS in src/mat/impls/is/matis.c
MatDiagonalScale_Nest in src/mat/impls/nest/matnest.c
MatDiagonalScale_Normal in src/mat/impls/normal/normm.c
MatDiagonalScale_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c
MatDiagonalScale_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij2.c
MatDiagonalScale_MPISELL in src/mat/impls/sell/mpi/mpisell.c
MatDiagonalScale_SeqSELL in src/mat/impls/sell/seq/sell.c
MatDiagonalScale_Shell in src/mat/impls/shell/shell.c
MatDiagonalScale_SubMatrix in src/mat/impls/submat/submat.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages