:orphan: # VecBoundGradientProjection Projects vector according to this definition. If XL[i] < X[i] < XU[i], then GP[i] = G[i]; If X[i] <= XL[i], then GP[i] = min(G[i],0); If X[i] >= XU[i], then GP[i] = max(G[i],0); ## Synopsis ``` #include "petscvec.h" PetscErrorCode VecBoundGradientProjection(Vec G, Vec X, Vec XL, Vec XU, Vec GP) ``` ## Input Parameters - ***G -*** current gradient vector - ***X -*** current solution vector with XL[i] <= X[i] <= XU[i] - ***XL -*** lower bounds - ***XU -*** upper bounds ## Output Parameter - ***GP -*** gradient projection vector ## Note `GP` may be the same vector as `G` ## See Also `Vec` ## Level advanced ## Location src/vec/vec/utils/projection.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/utils/projection.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)