:orphan:
# MatSetPreallocationCOOLocal
set preallocation for matrices using a coordinate format of the entries with local indices 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatSetPreallocationCOOLocal(Mat A, PetscCount ncoo, PetscInt coo_i[], PetscInt coo_j[])
```
Collective


## Input Parameters

- ***A -*** matrix being preallocated
- ***ncoo -*** number of entries
- ***coo_i -*** row indices (local numbering; may be modified)
- ***coo_j -*** column indices (local numbering; may be modified)





## Notes
The local indices are translated using the local to global mapping, thus `MatSetLocalToGlobalMapping()` must have been
called prior to this function. For matrices created with `DMCreateMatrix()` the local to global mapping is often already provided.

The indices `coo_i` and `coo_j` may be modified within this function. They might be translated to corresponding global
indices, but the caller should not rely on them having any specific value after this function returns. The arrays
can be freed or reused immediately after this function returns.

Entries can be repeated, see `MatSetValuesCOO()`. Entries with negative row or column indices are allowed
but will be ignored. The corresponding entries in `MatSetValuesCOO()` will be ignored too. Remote entries
are allowed and will be properly added or inserted to the matrix.


## See Also
 [](ch_matrices), `Mat`, `MatSetValuesCOO()`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatSeqBAIJSetPreallocation()`,
`MatMPIBAIJSetPreallocation()`, `MatSeqSBAIJSetPreallocation()`, `MatMPISBAIJSetPreallocation()`, `MatSetPreallocationCOO()`,
`DMSetMatrixPreallocateSkip()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/utils/gcreate.c.html#MatSetPreallocationCOOLocal">src/mat/utils/gcreate.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/is/matis.c.html#MatSetPreallocationCOOLocal_IS">MatSetPreallocationCOOLocal_IS in src/mat/impls/is/matis.c</A><BR>


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