Struct lance_index::vector::sq::ScalarQuantizer
source · pub struct ScalarQuantizer {
pub num_bits: u16,
pub dim: usize,
pub metric_type: MetricType,
pub bounds: Range<f64>,
}Expand description
Scalar Quantization, optimized for [Apache Arrow] buffer memory layout.
Fields§
§num_bits: u16Number of bits for the centroids.
Only support 8, as one of u8 byte now.
dim: usizeOriginal dimension of the vectors.
metric_type: MetricTypeDistance type.
bounds: Range<f64>Implementations§
source§impl ScalarQuantizer
impl ScalarQuantizer
pub fn new(num_bits: u16, dim: usize, metric_type: MetricType) -> Self
pub fn with_bounds( num_bits: u16, dim: usize, metric_type: MetricType, bounds: Range<f64> ) -> Self
pub fn num_bits(&self) -> u16
pub fn update_bounds<T: ArrowFloatType>( &mut self, vectors: &FixedSizeListArray ) -> Result<Range<f64>>
pub fn transform<T: ArrowFloatType>(&self, data: &dyn Array) -> Result<ArrayRef>
pub fn bounds(&self) -> Range<f64>
sourcepub fn use_residual(&self) -> bool
pub fn use_residual(&self) -> bool
Whether to use residual as input or not.
Trait Implementations§
source§impl Clone for ScalarQuantizer
impl Clone for ScalarQuantizer
source§fn clone(&self) -> ScalarQuantizer
fn clone(&self) -> ScalarQuantizer
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 ScalarQuantizer
impl Debug for ScalarQuantizer
source§impl Quantization for ScalarQuantizer
impl Quantization for ScalarQuantizer
type Metadata = ScalarQuantizationMetadata
type Storage = ScalarQuantizationStorage
fn code_dim(&self) -> usize
fn column(&self) -> &'static str
fn metadata_key(&self) -> &'static str
fn quantization_type(&self) -> QuantizationType
fn metadata(&self, _: Option<QuantizationMetadata>) -> Result<Value>
Auto Trait Implementations§
impl Freeze for ScalarQuantizer
impl RefUnwindSafe for ScalarQuantizer
impl Send for ScalarQuantizer
impl Sync for ScalarQuantizer
impl Unpin for ScalarQuantizer
impl UnwindSafe for ScalarQuantizer
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<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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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