Does the distance matric come from a metric
is_distance_matrix(mat, tolerance = .Machine$double.eps^0.5) triangle_inequality(mat, tolerance = .Machine$double.eps^0.5)
mat | The matrix to evaluate |
---|---|
tolerance | Differences smaller than tolerance are not reported. |
#> [1] TRUEtriangle_inequality(dm)#> [1] TRUEdm[1, 2] <- 1.1 * dm[1, 2] is_distance_matrix(dm)#> Matrix is not symmetric.#> [1] FALSE