Skip to main content
`Ctrl`+`K`

# VecSetPreallocationCOOLocal

set preallocation for vectors using a coordinate format of the entries with local indices

## Synopsis

    #include "petscvec.h"
    PetscErrorCode VecSetPreallocationCOOLocal(Vec x, PetscCount ncoo, PetscInt coo_i[])

Collective

## Input Parameters

- x - vector being preallocated

- ncoo - number of entries

- coo_i - row indices (local numbering; may be modified)

## Notes

This and `VecSetValuesCOO()` provide an alternative API to using `VecSetValuesLocal()` to provide vector values.

This API is particularly efficient for use on GPUs.

The local indices are translated using the local to global mapping, thus `VecSetLocalToGlobalMapping()` must have been called prior to this function.

The indices coo_i 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. Negative indices and remote indices might be allowed. see `VecSetPreallocationCOO()`.

## See Also

Vectors and Parallel Data, `Vec`, `VecSetPreallocationCOO()`, `VecSetValuesCOO()`

## Level

beginner

## Location

src/vec/vec/interface/vector.c

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