Distance#

This page provides C++ class references for the publicly-exposed elements of the raft/distance package. RAFT’s distances have been highly optimized and support a wide assortment of different distance measures.

Distance Types#

#include <raft/distance/distance_types.hpp>

namespace raft::distance

enum raft::distance::DistanceType#

enum to tell how to compute distance

Values:

enumerator L2Expanded#

evaluate as dist_ij = sum(x_ik^2) + sum(y_ij)^2 - 2*sum(x_ik * y_jk)

enumerator L2SqrtExpanded#

same as above, but inside the epilogue, perform square root operation

enumerator CosineExpanded#

cosine distance

enumerator L1#

L1 distance

enumerator L2Unexpanded#

evaluate as dist_ij += (x_ik - y-jk)^2

enumerator L2SqrtUnexpanded#

same as above, but inside the epilogue, perform square root operation

enumerator InnerProduct#

basic inner product

enumerator Linf#

Chebyshev (Linf) distance

enumerator Canberra#

Canberra distance

enumerator LpUnexpanded#

Generalized Minkowski distance

enumerator CorrelationExpanded#

Correlation distance

enumerator JaccardExpanded#

Jaccard distance

enumerator HellingerExpanded#

Hellinger distance

enumerator Haversine#

Haversine distance

enumerator BrayCurtis#

Bray-Curtis distance

enumerator JensenShannon#

Jensen-Shannon distance

enumerator HammingUnexpanded#

Hamming distance

enumerator KLDivergence#

KLDivergence

enumerator RusselRaoExpanded#

RusselRao

enumerator DiceExpanded#

Dice-Sorensen distance

enumerator Precomputed#

Precomputed (special value)