:orphan:
# MatCreateSeqAIJHIPSPARSE
Creates a sparse matrix in `MATAIJHIPSPARSE` (compressed row) format. This matrix will ultimately pushed down to AMD GPUs and use the HIPSPARSE library for calculations. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateSeqAIJHIPSPARSE(MPI_Comm comm, PetscInt m, PetscInt n, PetscInt nz, const PetscInt nnz[], Mat *A)
```
Collective


## Input Parameters

- ***comm -*** MPI communicator, set to `PETSC_COMM_SELF`
- ***m -*** number of rows
- ***n -*** number of columns
- ***nz -*** number of nonzeros per row (same for all rows), ignored if `nnz` is set
- ***nnz -*** array containing the number of nonzeros in the various rows (possibly different for each row) or `NULL`



## Output Parameter

- ***A -*** the matrix





## Notes
It is recommended that one use the `MatCreate()`, `MatSetType()` and/or `MatSetFromOptions()`,
`MatXXXXSetPreallocation()` paradgm instead of this routine directly.
[MatXXXXSetPreallocation() is, for example, `MatSeqAIJSetPreallocation`]

The AIJ format (compressed row storage), is fully compatible with standard Fortran
storage.  That is, the stored row and column indices can begin at
either one (as in Fortran) or zero.

Specify the preallocated storage with either `nz` or `nnz` (not both).
Set `nz` = `PETSC_DEFAULT` and `nnz` = `NULL` for PETSc to control dynamic memory
allocation.


## See Also
 [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateAIJ()`, `MatSetValues()`, `MatSeqAIJSetColumnIndices()`, `MatCreateSeqAIJWithArrays()`, `MatCreateAIJ()`, `MATSEQAIJHIPSPARSE`, `MATAIJHIPSPARSE`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp#MatCreateSeqAIJHIPSPARSE">src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp)


[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)  
