|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.kamikaze.pfordelta.PForDelta
public class PForDelta
Implementation of the optimized PForDelta algorithm for sorted integer arrays. The basic ideas are based on 1. Original algorithm from http://homepages.cwi.nl/~heman/downloads/msthesis.pdf 2. Optimization and variation from http://www2008.org/papers/pdf/p387-zhangA.pdf 3. Further optimization http://www2009.org/proceedings/pdf/p401.pdf As a part of the PForDelta implementation, Simple16 is used to compress exceptions. The original Simple16 algorithm can also be found in the above literatures. This implementation overcomes the problem that Simple16 cannot deal with >2^28 numbers. Author: hao yan [email protected]
Constructor Summary | |
---|---|
PForDelta()
|
Method Summary | |
---|---|
static boolean |
checkBigNumbers(int[] inputBlock,
int bits,
int blockSize)
Check if the block contains big numbers that is greater than ((1<< bits)-1) |
static int[] |
compressOneBlock(int[] inputBlock,
int bits,
int blockSize)
The core implementation of compressing a block with blockSize integers using PForDelta with the given parameter b |
static int[] |
compressOneBlockOpt(int[] inBlock,
int blockSize)
Compress one block of blockSize integers using PForDelta with the optimal parameter b |
static int |
decompressBBitSlots(int[] outDecompSlots,
int[] inCompBlock,
int blockSize,
int bits)
Decompress b-bit slots |
static int |
decompressBlockByS16(int[] outDecompBlock,
int[] inCompBlock,
int inStartOffsetInBits,
int blockSize)
Decompress a block of blockSize integers using Simple16 algorithm |
static int |
decompressOneBlock(int[] outBlock,
int[] inBlock,
int blockSize)
Decompress one block using PForDelta |
static int |
estimateCompressedSize(int[] inputBlock,
int bits,
int blockSize)
Estimate the compressed size in ints of a block |
static int |
readBits(int[] in,
int inOffset,
int bits)
Read a certain number of bits of an integer into an integer array starting from the given start offset |
static void |
writeBits(int[] out,
int val,
int outOffset,
int bits)
Write a certain number of bits of an integer into an integer array starting from the given start offset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PForDelta()
Method Detail |
---|
public static int[] compressOneBlockOpt(int[] inBlock, int blockSize)
inBlock
- the block to be compressedblockSize
- the block size
public static int decompressOneBlock(int[] outBlock, int[] inBlock, int blockSize)
outBlock
- the block that was decompressedinBlock
- the block to be decompressedblockSize
- the number of elements in the decompressed block
public static int estimateCompressedSize(int[] inputBlock, int bits, int blockSize) throws IllegalArgumentException
inputBlock
- the block to be compressedbits
- the value of the parameter bblockSize
- the block size
IllegalArgumentException
public static boolean checkBigNumbers(int[] inputBlock, int bits, int blockSize) throws IllegalArgumentException
inputBlock
- the block to be compressedbits
- the numbers of bits to decide whether a number is a big numberblockSize
- the block size
IllegalArgumentException
public static int[] compressOneBlock(int[] inputBlock, int bits, int blockSize) throws IllegalArgumentException
inputBlock
- the block to be compressedbits
- the the value of the parameter bblockSize
- the block size
IllegalArgumentException
public static int decompressBBitSlots(int[] outDecompSlots, int[] inCompBlock, int blockSize, int bits)
outDecompSlots
- decompressed block which is the outputinCompBlock
- the compressed block which is the inputblockSize
- the block sizebits
- the value of the parameter b
public static int decompressBlockByS16(int[] outDecompBlock, int[] inCompBlock, int inStartOffsetInBits, int blockSize)
outDecompBlock
- the decompressed block which is the outputinCompBlock
- the compressed block which is the inputblockSize
- the block sizeinStartOffsetInBits
- the start offset in bits of the compressed block
public static final void writeBits(int[] out, int val, int outOffset, int bits)
out
- the output arrayval
- the integer to be writtenoutOffset
- the start offset in bits in the output arraybits
- the number of bits to be written (bits>=0)public static final int readBits(int[] in, int inOffset, int bits)
in
- the input arrayinOffset
- the start offset in bits in the input arraybits
- the number of bits to be read, unlike writeBits(), readBits() does not deal with bits==0 and thus bits must > 0. When bits ==0, the calling functions will just skip the entire bits-bit slots without decoding them
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |