This function performs the so-called `soft threshholding` on the input
vector(invec
) based on the given threshholding value(thresh
)
RSAVS_Softthresh(invec, thresh)
outvec
. For each input entry invec[i]
, the output value
outvec[i]
is
outvec[i] = invec[i] - thresh
: if invec[i] > thresh
outvec[i] = invec[i] + thresh
: if invec[i] < -thresh
outvec[i] = 0
: if otherwise
RSAVS:::RSAVS_Softthresh(seq(-2, 2, by = 0.1), thresh = 1)
#> [1] -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.0 0.0 0.0 0.0
#> [16] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
#> [31] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0