:orphan: # VecMax Determines the vector component with maximum real part and its location. ## Synopsis ``` #include "petscvec.h" PetscErrorCode VecMax(Vec x, PetscInt *p, PetscReal *val) ``` Collective ## Input Parameter - ***x -*** the vector ## Output Parameters - ***p -*** the index of `val` (pass `NULL` if you don't want this) in the vector - ***val -*** the maximum component ## Notes Returns the value `PETSC_MIN_REAL` and negative `p` if the vector is of length 0. Returns the smallest index with the maximum value ## See Also [](ch_vectors), `Vec`, `VecNorm()`, `VecMin()` ## Level intermediate ## Location src/vec/vec/interface/rvector.c ## Examples src/dm/tutorials/ex15.c
src/ksp/ksp/tutorials/ex72.c
src/ts/tutorials/ex17.c
src/ts/tutorials/ex9.c
src/vec/vec/tutorials/ex1.c
## Implementations VecMax_MPIKokkos in src/vec/vec/impls/mpi/kokkos/mpikok.kokkos.cxx
VecMax_MPI in src/vec/vec/impls/mpi/pvec2.c
VecMax_Nest in src/vec/vec/impls/nest/vecnest.c
VecMax_Seq in src/vec/vec/impls/seq/dvec2.c
VecMax_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/rvector.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)