Skip to main content
`Ctrl`+`K`

# 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

Matrices, `Mat`, `MatSetValuesCOO()`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatSeqBAIJSetPreallocation()`, `MatMPIBAIJSetPreallocation()`, `MatSeqSBAIJSetPreallocation()`, `MatMPISBAIJSetPreallocation()`, `MatSetPreallocationCOO()`, `DMSetMatrixPreallocateSkip()`

## Level

beginner

## Location

src/mat/utils/gcreate.c

## Implementations

MatSetPreallocationCOOLocal_IS() in src/mat/impls/is/matis.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages