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

MatSetSizes

Sets the local and global sizes, and checks to determine compatibility

Synopsis

#include "petscmat.h"  
PetscErrorCode  MatSetSizes(Mat A, PetscInt m, PetscInt n, PetscInt M, PetscInt N)
Collective on Mat Many br

Input Parameters

A - the matrix Many br
m - number of local rows (or PETSC_DECIDE) Many br
n - number of local columns (or PETSC_DECIDE) Many br
M - number of global rows (or PETSC_DETERMINE) Many br
N - number of global columns (or PETSC_DETERMINE) Many br

Notes

m (n) and M (N) cannot be both PETSC_DECIDE Many brIf one processor calls this with M (N) of PETSC_DECIDE then all processors must, otherwise the program will hang. Many br

If PETSC_DECIDE is not used for the arguments 'm' and 'n', then the Many bruser must ensure that they are chosen to be compatible with the Many brvectors. To do this, one first considers the matrix-vector product Many br'y = A x'. The 'm' that is used in the above routine must match the Many brlocal size used in the vector creation routine VecCreateMPI() for 'y'. Many brLikewise, the 'n' used must match that used as the local size in Many brVecCreateMPI() for 'x'. Many br

You cannot change the sizes once they have been set. Many br

The sizes must be set before MatSetUp() or MatXXXSetPreallocation() is called. Many br

Many br

See Also

MatGetSize(), PetscSplitOwnership()

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

Examples

src/mat/examples/tutorials/ex2.c.html
src/mat/examples/tutorials/ex5.c.html
src/mat/examples/tutorials/ex8.c.html
src/mat/examples/tutorials/ex15.c.html
src/mat/examples/tutorials/ex16.c.html
src/mat/examples/tutorials/ex17.c.html
src/ksp/ksp/examples/tutorials/ex1.c.html
src/ksp/ksp/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex3.c.html
src/ksp/ksp/examples/tutorials/ex5.c.html
src/ksp/ksp/examples/tutorials/ex6.c.html