R/prox.R

Defines functions prox

Documented in prox

prox <-
function(B, threshold, group) {
    B. = B
    for (g in 1:max(group)) {
        SVD = svd(B[group == g, ])
        D = (SVD$d - threshold)*(SVD$d - threshold > 0)
        B.[group == g, ] = SVD$u %*% (D * t(SVD$v))
    }
    B.
}

Try the npmr package in your browser

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

npmr documentation built on Nov. 12, 2023, 1:08 a.m.