FullQuery

Struct FullQuery 

Source
pub struct FullQuery {
    pub data: Box<[f32]>,
    pub meta: FullQueryMeta,
}
Expand description

The inner product between X = ax * X' + bx and Y for d-dimensional vectors X and Y is:

<X, Y> = <ax * X' + bx, Y>
       = ax * <X', Y> + bx * sum(Y).
              --------
                 |
         Integer-Float Dot Product

To compute the squared L2 distance,

|X - Y|^2 = |ax * X' + bx|^2 + |Y|^2 - 2 * <X', Y>

A Full Precision Query

Fields§

§data: Box<[f32]>

The data after transform is applied to it.

§meta: FullQueryMeta

Implementations§

Source§

impl FullQuery

Source

pub fn empty(dim: usize) -> Self

Construct an empty FullQuery for dim dimensional data.

Source

pub fn len(&self) -> usize

Output the length of data

Source

pub fn is_empty(&self) -> bool

Output if data is empty.

Trait Implementations§

Source§

impl<T> CompressInto<&[T], &mut FullQuery> for MinMaxQuantizer
where T: Copy + Into<f32>,

Source§

fn compress_into( &self, from: &[T], to: &mut FullQuery, ) -> Result<(), Self::Error>

Compress the input vector from into a mutable reference for a FullQuery to.

This method simply applies the transformation to the input without any compression.

§Error

Returns an error if the input contains NaN.

§Panics

Panics if:

  • from.len() != self.dim(): Vector to be compressed must have the same dimensionality as the quantizer.
  • to.len() != self.output_dim(): Compressed vector must have the same dimensionality as the quantizer.
Source§

type Error = InputContainsNaN

Errors that may occur during compression.
Source§

type Output = ()

An output type resulting from compression.
Source§

impl Debug for FullQuery

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const NBITS: usize> PureDistanceFunction<&FullQuery, VectorBase<NBITS, Unsigned, SlicePtr<'_, u8>, Ref<'_, MinMaxCompensation>>, Result<MathematicalValue<f32>, UnequalLengths>> for MinMaxIP

Source§

impl<const NBITS: usize> PureDistanceFunction<&FullQuery, VectorBase<NBITS, Unsigned, SlicePtr<'_, u8>, Ref<'_, MinMaxCompensation>>, Result<MathematicalValue<f32>, UnequalLengths>> for MinMaxL2Squared

Source§

impl<const NBITS: usize> PureDistanceFunction<&FullQuery, VectorBase<NBITS, Unsigned, SlicePtr<'_, u8>, Ref<'_, MinMaxCompensation>>, Result<f32, UnequalLengths>> for MinMaxCosine

Source§

fn evaluate(x: &FullQuery, y: DataRef<'_, NBITS>) -> Result<f32>

Source§

impl<const NBITS: usize> PureDistanceFunction<&FullQuery, VectorBase<NBITS, Unsigned, SlicePtr<'_, u8>, Ref<'_, MinMaxCompensation>>, Result<f32, UnequalLengths>> for MinMaxCosineNormalized

Source§

fn evaluate(x: &FullQuery, y: DataRef<'_, NBITS>) -> Result<f32>

Source§

impl<const NBITS: usize> PureDistanceFunction<&FullQuery, VectorBase<NBITS, Unsigned, SlicePtr<'_, u8>, Ref<'_, MinMaxCompensation>>, Result<f32, UnequalLengths>> for MinMaxIP

Source§

fn evaluate(x: &FullQuery, y: DataRef<'_, NBITS>) -> Result<f32>

Source§

impl<const NBITS: usize> PureDistanceFunction<&FullQuery, VectorBase<NBITS, Unsigned, SlicePtr<'_, u8>, Ref<'_, MinMaxCompensation>>, Result<f32, UnequalLengths>> for MinMaxL2Squared

Source§

fn evaluate(x: &FullQuery, y: DataRef<'_, NBITS>) -> Result<f32>

Source§

impl<'short> Reborrow<'short> for FullQuery

Source§

type Target = &'short FullQuery

Source§

fn reborrow(&'short self) -> Self::Target

Borrow self into a generalized reference type and reborrow
Source§

impl<'short> ReborrowMut<'short> for FullQuery

Source§

type Target = &'short mut FullQuery

Source§

fn reborrow_mut(&'short mut self) -> Self::Target

Mutably borrow self into a generalized reference type and reborrow.

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> AsyncFriendly for T
where T: Send + Sync + 'static,