R/GrassDist.R

Defines functions GrassDist

GrassDist <- function(V1,V2){
  p1 <- nrow(V1)
  r1 <- ncol(V1)
  p2 <- nrow(V2)
  r2 <- ncol(V2)
  if(p1 != p2){
    stop("Input must be matched")
  }
  V1 <- svd(V1)$u
  V2 <- svd(V2)$u
  loss <- norm(acos(svd(crossprod(V1,V2))$d),type = "2")
  return(loss)
}

Try the SuperPCA package in your browser

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

SuperPCA documentation built on July 26, 2021, 5:06 p.m.