R/dista.R

Defines functions total.dista dista

Documented in dista total.dista

#[export]
dista <- function(xnew, x, type = "euclidean", k = 0, index = FALSE, trans = TRUE, square = FALSE, p = 0, result = "matrix", parallel = FALSE) {
    if (type == "canberra1" || type == "canberra2") {
        .Deprecated("The replacement type is \"canberra\"", "Rfast")
    }
    if(type != "haversine"){
        xnew <- t(xnew)
        x <- t(x)
    }
    if(result == "matrix"){
		x <- .Call(Rfast_dista, xnew, x, type, square, p, k, index, parallel)
        if (trans) x <- t(x)
        x
	}else if(result == "sum"){
  		.Call(Rfast_total_dista, xnew, x, type, square, p, k, parallel)
	}
}

#[export]
total.dista <- function(xnew, x, type = "euclidean", k = 0, square = FALSE, p = 0, parallel = FALSE) {
    .Deprecated("Use dista(x, result = \"sum\")", "Rfast")
    if(type != "haversine"){
        xnew <- t(xnew)
        x <- t(x)
    }
    .Call(Rfast_total_dista, xnew, x, type, square, p, k, parallel)
}

Try the Rfast package in your browser

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

Rfast documentation built on April 3, 2025, 11:34 p.m.