R/nuclear_pen.R

Defines functions nuclear_pen

Documented in nuclear_pen

#' function to compute the value of low-rank penalty term, i.e. nuclear norm.
#' @param x x is the input m by n matrix
#' @param lambda tuning parameter for nuclear norm penalty
#' @return a float number that represents the value of penalty.
#' @details This function is to compute the low rank penalty via nuclear norm
#' @examples
#' x <- matrix(stats::rnorm(20), 5, 4)
#' lambda <- 0.75
#' nuclear_pen(x, lambda)
#' @export


nuclear_pen <- function(x, lambda){
    d <- svd(x)$d
    return(lambda * sum(d))
}
kevinbai92/LSvarEstimate documentation built on May 8, 2020, 1:04 a.m.