1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT license.
*/
use ;
use ;
/// [`QuantCompressor`] defines the interface for quantizers used by
/// [`super::QuantDataGenerator`].
///
/// This trait serves as a general wrapper for different quantizers, allowing them to be
/// used interchangeably with [`super::QuantDataGenerator`]. Any type implementing this trait
/// can be used to compress vector data during the data generation process.
///
/// # Type Parameters
/// - `T`: The data type of the input vectors. Must implement `Copy + Into<f32> + Pod + Sync`
/// so that [`super::QuantDataGenerator`] can parallelize computation, call `compress_into`,
/// and read from the data file.
///
/// # Associated Types
/// - [`Self::CompressorContext`]: An overloadable type that provides initialization parameters
/// for the compressor.
///
/// # Methods
/// - `new`: Constructs a new compressor instance with the provided context.
/// - `compress`: Compresses a batch of vectors into the output buffer.
/// - `compressed_bytes`: Returns the size in bytes of each compressed vector