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> { /* private fields */ }Implementations§
Source§impl<C> LEIntVec<C>
impl<C> LEIntVec<C>
Sourcepub fn from_with_param(
input: &[u64],
k: usize,
codec_param: C::Params,
) -> Result<Self, Box<dyn Error>>
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);Sourcepub fn get(&self, index: usize) -> u64
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);Sourcepub fn into_vec(self) -> Vec<u64>
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);Sourcepub fn iter(&self) -> LEIntVecIter<'_, C> ⓘ
pub fn iter(&self) -> LEIntVecIter<'_, C> ⓘ
Returns an iterator over the values stored in the vector.
Sourcepub fn limbs(&self) -> Vec<u64>
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.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of integers stored in the compressed vector.
This value represents the total count of decompressed integers.
Sourcepub fn get_sampling_rate(&self) -> usize
pub fn get_sampling_rate(&self) -> usize
Returns the sampling rate used by the compressed vector.
Sourcepub fn get_samples(&self) -> Vec<usize>
pub fn get_samples(&self) -> Vec<usize>
Returns the codec parameter used by the compressed vector.