petsc-3.10.5 2019-03-28
Report Typos and Errors

# MatCreateDense

Creates a parallel matrix in dense format.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatCreateDense(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscScalar *data,Mat *A)

Collective on MPI_Comm

### Input Parameters

| comm | - MPI communicator
| m | - number of local rows (or PETSC_DECIDE to have calculated if M is given)
| n | - number of local columns (or PETSC_DECIDE to have calculated if N is given)
| M | - number of global rows (or PETSC_DECIDE to have calculated if m is given)
| N | - number of global columns (or PETSC_DECIDE to have calculated if n is given)
| data | - optional location of matrix data. Set data=NULL (PETSC_NULL_SCALAR for Fortran users) for PETSc to control all matrix memory allocation.

### Output Parameter

A -the matrix

### Notes

The dense format is fully compatible with standard Fortran 77 storage by columns.

The data input variable is intended primarily for Fortran programmers who wish to allocate their own matrix memory space. Most users should set data=NULL (PETSC_NULL_SCALAR for Fortran users).

The user MUST specify either the local or global matrix dimensions (possibly both).

### Keywords

matrix,dense, parallel

### See Also

MatCreate(), MatCreateSeqDense(), MatSetValues()

### Level

intermediate

### Location

src/mat/impls/dense/mpi/mpidense.c

### Examples

src/tao/pde_constrained/examples/tutorials/elliptic.c.html
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages