vortex_alp

Struct 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

Source

pub fn new<T>(sample: &[T]) -> Self

Build a new encoder from a sample of doubles.

Source

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§

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> 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, 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<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T