:orphan: # VecSetValuesCOO set values at once in a vector preallocated using `VecSetPreallocationCOO()` ## Synopsis ``` #include "petscvec.h" PetscErrorCode VecSetValuesCOO(Vec x, const PetscScalar coo_v[], InsertMode imode) ``` Collective ## Input Parameters - ***x -*** vector being set - ***coo_v -*** the value array - ***imode -*** the insert mode ## Note This and `VecSetPreallocationCOO() or ``VecSetPreallocationCOOLocal()` provide an alernative API to using `VecSetValues()` to provide vector values. This API is particularly efficient for use on GPUs. The values must follow the order of the indices prescribed with `VecSetPreallocationCOO()` or `VecSetPreallocationCOOLocal()`. When repeated entries are specified in the COO indices the `coo_v` values are first properly summed, regardless of the value of `imode`. The imode flag indicates if `coo_v` must be added to the current values of the vector (`ADD_VALUES`) or overwritten (`INSERT_VALUES`). `VecAssemblyBegin()` and `VecAssemblyEnd()` do not need to be called after this routine. It automatically handles the assembly process. ## See Also [](ch_vectors), `Vec`, `VecSetPreallocationCOO()`, `VecSetPreallocationCOOLocal()`, `VecSetValues()` ## Level beginner ## Location src/vec/vec/interface/vector.c ## Implementations VecSetValuesCOO_MPIKokkos in src/vec/vec/impls/mpi/kokkos/mpikok.kokkos.cxx
VecSetValuesCOO_MPI in src/vec/vec/impls/mpi/pdvec.c
VecSetValuesCOO_Seq in src/vec/vec/impls/seq/bvec2.c
VecSetValuesCOO_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
--- [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](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)