R/symdecomp.R

Defines functions symdecomp

Documented in symdecomp

## decomposes an asymmetric proximity matrix into a symmetric and a skew-symmetric part (P = M + N)

symdecomp <- function(P) {
  ## P ... input proximity matrix
  P <- as.matrix(P)
  if (ncol(P) != nrow(P)) stop("Input matrix needs to be square!")
  M <- (P + t(P))/2
  N <- (P - t(P))/2
  return(list(M = M, N = N))
}

Try the smacof package in your browser

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

smacof documentation built on May 6, 2022, 9:05 a.m.