Struct vortex_alp::RDEncoder
source · pub struct RDEncoder { /* private fields */ }
Expand description
Encoder for ALP-RD (“real doubles”) values.
The encoder calculates its parameters from a single sample of floating-point values, and then can be applied to many vectors.
ALP-RD uses the algorithm outlined in Section 3.4 of the paper. The crux of it is that the front
(most significant) bits of many double vectors tend to be the same, i.e. most doubles in a
vector often use the same exponent and front bits. Compression proceeds by finding the best
prefix of up to 16 bits that can be collapsed into a dictionary of
up to 8 elements. Each double can then be broken into the front/left L
bits, which neatly
bit-packs down to 1-3 bits per element (depending on the actual dictionary size).
The remaining R
bits naturally bit-pack.
In the ideal case, this scheme allows us to store a sequence of doubles in 49 bits-per-value.
Our implementation draws on the MIT-licensed C++ implementation provided by the original authors.
Implementations§
source§impl RDEncoder
impl RDEncoder
sourcepub fn new<T>(sample: &[T]) -> Selfwhere
T: ALPRDFloat + NativePType,
T::UINT: NativePType,
pub fn new<T>(sample: &[T]) -> Selfwhere
T: ALPRDFloat + NativePType,
T::UINT: NativePType,
Build a new encoder from a sample of doubles.
sourcepub fn encode(&self, array: &PrimitiveArray) -> ALPRDArray
pub fn encode(&self, array: &PrimitiveArray) -> ALPRDArray
Encode a set of floating point values with ALP-RD.
Each value will be split into a left and right component, which are compressed individually.
Auto Trait Implementations§
impl Freeze for RDEncoder
impl RefUnwindSafe for RDEncoder
impl Send for RDEncoder
impl Sync for RDEncoder
impl Unpin for RDEncoder
impl UnwindSafe for RDEncoder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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