Table of Contents

Class HuffmanEncodingMetadata<T>

Namespace
AiDotNet.ModelCompression
Assembly
AiDotNet.dll

Metadata for Huffman encoding compression.

public class HuffmanEncodingMetadata<T> : ICompressionMetadata<T>

Type Parameters

T

The 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

huffmanTree HuffmanNode<T>

The Huffman tree used for encoding.

encodingTable NumericDictionary<T, string>

The encoding table mapping values to codes.

originalLength int

The original length of the weights vector.

bitLength int

The length of the encoded bit stream.

Properties

BitLength

Gets the length of the encoded bit stream.

public int BitLength { get; }

Property Value

int

EncodingTable

Gets the encoding table mapping values to codes.

public NumericDictionary<T, string> EncodingTable { get; }

Property Value

NumericDictionary<T, string>

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

int

Type

Gets the compression type.

public CompressionType Type { get; }

Property Value

CompressionType

Methods

GetMetadataSize()

Gets the size in bytes of this metadata structure.

public long GetMetadataSize()

Returns

long