Trait arroy::Distance

source ·
pub trait Distance: Send + Sync + Sized + Clone + Debug + 'static {
    type Header: Pod + Zeroable + Debug;

Show 16 methods // Required methods fn name() -> &'static str; fn new_header(vector: &UnalignedF32Slice) -> Self::Header; fn built_distance(p: &Leaf<'_, Self>, q: &Leaf<'_, Self>) -> f32; fn init(node: &mut Leaf<'_, Self>); fn create_split<R: Rng>( children: &ImmutableSubsetLeafs<'_, Self>, rng: &mut R, ) -> Result<Vec<f32>>; fn margin_no_header(p: &UnalignedF32Slice, q: &UnalignedF32Slice) -> f32; // Provided methods fn non_built_distance(p: &Leaf<'_, Self>, q: &Leaf<'_, Self>) -> f32 { ... } fn normalized_distance(d: f32) -> f32 { ... } fn pq_distance(distance: f32, margin: f32, side: Side) -> f32 { ... } fn norm(leaf: &Leaf<'_, Self>) -> f32 { ... } fn norm_no_header(v: &UnalignedF32Slice) -> f32 { ... } fn normalize(node: &mut Leaf<'_, Self>) { ... } fn update_mean( mean: &mut Leaf<'_, Self>, new_node: &Leaf<'_, Self>, norm: f32, c: f32, ) { ... } fn margin(p: &Leaf<'_, Self>, q: &Leaf<'_, Self>) -> f32 { ... } fn side<R: Rng>( normal_plane: &UnalignedF32Slice, node: &Leaf<'_, Self>, rng: &mut R, ) -> Side { ... } fn preprocess( _wtxn: &mut RwTxn<'_>, _new_iter: impl for<'a> Fn(&'a mut RwTxn<'_>) -> Result<RwPrefix<'a, KeyCodec, NodeCodec<Self>>>, ) -> Result<()> { ... }
}
Expand description

A trait used by arroy to compute the distances, compute the split planes, and normalize user vectors.

Required Associated Types§

source

type Header: Pod + Zeroable + Debug

A header structure with informations related to the

Required Methods§

source

fn name() -> &'static str

source

fn new_header(vector: &UnalignedF32Slice) -> Self::Header

source

fn built_distance(p: &Leaf<'_, Self>, q: &Leaf<'_, Self>) -> f32

Returns a non-normalized distance.

source

fn init(node: &mut Leaf<'_, Self>)

source

fn create_split<R: Rng>( children: &ImmutableSubsetLeafs<'_, Self>, rng: &mut R, ) -> Result<Vec<f32>>

source

fn margin_no_header(p: &UnalignedF32Slice, q: &UnalignedF32Slice) -> f32

Provided Methods§

source

fn non_built_distance(p: &Leaf<'_, Self>, q: &Leaf<'_, Self>) -> f32

source

fn normalized_distance(d: f32) -> f32

Normalizes the distance returned by the distance method.

source

fn pq_distance(distance: f32, margin: f32, side: Side) -> f32

source

fn norm(leaf: &Leaf<'_, Self>) -> f32

source

fn norm_no_header(v: &UnalignedF32Slice) -> f32

source

fn normalize(node: &mut Leaf<'_, Self>)

source

fn update_mean( mean: &mut Leaf<'_, Self>, new_node: &Leaf<'_, Self>, norm: f32, c: f32, )

source

fn margin(p: &Leaf<'_, Self>, q: &Leaf<'_, Self>) -> f32

source

fn side<R: Rng>( normal_plane: &UnalignedF32Slice, node: &Leaf<'_, Self>, rng: &mut R, ) -> Side

source

fn preprocess( _wtxn: &mut RwTxn<'_>, _new_iter: impl for<'a> Fn(&'a mut RwTxn<'_>) -> Result<RwPrefix<'a, KeyCodec, NodeCodec<Self>>>, ) -> Result<()>

Object Safety§

This trait is not object safe.

Implementors§