:orphan:
# MatCreateSeqDense
Creates a `MATSEQDENSE` that is stored in column major order (the usual Fortran manner). Many of the matrix operations use the BLAS and LAPACK routines. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateSeqDense(MPI_Comm comm, PetscInt m, PetscInt n, PetscScalar *data, Mat *A)
```
Collective


## Input Parameters

- ***comm -*** MPI communicator, set to `PETSC_COMM_SELF`
- ***m -*** number of rows
- ***n -*** number of columns
- ***data -*** optional location of matrix data in column major order.  Use `NULL` for PETSc
to control all matrix memory allocation.



## Output Parameter

- ***A -*** the matrix





## Note
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`.


## See Also
 [](ch_matrices), `Mat`, `MATSEQDENSE`, `MatCreate()`, `MatCreateDense()`, `MatSetValues()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/dense.c.html#MatCreateSeqDense">src/mat/impls/dense/seq/dense.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex68.c.html">src/ksp/ksp/tutorials/ex68.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex74.c.html">src/ksp/ksp/tutorials/ex74.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/leastsquares/tutorials/chwirut1.c.html">src/tao/leastsquares/tutorials/chwirut1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/leastsquares/tutorials/cs1.c.html">src/tao/leastsquares/tutorials/cs1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex43.c.html">src/ts/tutorials/ex43.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/extchem.c.html">src/ts/tutorials/extchem.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/dense/seq/dense.c)


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