|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.kamikaze.pfordelta.LCPForDelta
public class LCPForDelta
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 literature. This implementation overcomes the problem that Simple16 cannot deal with >2^28 numbers. This implementation is almost same as PForDelta in the same package, except that it is tuned especially for Lucene-4.0 Codec to achieve the best performance in Lucene-4.0.
Constructor Summary | |
---|---|
LCPForDelta()
|
Method Summary | |
---|---|
static boolean |
checkBigNumbers(int[] inputBlock,
int blockSize,
int bits)
Check if the block contains big numbers that is greater than ((1<< bits)-1) |
int |
compress(int[] inBlock,
int blockSize)
Compress one block of blockSize integers using PForDelta with the optimal parameter b |
int |
compressOneBlockCore(int[] inputBlock,
int blockSize,
int bits)
The core implementation of compressing a block with blockSize integers using PForDelta with the given parameter b |
int |
compressOneBlockCore2(int[] inputBlock,
int blockSize,
int bits)
|
static int |
decompressBBitSlots(int[] outDecompSlots,
int[] inCompBlock,
int blockSize,
int bits)
Decompress b-bit slots |
static int |
decompressBBitSlotsWithHardCodes(int[] outDecompSlots,
int[] inCompBlock,
int blockSize,
int bits)
|
static int |
decompressBBitSlotsWithHardCodesWithIntBuffer(int[] outDecompSlots,
IntBuffer inCompBlock,
int blockSize,
int bits)
|
static int |
decompressBlockByS16(int[] outDecompBlock,
int[] inCompBlock,
int inStartOffsetInBits,
int blockSize)
Decompress a block of blockSize integers using Simple16 algorithm |
static void |
decompressBlockByS16WithIntBuffer(int[] outDecompBlock,
IntBuffer inCompBlock,
int blockSize)
|
static void |
decompressBlockByS16WithIntBufferIntegrated(int[] outDecompBlock,
IntBuffer inCompBlock,
int blockSize,
int[] expPosBuffer,
int oribits)
|
static void |
decompressOneBlock(int[] decompBlock,
int[] inBlock,
int blockSize)
Decompress one block using PForDelta |
static void |
decompressOneBlockWithSize(int[] decompBlock,
int[] inBlock,
int blockSize,
int[] expPosBuffer,
int[] expHighBitsBuffer,
int inBlockLen)
|
static void |
decompressOneBlockWithSizeWithIntBuffer(int[] decompBlock,
IntBuffer inBlock,
int blockSize,
int[] expPosBuffer,
int[] expHighBitsBuffer,
int inBlockLen)
|
static int |
estimateCompressedSize(int[] inputBlock,
int blockSize,
int bits)
Estimate the compressed size in ints of a block |
int[] |
getCompBuffer()
|
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 int |
readBitsWithBuffer(int[] in,
int inOffset,
int bits)
|
void |
setCompBuffer(int[] buffer)
|
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 LCPForDelta()
Method Detail |
---|
public int[] getCompBuffer()
public void setCompBuffer(int[] buffer)
public int compress(int[] inBlock, int blockSize)
inBlock
- the block to be compressedblockSize
- the block size
public int compressOneBlockCore(int[] inputBlock, int blockSize, int bits) throws IllegalArgumentException
inputBlock
- the block to be compressedblockSize
- the block sizebits
- the the value of the parameter b
IllegalArgumentException
public int compressOneBlockCore2(int[] inputBlock, int blockSize, int bits) throws IllegalArgumentException
IllegalArgumentException
public static void decompressOneBlock(int[] decompBlock, int[] inBlock, int blockSize)
decompBlock
- the block that was decompressedinBlock
- the block to be decompressedblockSize
- the number of elements in the decompressed blockpublic static void decompressOneBlockWithSize(int[] decompBlock, int[] inBlock, int blockSize, int[] expPosBuffer, int[] expHighBitsBuffer, int inBlockLen)
public static void decompressOneBlockWithSizeWithIntBuffer(int[] decompBlock, IntBuffer inBlock, int blockSize, int[] expPosBuffer, int[] expHighBitsBuffer, int inBlockLen)
public static int estimateCompressedSize(int[] inputBlock, int blockSize, int bits) 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 blockSize, int bits) 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 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 decompressBBitSlotsWithHardCodes(int[] outDecompSlots, int[] inCompBlock, int blockSize, int bits)
public static int decompressBBitSlotsWithHardCodesWithIntBuffer(int[] outDecompSlots, IntBuffer inCompBlock, int blockSize, int bits)
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 void decompressBlockByS16WithIntBuffer(int[] outDecompBlock, IntBuffer inCompBlock, int blockSize)
public static void decompressBlockByS16WithIntBufferIntegrated(int[] outDecompBlock, IntBuffer inCompBlock, int blockSize, int[] expPosBuffer, int oribits)
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
public static final int readBitsWithBuffer(int[] in, int inOffset, int bits)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |