Class HuffmanEncodingMetadata<T>
- Namespace
- AiDotNet.ModelCompression
- Assembly
- AiDotNet.dll
Metadata for Huffman encoding compression.
public class HuffmanEncodingMetadata<T> : ICompressionMetadata<T>
Type Parameters
TThe numeric type.
- Inheritance
-
HuffmanEncodingMetadata<T>
- Implements
- Inherited Members
Remarks
For Beginners: This metadata stores the information needed to decompress Huffman-encoded weights: - The Huffman tree (for decoding variable-length codes back to values) - The encoding table (mapping values to their codes, used during compression) - The original length and bit length (for proper reconstruction)
Huffman encoding is lossless - you get exactly the original values back when decompressing.
Constructors
HuffmanEncodingMetadata(HuffmanNode<T>, NumericDictionary<T, string>, int, int)
Initializes a new instance of the HuffmanEncodingMetadata class.
public HuffmanEncodingMetadata(HuffmanNode<T> huffmanTree, NumericDictionary<T, string> encodingTable, int originalLength, int bitLength)
Parameters
huffmanTreeHuffmanNode<T>The Huffman tree used for encoding.
encodingTableNumericDictionary<T, string>The encoding table mapping values to codes.
originalLengthintThe original length of the weights vector.
bitLengthintThe length of the encoded bit stream.
Properties
BitLength
Gets the length of the encoded bit stream.
public int BitLength { get; }
Property Value
EncodingTable
Gets the encoding table mapping values to codes.
public NumericDictionary<T, string> EncodingTable { get; }
Property Value
HuffmanTree
Gets the Huffman tree used for encoding.
public HuffmanNode<T> HuffmanTree { get; }
Property Value
- HuffmanNode<T>
OriginalLength
Gets the original length of the weights vector.
public int OriginalLength { get; }
Property Value
Type
Gets the compression type.
public CompressionType Type { get; }
Property Value
Methods
GetMetadataSize()
Gets the size in bytes of this metadata structure.
public long GetMetadataSize()