Revision 31f51733b8b246a6c7acc26db29cad177b2f9a21 authored by Jan de Leeuw on 27 July 2008, 00:00:00 UTC, committed by Gabor Csardi on 27 July 2008, 00:00:00 UTC
1 parent ebdb7bf
Raw File
vecAsDist.R
#needed for nonmetric sphere primal

vecAsDist <- function(x)
{
  n <- (1+sqrt(1+8*length(x)))/2
  e <- matrix(0,n,n); k<-0
  for (i in 1:(n-1)) {
    l <- n-i
    ll <- 1:l
	  e[i+ll,i] <- x[k+ll]
   k<-k+l
	}
return(as.dist(e))
}
back to top