VecMin — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# VecMin

Determines the vector component with minimum real part and its location.

## Synopsis

    #include "petscvec.h"
    PetscErrorCode VecMin(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 location) in the vector

- val - the minimum component

## Notes

Returns the value `PETSC_MAX_REAL` and negative `p` if the vector is of length 0.

This returns the smallest index with the minimum value

## Developer Note

The Nag Fortran compiler does not like the symbol name VecMin

## See Also

Vectors and Parallel Data, `Vec`, `VecMax()`

## Level

intermediate

## Location

src/vec/vec/interface/rvector.c

## Examples

src/ts/tutorials/ex10.c
src/ts/tutorials/ex17.c
src/ksp/ksp/tutorials/ex72.c
src/ts/tutorials/ex27.c
src/ts/tutorials/ex9.c
src/ts/tutorials/ex29.c
src/vec/vec/tutorials/ex1.c
src/dm/tutorials/ex15.c

## Implementations

VecMin_MPIKokkos() in src/vec/vec/impls/mpi/kokkos/mpikok.kokkos.cxx
VecMin_MPI() in src/vec/vec/impls/mpi/pvec2.c
VecMin_Nest() in src/vec/vec/impls/nest/vecnest.c
VecMin_Seq() in src/vec/vec/impls/seq/dvec2.c
VecMin_SeqKokkos() in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx

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