Package it.unimi.dsi.sux4j.mph.codec
Class Codec.Huffman
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.codec.Codec.Huffman
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Codec.Huffman.Coder
-
Nested classes/interfaces inherited from interface it.unimi.dsi.sux4j.mph.codec.Codec
Codec.Binary, Codec.Decoder, Codec.Gamma, Codec.Huffman, Codec.Unary, Codec.ZeroCodec
-
-
Constructor Summary
Constructors Constructor Description Huffman()
Creates a new Huffman codec no length limitations.Huffman(int maxDecodingTableLength)
Creates a new Huffman codec with specified limit and entropy threshold equal to 0.999.Huffman(int maxDecodingTableLength, double entropyThreshold)
Creates a new Huffman codec with specified limit and entropy threshold.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Codec.Huffman.Coder
getCoder(it.unimi.dsi.fastutil.longs.Long2LongMap frequencies)
Returns a coder for a specific map from symbols to frequencies.
-
-
-
Constructor Detail
-
Huffman
public Huffman(int maxDecodingTableLength, double entropyThreshold)
Creates a new Huffman codec with specified limit and entropy threshold.- Parameters:
maxDecodingTableLength
- a hard limit for the length of the decoding table.entropyThreshold
- the decoding table will be truncated if the accumulated entropy (starting from the most frequent symbols) exceeds this fraction of the overall entropy.
-
Huffman
public Huffman(int maxDecodingTableLength)
Creates a new Huffman codec with specified limit and entropy threshold equal to 0.999.- Parameters:
maxDecodingTableLength
- a hard limit for the length of the decoding table.
-
Huffman
public Huffman()
Creates a new Huffman codec no length limitations.
-
-
Method Detail
-
getCoder
public Codec.Huffman.Coder getCoder(it.unimi.dsi.fastutil.longs.Long2LongMap frequencies)
Description copied from interface:Codec
Returns a coder for a specific map from symbols to frequencies.Note that even instantaneous codes (such as
Codec.Unary
) need to know the set of symbols, as the returned coder needs to known the maximum codeword length.
-
-