R/update_unitary.R

Defines functions volnmf_procrustes

Documented in volnmf_procrustes

#' Procrustes algorithm estimates orthonormal transformation between two matrices.
#'
#' \code{volnmf_procrustes} finds orthonormal matrix \code{Q} that minimizes objective
#' \code{||A-B*Q||^2}
#'
#' @param A Numeric Matrices. Orthonormal transformation convert matrix \code{B} in matrix \code{A}.
#' @param B Numeric Matrices. Orthonormal transformation convert matrix \code{B} in matrix \code{A}.
#' @return An optimal orthonormal tranformation matrix \code{Q}.
#' @export
volnmf_procrustes <- function(A, B){
  sv <- svd(t(A) %*% B)
  return(sv$v %*% t(sv$u))
}

Try the vrnmf package in your browser

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

vrnmf documentation built on March 18, 2022, 6:11 p.m.