Utilities for working with distance matrices.
is.dmatrix is a utility that checks whether the argument is a distance or dissimilarity matrix; is it square symmetric, non-negative, with zero diagonal? calc_dist computes a distance matrix directly from a data matrix.
Usage
is.dmatrix(x, tol = 100 * .Machine$double.eps)
calc_dist(x)
Value
is.dmatrix returns TRUE if (within tolerance) x is a distance/dissimilarity matrix; otherwise FALSE. It will return FALSE if x is a class dist object.
calc_dist returns the Euclidean distance matrix for the data matrix x, which has observations in rows.
Energy functions work with the distance matrices of samples. The is.dmatrix function is used internally when converting arguments to distance matrices. The default tol is the same as default tolerance of isSymmetric.
calc_dist is an exported Rcpp function that returns a Euclidean distance matrix from the input data matrix.
References
Szekely, G.J. and Rizzo, M.L. (2014),
Partial Distance Correlation with Methods for Dissimilarities.
Annals of Statistics, Vol. 42 No. 6, 2382-2412.