:orphan:
# SNESVIComputeMeritFunction
Evaluates the merit function for the mixed complementarity problem. 
## Synopsis
```
#include "petscsnes.h" 
PetscErrorCode SNESVIComputeMeritFunction(Vec phi, PetscReal *merit, PetscReal *phinorm)
```

## Input Parameter

- ***phi -*** the `Vec` holding the evaluation of the semismooth function



## Output Parameters

- ***merit -*** the merit function 1/2 ||phi||^2
- ***phinorm -*** the two-norm of the vector, ||phi||





## See Also
 `SNESVINEWTONSSLS`, `SNESVIComputeFunction()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/vi/ss/viss.c.html#SNESVIComputeMeritFunction">src/snes/impls/vi/ss/viss.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/impls/vi/ss/viss.c)


[Index of all SNES routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
