# VecSetPreallocationCOO
set preallocation for a vector using a coordinate format of the entries with global indices 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecSetPreallocationCOO(Vec x, PetscCount ncoo, const PetscInt coo_i[])
```
Collective on Vec


## Input Parameters

- ***x -*** vector being preallocated
- ***ncoo -*** number of entries
- ***coo_i -*** entry indices





## Notes
Entries can be repeated, see VecSetValuesCOO(). Negative indices are not allowed unless vector option VEC_IGNORE_NEGATIVE_INDICES is set,
in which case they, along with the corresponding entries in VecSetValuesCOO(), are ignored. If vector option VEC_NO_OFF_PROC_ENTRIES is set,
remote entries are ignored, otherwise, they will be properly added or inserted to the vector.

The array coo_i[] may be freed immediately after calling this function.


## See Also
 VecSetValuesCOO(), VecSetPreallocationCOOLocal()

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/vector.c.html#VecSetPreallocationCOO">src/vec/vec/interface/vector.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/mpi/kokkos/mpikok.kokkos.cxx.html#VecSetPreallocationCOO_MPIKokkos">VecSetPreallocationCOO_MPIKokkos in src/vec/vec/impls/mpi/kokkos/mpikok.kokkos.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/mpi/mpicuda/mpicuda.cu.html#VecSetPreallocationCOO_MPICUDA">VecSetPreallocationCOO_MPICUDA in src/vec/vec/impls/mpi/mpicuda/mpicuda.cu</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/mpi/pdvec.c.html#VecSetPreallocationCOO_MPI">VecSetPreallocationCOO_MPI in src/vec/vec/impls/mpi/pdvec.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/seq/bvec2.c.html#VecSetPreallocationCOO_Seq">VecSetPreallocationCOO_Seq in src/vec/vec/impls/seq/bvec2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx.html#VecSetPreallocationCOO_SeqKokkos">VecSetPreallocationCOO_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/seq/seqcuda/veccuda2.cu.html#VecSetPreallocationCOO_SeqCUDA">VecSetPreallocationCOO_SeqCUDA in src/vec/vec/impls/seq/seqcuda/veccuda2.cu</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/vector.c)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
