![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Quantizes float32 vectors to INT8 or INT4 representation. More...
#include <quantized_vector.hpp>
Public Member Functions | |
| Quantizer (QuantizationParams params) | |
| Construct a quantizer with the given parameters. | |
| void | quantize (const float *input, uint8_t *output) const |
| Quantize a single float32 vector into the output buffer. | |
| std::vector< uint8_t > | quantize_batch (const float *input, size_t num_vectors) const |
| Quantize a batch of vectors into a flat buffer of quantized bytes. | |
| const QuantizationParams & | params () const |
| Access the quantization parameters. | |
Quantizes float32 vectors to INT8 or INT4 representation.
Uses SIMD acceleration (AVX2, SSE2, or NEON) when available, with a scalar fallback. INT4 quantization always uses the scalar path because nibble packing makes SIMD less beneficial.
Definition at line 131 of file quantized_vector.hpp.
|
inlineexplicit |
Construct a quantizer with the given parameters.
The params must have a valid scale (> 0) and dimension (> 0).
Definition at line 135 of file quantized_vector.hpp.
|
inline |
Access the quantization parameters.
Definition at line 164 of file quantized_vector.hpp.
|
inline |
Quantize a single float32 vector into the output buffer.
output must hold at least dim bytes.output must hold at least ceil(dim/2) bytes.| input | Pointer to dim float32 values. |
| output | Destination buffer for quantized bytes. |
Definition at line 844 of file quantized_vector.hpp.
|
inline |
Quantize a batch of vectors into a flat buffer of quantized bytes.
| input | Pointer to num_vectors * dim contiguous floats. |
| num_vectors | Number of vectors to quantize. |
num_vectors * bytes_per_vector(). Definition at line 879 of file quantized_vector.hpp.