Componentwise soft thresholding, sign(z) * pmax(abs(z) - gamma, 0).
Examples
soft_threshold(c(-2, -0.5, 0.3, 1.7), 1)
#> [1] -1.0 0.0 0.0 0.7
Componentwise soft thresholding, sign(z) * pmax(abs(z) - gamma, 0).
soft_threshold(c(-2, -0.5, 0.3, 1.7), 1)
#> [1] -1.0 0.0 0.0 0.7