R/pdist.R

#' Squared p-distances
#'
#' @param x numeric matrix
#' @param p p>0 the Minkoswki distance
#' @return squared Minkowski distance matrix
pdist <- function (x,p) {
    s <- tcrossprod (x)
    v <- diag (s)
    return (outer (v, v, "+") - 2 * s)
}

Try the smacofx package in your browser

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

smacofx documentation built on Sept. 22, 2024, 5:07 p.m.