R/residualMatrix.R

Defines functions residualMatrix

residualMatrix <- function(s,data,cutoff) {
    if (cutoff > 1) {
        x <- s$u[,1:cutoff] %*%
            diag(s$d)[1:cutoff,1:cutoff] %*%
            t(s$v[,1:cutoff])
    } else if (cutoff == 1) {
        x <- s$d[1] * s$u[,1] %*%
            t(s$v[,1])
    }
    data-x
}
bhattacharya-a-bt/DeCompress documentation built on March 28, 2021, 3:52 a.m.