VecStrideMin#
Computes the minimum of subvector of a vector defined by a starting point and a stride and optionally its location.
Synopsis#
#include "petscvec.h"
PetscErrorCode VecStrideMin(Vec v, PetscInt start, PetscInt *idex, PetscReal *nrm)
Collective
Input Parameters#
v - the vector
start - starting point of the subvector (defined by a stride)
Output Parameters#
idex - the global index in
vwhere the minimum occurred (passNULLif not required)nrm - the minimum value in the subvector
Notes#
One must call VecSetBlockSize() before this routine to set the stride
information, or use a vector created from a multicomponent DMDA.
If va is the array representing the vector v, then this computes the minimum
of the array (va[start], va[start+stride], va[start+2*stride], ....).
This is useful for computing, say the minimum of the pressure variable when the pressure is stored (interlaced) with other variables, e.g., density, etc. This will only work if the desire subvector is a stride subvector.
The real parts of the selected entries are compared. Positive and negative IEEE infinities participate in the comparison normally.
If any selected real part is NaN, including a negative NaN, nrm is NaN and idex is the
smallest global index in v whose selected real part is NaN. If all selected real parts are
NaN, this is the first selected global index.
Otherwise, idex is the smallest global index attaining the minimum, and nrm is that
entry’s real part. Equal positive and negative zeros are ties, so the returned zero has
the sign of the entry at that index. Passing NULL for idex does not change nrm.
Empty MPI processes do not affect the result. For a globally empty subvector, the result
is an nrm of PETSC_MAX_REAL and an idex of -1.
See Also#
Vec, VecMin(), VecStrideNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMax()
Level#
advanced
Location#
Examples#
src/vec/vec/tests/ex45.c
src/ksp/ksp/tutorials/ex70.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages