Skip to main content

Impl

Struct Impl 

Source
pub struct Impl<const NBITS: usize, A = GlobalAllocator>
where A: Allocator,
{ /* private fields */ }
Expand description

Implementation for Quantizer specializing on the number of bits used for data compression.

Implementations§

Source§

impl<const NBITS: usize, A: Allocator> Impl<NBITS, A>

Source

pub fn new(quantizer: SphericalQuantizer<A>) -> Result<Self, AllocatorError>
where Self: Constructible<A>,

Construct a new plan around quantizer providing distance computers for metric.

Source

pub fn quantizer(&self) -> &SphericalQuantizer<A>

Return the underlying SphericalQuantizer.

Source

pub fn supports(layout: QueryLayout) -> bool

Return true if this plan supports layout for query computers.

Otherwise, return false.

Trait Implementations§

Source§

impl<const NBITS: usize, A> Constructible<A> for Impl<NBITS, A>
where A: Allocator, AsData<NBITS>: FromOpaque, SphericalQuantizer<A>: Dispatchable<AsData<NBITS>, NBITS>,

Source§

impl<A, B> Quantizer<B> for Impl<1, A>
where A: Allocator + RefUnwindSafe + Send + Sync + 'static, B: Allocator + UnwindSafe + Send + Sync + 'static,

Source§

fn nbits(&self) -> usize

The effective number of bits in the encoding.
Source§

fn dim(&self) -> usize

The effective dimensionality of each compressed vector.
Source§

fn full_dim(&self) -> usize

The dimensionality of the full-precision input vectors.
Source§

fn bytes(&self) -> usize

The number of bytes occupied by each compressed vector.
Source§

fn distance_computer( &self, allocator: B, ) -> Result<DistanceComputer<B>, AllocatorError>

Return a distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn distance_computer_ref(&self) -> &dyn DynDistanceComputer

Return a scoped distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn query_computer( &self, layout: QueryLayout, allocator: B, ) -> Result<DistanceComputer<B>, DistanceComputerError>

A stand alone distance computer specialized for the specified query layout. Read more
Source§

fn query_buffer_description( &self, layout: QueryLayout, ) -> Result<QueryBufferDescription, UnsupportedQueryLayout>

Return the number of bytes and alignment of a buffer used to contain a compressed query with the provided layout. Read more
Source§

fn compress_query( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, buffer: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), QueryCompressionError>

Compress the query using the specified layout into buffer. Read more
Source§

fn fused_query_computer( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, allocator: B, scratch: ScopedAllocator<'_>, ) -> Result<QueryComputer<B>, QueryComputerError>

Return a query for the argument x capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn is_supported(&self, layout: QueryLayout) -> bool

Return whether or not this plan supports the given QueryLayout.
Source§

fn compress( &self, x: &[f32], into: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), CompressionError>

Compress the vector x into the opaque slice. Read more
Source§

fn metric(&self) -> SupportedMetric

Return the metric this plan was created with.
Source§

fn try_clone_into( &self, allocator: B, ) -> Result<Poly<dyn Quantizer<B>, B>, AllocatorError>

Clone the backing object.
Source§

fn serialize(&self, allocator: B) -> Result<Poly<[u8], B>, AllocatorError>

Available on crate feature flatbuffers only.
Serialize self into a flatbuffer, returning the flatbuffer. The function try_deserialize should undo this operation.
Source§

impl<A, B> Quantizer<B> for Impl<2, A>
where A: Allocator + RefUnwindSafe + Send + Sync + 'static, B: Allocator + UnwindSafe + Send + Sync + 'static,

Source§

fn nbits(&self) -> usize

The effective number of bits in the encoding.
Source§

fn dim(&self) -> usize

The effective dimensionality of each compressed vector.
Source§

fn full_dim(&self) -> usize

The dimensionality of the full-precision input vectors.
Source§

fn bytes(&self) -> usize

The number of bytes occupied by each compressed vector.
Source§

fn distance_computer( &self, allocator: B, ) -> Result<DistanceComputer<B>, AllocatorError>

Return a distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn distance_computer_ref(&self) -> &dyn DynDistanceComputer

Return a scoped distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn query_computer( &self, layout: QueryLayout, allocator: B, ) -> Result<DistanceComputer<B>, DistanceComputerError>

A stand alone distance computer specialized for the specified query layout. Read more
Source§

fn query_buffer_description( &self, layout: QueryLayout, ) -> Result<QueryBufferDescription, UnsupportedQueryLayout>

Return the number of bytes and alignment of a buffer used to contain a compressed query with the provided layout. Read more
Source§

fn compress_query( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, buffer: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), QueryCompressionError>

Compress the query using the specified layout into buffer. Read more
Source§

fn fused_query_computer( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, allocator: B, scratch: ScopedAllocator<'_>, ) -> Result<QueryComputer<B>, QueryComputerError>

Return a query for the argument x capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn is_supported(&self, layout: QueryLayout) -> bool

Return whether or not this plan supports the given QueryLayout.
Source§

fn compress( &self, x: &[f32], into: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), CompressionError>

Compress the vector x into the opaque slice. Read more
Source§

fn metric(&self) -> SupportedMetric

Return the metric this plan was created with.
Source§

fn try_clone_into( &self, allocator: B, ) -> Result<Poly<dyn Quantizer<B>, B>, AllocatorError>

Clone the backing object.
Source§

fn serialize(&self, allocator: B) -> Result<Poly<[u8], B>, AllocatorError>

Available on crate feature flatbuffers only.
Serialize self into a flatbuffer, returning the flatbuffer. The function try_deserialize should undo this operation.
Source§

impl<A, B> Quantizer<B> for Impl<4, A>
where A: Allocator + RefUnwindSafe + Send + Sync + 'static, B: Allocator + UnwindSafe + Send + Sync + 'static,

Source§

fn nbits(&self) -> usize

The effective number of bits in the encoding.
Source§

fn dim(&self) -> usize

The effective dimensionality of each compressed vector.
Source§

fn full_dim(&self) -> usize

The dimensionality of the full-precision input vectors.
Source§

fn bytes(&self) -> usize

The number of bytes occupied by each compressed vector.
Source§

fn distance_computer( &self, allocator: B, ) -> Result<DistanceComputer<B>, AllocatorError>

Return a distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn distance_computer_ref(&self) -> &dyn DynDistanceComputer

Return a scoped distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn query_computer( &self, layout: QueryLayout, allocator: B, ) -> Result<DistanceComputer<B>, DistanceComputerError>

A stand alone distance computer specialized for the specified query layout. Read more
Source§

fn query_buffer_description( &self, layout: QueryLayout, ) -> Result<QueryBufferDescription, UnsupportedQueryLayout>

Return the number of bytes and alignment of a buffer used to contain a compressed query with the provided layout. Read more
Source§

fn compress_query( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, buffer: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), QueryCompressionError>

Compress the query using the specified layout into buffer. Read more
Source§

fn fused_query_computer( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, allocator: B, scratch: ScopedAllocator<'_>, ) -> Result<QueryComputer<B>, QueryComputerError>

Return a query for the argument x capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn is_supported(&self, layout: QueryLayout) -> bool

Return whether or not this plan supports the given QueryLayout.
Source§

fn compress( &self, x: &[f32], into: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), CompressionError>

Compress the vector x into the opaque slice. Read more
Source§

fn metric(&self) -> SupportedMetric

Return the metric this plan was created with.
Source§

fn try_clone_into( &self, allocator: B, ) -> Result<Poly<dyn Quantizer<B>, B>, AllocatorError>

Clone the backing object.
Source§

fn serialize(&self, allocator: B) -> Result<Poly<[u8], B>, AllocatorError>

Available on crate feature flatbuffers only.
Serialize self into a flatbuffer, returning the flatbuffer. The function try_deserialize should undo this operation.
Source§

impl<A, B> Quantizer<B> for Impl<8, A>
where A: Allocator + RefUnwindSafe + Send + Sync + 'static, B: Allocator + UnwindSafe + Send + Sync + 'static,

Source§

fn nbits(&self) -> usize

The effective number of bits in the encoding.
Source§

fn dim(&self) -> usize

The effective dimensionality of each compressed vector.
Source§

fn full_dim(&self) -> usize

The dimensionality of the full-precision input vectors.
Source§

fn bytes(&self) -> usize

The number of bytes occupied by each compressed vector.
Source§

fn distance_computer( &self, allocator: B, ) -> Result<DistanceComputer<B>, AllocatorError>

Return a distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn distance_computer_ref(&self) -> &dyn DynDistanceComputer

Return a scoped distance computer capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn query_computer( &self, layout: QueryLayout, allocator: B, ) -> Result<DistanceComputer<B>, DistanceComputerError>

A stand alone distance computer specialized for the specified query layout. Read more
Source§

fn query_buffer_description( &self, layout: QueryLayout, ) -> Result<QueryBufferDescription, UnsupportedQueryLayout>

Return the number of bytes and alignment of a buffer used to contain a compressed query with the provided layout. Read more
Source§

fn compress_query( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, buffer: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), QueryCompressionError>

Compress the query using the specified layout into buffer. Read more
Source§

fn fused_query_computer( &self, x: &[f32], layout: QueryLayout, allow_rescale: bool, allocator: B, scratch: ScopedAllocator<'_>, ) -> Result<QueryComputer<B>, QueryComputerError>

Return a query for the argument x capable on operating on validly initialized Opaque slices of length Self::bytes. Read more
Source§

fn is_supported(&self, layout: QueryLayout) -> bool

Return whether or not this plan supports the given QueryLayout.
Source§

fn compress( &self, x: &[f32], into: OpaqueMut<'_>, scratch: ScopedAllocator<'_>, ) -> Result<(), CompressionError>

Compress the vector x into the opaque slice. Read more
Source§

fn metric(&self) -> SupportedMetric

Return the metric this plan was created with.
Source§

fn try_clone_into( &self, allocator: B, ) -> Result<Poly<dyn Quantizer<B>, B>, AllocatorError>

Clone the backing object.
Source§

fn serialize(&self, allocator: B) -> Result<Poly<[u8], B>, AllocatorError>

Available on crate feature flatbuffers only.
Serialize self into a flatbuffer, returning the flatbuffer. The function try_deserialize should undo this operation.

Auto Trait Implementations§

§

impl<const NBITS: usize, A> Freeze for Impl<NBITS, A>
where A: Freeze,

§

impl<const NBITS: usize, A = GlobalAllocator> !RefUnwindSafe for Impl<NBITS, A>

§

impl<const NBITS: usize, A> Send for Impl<NBITS, A>
where A: Send,

§

impl<const NBITS: usize, A> Sync for Impl<NBITS, A>
where A: Sync,

§

impl<const NBITS: usize, A> Unpin for Impl<NBITS, A>
where A: Unpin,

§

impl<const NBITS: usize, A> UnsafeUnpin for Impl<NBITS, A>
where A: UnsafeUnpin,

§

impl<const NBITS: usize, A = GlobalAllocator> !UnwindSafe for Impl<NBITS, A>

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,