#[repr(i32)]pub enum DistanceMeasure {
Unspecified = 0,
Euclidean = 1,
Cosine = 2,
DotProduct = 3,
}
Expand description
The distance measure to use when comparing vectors.
Variants§
Unspecified = 0
Should not be set.
Euclidean = 1
Measures the EUCLIDEAN distance between the vectors. See [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn more
Cosine = 2
Compares vectors based on the angle between them, which allows you to measure similarity that isn’t based on the vectors magnitude. We recommend using DOT_PRODUCT with unit normalized vectors instead of COSINE distance, which is mathematically equivalent with better performance. See Cosine Similarity to learn more.
DotProduct = 3
Similar to cosine but is affected by the magnitude of the vectors. See Dot Product to learn more.
Implementations§
Trait Implementations§
source§impl Clone for DistanceMeasure
impl Clone for DistanceMeasure
source§fn clone(&self) -> DistanceMeasure
fn clone(&self) -> DistanceMeasure
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DistanceMeasure
impl Debug for DistanceMeasure
source§impl Default for DistanceMeasure
impl Default for DistanceMeasure
source§fn default() -> DistanceMeasure
fn default() -> DistanceMeasure
Returns the “default value” for a type. Read more
source§impl From<DistanceMeasure> for i32
impl From<DistanceMeasure> for i32
source§fn from(value: DistanceMeasure) -> i32
fn from(value: DistanceMeasure) -> i32
Converts to this type from the input type.
source§impl Hash for DistanceMeasure
impl Hash for DistanceMeasure
source§impl Ord for DistanceMeasure
impl Ord for DistanceMeasure
source§fn cmp(&self, other: &DistanceMeasure) -> Ordering
fn cmp(&self, other: &DistanceMeasure) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for DistanceMeasure
impl PartialEq for DistanceMeasure
source§fn eq(&self, other: &DistanceMeasure) -> bool
fn eq(&self, other: &DistanceMeasure) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DistanceMeasure
impl PartialOrd for DistanceMeasure
source§fn partial_cmp(&self, other: &DistanceMeasure) -> Option<Ordering>
fn partial_cmp(&self, other: &DistanceMeasure) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for DistanceMeasure
impl Eq for DistanceMeasure
impl StructuralPartialEq for DistanceMeasure
Auto Trait Implementations§
impl Freeze for DistanceMeasure
impl RefUnwindSafe for DistanceMeasure
impl Send for DistanceMeasure
impl Sync for DistanceMeasure
impl Unpin for DistanceMeasure
impl UnwindSafe for DistanceMeasure
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request