MatSetValuesCOO#

set values at once in a matrix preallocated using MatSetPreallocationCOO()

Synopsis#

#include "petscmat.h"  
PetscErrorCode MatSetValuesCOO(Mat A, const PetscScalar coo_v[], InsertMode imode)

Collective

Input Parameters#

  • A - matrix being preallocated

  • coo_v - the matrix values (can be NULL)

  • imode - the insert mode

Notes#

The values must follow the order of the indices prescribed with MatSetPreallocationCOO() or MatSetPreallocationCOOLocal().

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 matrix (ADD_VALUES) or overwritten (INSERT_VALUES).

MatAssemblyBegin() and MatAssemblyEnd() do not need to be called after this routine. It automatically handles the assembly process.

See Also#

Matrices, Mat, MatSetPreallocationCOO(), MatSetPreallocationCOOLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

Level#

beginner

Location#

src/mat/utils/gcreate.c

Examples#

src/mat/tutorials/ex18kok.kokkos.cxx
src/snes/tutorials/ex55k.kokkos.cxx
src/ksp/ksp/tutorials/ex83f.F90
src/mat/tutorials/ex18.c
src/ksp/ksp/tutorials/bench_kspsolve.c

Implementations#

MatSetValuesCOO_MPIAIJKokkos() in src/mat/impls/aij/mpi/kokkos/mpiaijkok.kokkos.cxx
MatSetValuesCOO_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatSetValuesCOO_MPIAIJCUSPARSE() in src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu
MatSetValuesCOO_MPIAIJHIPSPARSE() in src/mat/impls/aij/mpi/mpihipsparse/mpiaijhipsparse.hip.c
MatSetValuesCOO_SeqAIJ() in src/mat/impls/aij/seq/aij.c
MatSetValuesCOO_SeqAIJKokkos() in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatSetValuesCOO_SeqAIJCUSPARSE() in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatSetValuesCOO_SeqAIJHIPSPARSE() in src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.c
MatSetValuesCOO_HYPRE() in src/mat/impls/hypre/mhypre.c
MatSetValuesCOO_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