MCPcopy Create free account
hub / github.com/cosdata/cosdata / max

Method max

src/models/types.rs:451–460  ·  view source on GitHub ↗
(metric: DistanceMetric)

Source from the content-addressed store, hash-verified

449 }
450
451 pub fn max(metric: DistanceMetric) -> Self {
452 match metric {
453 DistanceMetric::Cosine => Self::CosineSimilarity(CosineSimilarity(2.0)), // take care of precision issues
454 DistanceMetric::Euclidean => Self::EuclideanDistance(EuclideanDistance(f32::INFINITY)),
455 DistanceMetric::Hamming => Self::HammingDistance(HammingDistance(f32::INFINITY)),
456 DistanceMetric::DotProduct => {
457 Self::DotProductDistance(DotProductDistance(f32::INFINITY))
458 }
459 }
460 }
461}
462
463#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize)]

Callers 9

insert_vectorMethod · 0.80
mainFunction · 0.80
make_indexFunction · 0.80
ann_searchFunction · 0.80
quantizeMethod · 0.80
write_with_cursorMethod · 0.80
from_versionedMethod · 0.80
indexing_statusMethod · 0.80
index_explicit_txnMethod · 0.80

Calls 4

CosineSimilarityClass · 0.85
EuclideanDistanceClass · 0.85
HammingDistanceClass · 0.85
DotProductDistanceClass · 0.85

Tested by

no test coverage detected