# TaoSoftThreshold
Calculates soft thresholding routine with input vector and given lower and upper bound and returns it to output vector. 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoSoftThreshold(Vec in, PetscReal lb, PetscReal ub, Vec out)
```

## Input Parameters

- ***in -*** input vector to be thresholded
- ***lb -*** lower bound
- ***ub -*** upper bound



## Output Parameter

- ***out -*** Soft thresholded output vector



## Notes
Soft thresholding is defined as
\[ S(input,lb,ub) =
\begin{cases}
input - ub  \text{input > ub} \\
0           \text{lb =< input <= ub} \\
input + lb  \text{input < lb} \\
\]




## See Also
 `Tao`, `Vec`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/util/tao_util.c.html#TaoSoftThreshold">src/tao/util/tao_util.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/tutorials/tomographyADMM.c.html">src/tao/constrained/tutorials/tomographyADMM.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/tutorials/ex4.c.html">src/tao/tutorials/ex4.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/util/tao_util.c)


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