Type Alias LEIntVec

Source
pub type LEIntVec<C> = IntVec<LE, BufBitWriter<LE, MemWordWriterVec<u64, Vec<u64>>>, C>;
Expand description

Little-endian variant of IntVec.

Aliased Type§

struct LEIntVec<C> {
    pub data: Vec<u64>,
    pub samples: Vec<usize>,
    pub codec: PhantomData<C>,
    pub k: usize,
    pub len: usize,
    pub codec_param: <C as Codec<LittleEndian, BufBitWriter<LittleEndian, MemWordWriterVec<u64, Vec<u64>>>>>::Params,
    pub endian: PhantomData<LittleEndian>,
}

Fields§

§data: Vec<u64>§samples: Vec<usize>§codec: PhantomData<C>§k: usize§len: usize§codec_param: <C as Codec<LittleEndian, BufBitWriter<LittleEndian, MemWordWriterVec<u64, Vec<u64>>>>>::Params§endian: PhantomData<LittleEndian>

Implementations§

Source§

impl<C> LEIntVec<C>

Source

pub fn from_with_param( input: &[u64], k: usize, codec_param: C::Params, ) -> Result<Self, Box<dyn Error>>

Creates a new LEIntVec from a vector of unsigned 64-bit integers.

Values are encoded with the specified codec parameter.

§Arguments
  • input: The values to be compressed.
  • k: The sampling rate (every k-th value is stored as a sample).
  • codec_param: Parameters for the codec.
§Examples
use compressed_intvec::intvec::LEIntVec;
use compressed_intvec::codecs::ExpGolombCodec;

let input = vec![1, 5, 3, 1991, 42];
let intvec = LEIntVec::<ExpGolombCodec>::from_with_param(&input, 2, 3).unwrap();

let value = intvec.get(3);
assert_eq!(value, 1991);
Source

pub fn get(&self, index: usize) -> u64

Retrieves the value at the given index.

Returns None if the index is out of bounds.

§Examples
use compressed_intvec::intvec::LEIntVec;
use compressed_intvec::codecs::GammaCodec;

let input = vec![1, 5, 3, 1991, 42];
let intvec = LEIntVec::<GammaCodec>::from(&input, 2).unwrap();
let value = intvec.get(3);
assert_eq!(value, 1991);
Source

pub fn into_vec(self) -> Vec<u64>

Returns the original vector of integers.

This operation is expensive as it requires decoding the entire bitstream.

§Examples
use compressed_intvec::intvec::LEIntVec;
use compressed_intvec::codecs::GammaCodec;

let input = vec![43, 12, 5, 1991, 42];
let intvec = LEIntVec::<GammaCodec>::from(&input, 2).unwrap();
let values = intvec.into_vec();
assert_eq!(values, input);
Source

pub fn iter(&self) -> LEIntVecIter<'_, C>

Returns an iterator over the values stored in the vector.

Source

pub fn limbs(&self) -> Vec<u64>

Returns a clone of the internal bitstream data as a vector of 64-bit unsigned integers.

This can be used for debugging or low-level operations where access to the raw compressed limb data is required.

Source

pub fn len(&self) -> usize

Returns the number of integers stored in the compressed vector.

This value represents the total count of decompressed integers.

Source

pub fn is_empty(&self) -> bool

Checks whether the compressed vector contains no elements.

Returns true if the vector is empty, and false otherwise.

Source§

impl<C: Codec<LE, BufBitWriter<LE, MemWordWriterVec<u64, Vec<u64>>>, Params = ()>> LEIntVec<C>

Convenience constructor for codecs with no extra runtime parameter.

Source

pub fn from(input: &[u64], k: usize) -> Result<Self, Box<dyn Error>>