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.
#'@export
#'
S_func <- function(x, a) {  # Soft Thresholding Operator
  return((abs(x) - a) * sign(x) * (abs(x) > a))
}

Try the SparseMDC package in your browser

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

SparseMDC documentation built on May 2, 2019, 4:01 a.m.