# VecMax

Determines the maximum vector component and its location.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode  VecMax(Vec x,PetscInt *p,PetscReal *val)

Collective on Vec

### Input Parameter

x -the vector

### Output Parameters

| val | - the maximum component
| p | - the location of val

### C++ variants

| VecMax(Vec x,PetscReal *r) |  | -> |  | VecMax(x,PETSC_NULL,r)

### Notes

Returns the value PETSC_MIN and p = -1 if the vector is of length 0.

### See Also

VecNorm(), VecMin()

Level:intermediate
Location: src/vec/vec/interface/rvector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex26.c.html