:orphan:
# MatSeqAIJSetTotalPreallocation
Sets an upper bound on the total number of expected nonzeros in the matrix. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatSeqAIJSetTotalPreallocation(Mat A, PetscInt nztotal)
```

## Input Parameters

- ***A -*** the `MATSEQAIJ` matrix
- ***nztotal -*** bound on the number of nonzeros





## Notes
This can be called if you will be provided the matrix row by row (from row zero) with sorted column indices for each row.
Simply call `MatSetValues()` after this call to provide the matrix entries in the usual manner. This matrix may be used
as always with multiple matrix assemblies.


## See Also
 [](ch_matrices), `Mat`, `MatSetOption()`, `MAT_SORTED_FULL`, `MatSetValues()`, `MatSeqAIJSetPreallocation()`

## Level
advanced

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/aij/seq/aij.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)  
