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>
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.