DefaultCompare

Struct DefaultCompare 

Source
pub struct DefaultCompare;

Trait Implementations§

Source§

impl Compare<f32> for DefaultCompare

Source§

fn dot(vec: impl Iterator<Item = f32>, other: impl Iterator<Item = f32>) -> f64

dot積 d(a, b) = Σ(a_i * b_i)
Source§

fn cosine_similarity( vec: impl Iterator<Item = (usize, f32)>, other: impl Iterator<Item = (usize, f32)>, ) -> f64

コサイン類似度 cos(θ) = Σ(a_i * b_i) / (||a|| * ||b||) ||a|| = sqrt(Σ(a_i^2))
Source§

fn chebyshev_distance( vec: impl Iterator<Item = f32>, other: impl Iterator<Item = f32>, ) -> f64

チェビシェフ距離 d(a, b) = max(|a_i - b_i|)
Source§

fn euclidean_distance( vec: impl Iterator<Item = f32>, other: impl Iterator<Item = f32>, ) -> f64

ユークリッド距離 d(a, b) = sqrt(Σ((a_i - b_i)^2))
Source§

fn manhattan_distance( vec: impl Iterator<Item = f32>, other: impl Iterator<Item = f32>, ) -> f64

マンハッタン距離 d(a, b) = Σ(|a_i - b_i|)
Source§

impl Compare<f64> for DefaultCompare

Source§

fn dot(vec: impl Iterator<Item = f64>, other: impl Iterator<Item = f64>) -> f64

dot積 d(a, b) = Σ(a_i * b_i)
Source§

fn cosine_similarity( vec: impl Iterator<Item = (usize, f64)>, other: impl Iterator<Item = (usize, f64)>, ) -> f64

コサイン類似度 cos(θ) = Σ(a_i * b_i) / (||a|| * ||b||) ||a|| = sqrt(Σ(a_i^2))
Source§

fn euclidean_distance( vec: impl Iterator<Item = f64>, other: impl Iterator<Item = f64>, ) -> f64

ユークリッド距離 d(a, b) = sqrt(Σ((a_i - b_i)^2))
Source§

fn manhattan_distance( vec: impl Iterator<Item = f64>, other: impl Iterator<Item = f64>, ) -> f64

マンハッタン距離 d(a, b) = Σ(|a_i - b_i|)
Source§

fn chebyshev_distance( vec: impl Iterator<Item = f64>, other: impl Iterator<Item = f64>, ) -> f64

チェビシェフ距離 d(a, b) = max(|a_i - b_i|)
Source§

impl Compare<u16> for DefaultCompare

Source§

fn euclidean_distance( vec: impl Iterator<Item = u16>, other: impl Iterator<Item = u16>, ) -> f64

?

Source§

fn manhattan_distance( vec: impl Iterator<Item = u16>, other: impl Iterator<Item = u16>, ) -> f64

?

Source§

fn chebyshev_distance( vec: impl Iterator<Item = u16>, other: impl Iterator<Item = u16>, ) -> f64

?

Source§

fn dot(vec: impl Iterator<Item = u16>, other: impl Iterator<Item = u16>) -> f64

dot積 d(a, b) = Σ(a_i * b_i)
Source§

fn cosine_similarity( vec: impl Iterator<Item = (usize, u16)>, other: impl Iterator<Item = (usize, u16)>, ) -> f64

コサイン類似度 cos(θ) = Σ(a_i * b_i) / (||a|| * ||b||) ||a|| = sqrt(Σ(a_i^2))
Source§

impl Compare<u32> for DefaultCompare

Source§

fn dot(vec: impl Iterator<Item = u32>, other: impl Iterator<Item = u32>) -> f64

dot積 d(a, b) = Σ(a_i * b_i)
Source§

fn cosine_similarity( vec: impl Iterator<Item = (usize, u32)>, other: impl Iterator<Item = (usize, u32)>, ) -> f64

コサイン類似度 cos(θ) = Σ(a_i * b_i) / (||a|| * ||b||) ||a|| = sqrt(Σ(a_i^2))
Source§

fn euclidean_distance( vec: impl Iterator<Item = u32>, other: impl Iterator<Item = u32>, ) -> f64

ユークリッド距離 d(a, b) = sqrt(Σ((a_i - b_i)^2))
Source§

fn manhattan_distance( vec: impl Iterator<Item = u32>, other: impl Iterator<Item = u32>, ) -> f64

マンハッタン距離 d(a, b) = Σ(|a_i - b_i|)
Source§

fn chebyshev_distance( vec: impl Iterator<Item = u32>, other: impl Iterator<Item = u32>, ) -> f64

チェビシェフ距離 d(a, b) = max(|a_i - b_i|)
Source§

impl Compare<u8> for DefaultCompare

impl Compare for u8, u16, u32, f32, f64

Source§

fn dot(vec: impl Iterator<Item = u8>, other: impl Iterator<Item = u8>) -> f64

dot積 d(a, b) = Σ(a_i * b_i)
Source§

fn cosine_similarity( vec: impl Iterator<Item = (usize, u8)>, other: impl Iterator<Item = (usize, u8)>, ) -> f64

コサイン類似度 cos(θ) = Σ(a_i * b_i) / (||a|| * ||b||) ||a|| = sqrt(Σ(a_i^2))
Source§

fn euclidean_distance( vec: impl Iterator<Item = u8>, other: impl Iterator<Item = u8>, ) -> f64

ユークリッド距離 d(a, b) = sqrt(Σ((a_i - b_i)^2))
Source§

fn manhattan_distance( vec: impl Iterator<Item = u8>, other: impl Iterator<Item = u8>, ) -> f64

マンハッタン距離 d(a, b) = Σ(|a_i - b_i|)
Source§

fn chebyshev_distance( vec: impl Iterator<Item = u8>, other: impl Iterator<Item = u8>, ) -> f64

チェビシェフ距離 d(a, b) = max(|a_i - b_i|)
Source§

impl Debug for DefaultCompare

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.