petsc-3.7.1 2016-05-15
Report Typos and Errors

# MatShift

Computes Y = Y + a I, where a is a PetscScalar and I is the identity matrix.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatShift(Mat Y,PetscScalar a)

Neighbor-wise Collective on Mat Many br

### Input Parameters

| Y | - the matrices Many br
| a | - the PetscScalar Many br

Many br

Notes: If the matrix Y is missing some diagonal entries this routine can be very slow. To make it fast one should initially Many brfill the matrix so that all diagonal entries have a value (with a value of zero for those locations that would not have an Many brentry). Many br

Developers Note: If the local "diagonal part" of the matrix Y has no entries then the local diagonal part is Many brpreallocated with 1 nonzero per row for the to be added values. This allows for fast shifting of an empty matrix. Many br

### Keywords

matrix, add, shift

### See Also

MatDiagonalSet()

Level:intermediate
Location:src/mat/utils/axpy.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/mat/examples/tutorials/ex9.c.html
src/tao/pde_constrained/examples/tutorials/parabolic.c.html
src/tao/pde_constrained/examples/tutorials/hyperbolic.c.html