R/S_func.R

#'The soft thresholding operator
#'
#'Function to solve the soft thresholding problem
#'@param x The data value
#'@param a The lambda value
#'@return The solution to the soft thresholding operator.
#'
S_func <- function(x, a) {  # Soft Thresholding Operator
  return((abs(x) - a) * sign(x) * (abs(x) > a))
}

Try the SparseDC package in your browser

Any scripts or data that you put into this service are public.

SparseDC documentation built on May 2, 2019, 9:29 a.m.