Package com.tdunning.math.stats
Class Simple64
- java.lang.Object
-
- com.tdunning.math.stats.Simple64
-
public class Simple64 extends java.lang.ObjectVery simple variable byte encoding that always uses 64bit units. The idea is that the next few values are smashed into 64 bits using a few bits to indicate how they are fitted in and the rest of the bits to fit each value into equal-sized chunks. In this encoding, 4 bits are used to indicate how the remaining 60 bits are divided. The possible ways are shown in the following table:Code Arrangement 14 1 X 60BITS 13 2 X 30BITS 12 3 X 20BITS 11 4 X 15BITS 10 5 X 12BITS 9 6 X 10BITS 8 7 X 8BITS 7 8 X 7BITS 6 10 X 6BITS 5 12 X 5BITS 4 15 X 4BITS 3 20 X 3BITS 2 30 X 2BITS 1 60 X 1BITS
-
-
Field Summary
Fields Modifier and Type Field Description private static intBITS_1_MASKprivate static intBITS_10_MASKprivate static intBITS_11_MASKprivate static intBITS_12_MASKprivate static intBITS_15_MASKprivate static intBITS_2_MASKprivate static intBITS_20_MASKprivate static intBITS_3_MASKprivate static intBITS_30_MASKprivate static intBITS_4_MASKprivate static intBITS_5_MASKprivate static intBITS_6_MASKprivate static intBITS_7_MASKprivate static intBITS_8_MASKprivate intinputCompressableprivate intinputCountprivate longmaxFitPlus1private intminBitsprivate static intNUM_DATA_BITSprivate long[]pendingprivate static intSTATUS_10NUM_6BITSprivate static intSTATUS_12NUM_5BITSprivate static intSTATUS_15NUM_4BITSprivate static intSTATUS_1NUM_60BITSprivate static intSTATUS_20NUM_3BITSprivate static intSTATUS_2NUM_30BITSprivate static intSTATUS_30NUM_2BITSprivate static intSTATUS_3NUM_20BITSprivate static intSTATUS_4NUM_15BITSprivate static intSTATUS_5NUM_12BITSprivate static intSTATUS_60NUM_1BITSprivate static intSTATUS_6NUM_10BITSprivate static intSTATUS_7NUM_8BITSprivate static intSTATUS_8NUM_7BITS
-
Constructor Summary
Constructors Constructor Description Simple64()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intadd(long v, long[] out)static voidcompress(java.nio.LongBuffer compressedBuffer, long[] unCompressedData, int offset, int size)private static intcompressSingle(long[] uncompressed, int inOffset, int inSize, java.nio.LongBuffer compressedBuffer)static intdecompress(java.nio.LongBuffer compressedBuffer, long[] unCompressedData)private static intdecompressSingle(long s9, long[] decompressed, int outOffset)private voidreset()
-
-
-
Field Detail
-
NUM_DATA_BITS
private static final int NUM_DATA_BITS
- See Also:
- Constant Field Values
-
BITS_30_MASK
private static final int BITS_30_MASK
- See Also:
- Constant Field Values
-
BITS_20_MASK
private static final int BITS_20_MASK
- See Also:
- Constant Field Values
-
BITS_15_MASK
private static final int BITS_15_MASK
- See Also:
- Constant Field Values
-
BITS_12_MASK
private static final int BITS_12_MASK
- See Also:
- Constant Field Values
-
BITS_11_MASK
private static final int BITS_11_MASK
- See Also:
- Constant Field Values
-
BITS_10_MASK
private static final int BITS_10_MASK
- See Also:
- Constant Field Values
-
BITS_8_MASK
private static final int BITS_8_MASK
- See Also:
- Constant Field Values
-
BITS_7_MASK
private static final int BITS_7_MASK
- See Also:
- Constant Field Values
-
BITS_6_MASK
private static final int BITS_6_MASK
- See Also:
- Constant Field Values
-
BITS_5_MASK
private static final int BITS_5_MASK
- See Also:
- Constant Field Values
-
BITS_4_MASK
private static final int BITS_4_MASK
- See Also:
- Constant Field Values
-
BITS_3_MASK
private static final int BITS_3_MASK
- See Also:
- Constant Field Values
-
BITS_2_MASK
private static final int BITS_2_MASK
- See Also:
- Constant Field Values
-
BITS_1_MASK
private static final int BITS_1_MASK
- See Also:
- Constant Field Values
-
STATUS_1NUM_60BITS
private static final int STATUS_1NUM_60BITS
- See Also:
- Constant Field Values
-
STATUS_2NUM_30BITS
private static final int STATUS_2NUM_30BITS
- See Also:
- Constant Field Values
-
STATUS_3NUM_20BITS
private static final int STATUS_3NUM_20BITS
- See Also:
- Constant Field Values
-
STATUS_4NUM_15BITS
private static final int STATUS_4NUM_15BITS
- See Also:
- Constant Field Values
-
STATUS_5NUM_12BITS
private static final int STATUS_5NUM_12BITS
- See Also:
- Constant Field Values
-
STATUS_6NUM_10BITS
private static final int STATUS_6NUM_10BITS
- See Also:
- Constant Field Values
-
STATUS_7NUM_8BITS
private static final int STATUS_7NUM_8BITS
- See Also:
- Constant Field Values
-
STATUS_8NUM_7BITS
private static final int STATUS_8NUM_7BITS
- See Also:
- Constant Field Values
-
STATUS_10NUM_6BITS
private static final int STATUS_10NUM_6BITS
- See Also:
- Constant Field Values
-
STATUS_12NUM_5BITS
private static final int STATUS_12NUM_5BITS
- See Also:
- Constant Field Values
-
STATUS_15NUM_4BITS
private static final int STATUS_15NUM_4BITS
- See Also:
- Constant Field Values
-
STATUS_20NUM_3BITS
private static final int STATUS_20NUM_3BITS
- See Also:
- Constant Field Values
-
STATUS_30NUM_2BITS
private static final int STATUS_30NUM_2BITS
- See Also:
- Constant Field Values
-
STATUS_60NUM_1BITS
private static final int STATUS_60NUM_1BITS
- See Also:
- Constant Field Values
-
inputCompressable
private int inputCompressable
-
minBits
private int minBits
-
maxFitPlus1
private long maxFitPlus1
-
pending
private final long[] pending
-
inputCount
private int inputCount
-
-
Method Detail
-
reset
private void reset()
-
add
public int add(long v, long[] out)
-
compressSingle
private static int compressSingle(long[] uncompressed, int inOffset, int inSize, java.nio.LongBuffer compressedBuffer)
-
decompressSingle
private static int decompressSingle(long s9, long[] decompressed, int outOffset)
-
compress
public static void compress(java.nio.LongBuffer compressedBuffer, long[] unCompressedData, int offset, int size)
-
decompress
public static int decompress(java.nio.LongBuffer compressedBuffer, long[] unCompressedData)
-
-