R/tools.R

# A collection of convenience functions mainly to augment the magrittr-package

#' Inverse of matrix using singular value decomposition
#'
#' @param M Matrix
#' @param tol not used right now...
#'
#' @export
#'
svdinv <- function(M, tol = .Machine$double.eps*1e2) {
  mysvd <- svd(M)
  return( mysvd$v %*% diag(1/mysvd$d) %*% t(mysvd$u))
}
dlill/MRAr documentation built on May 16, 2019, 7:24 a.m.