# Geometric Huffman Coding

Dyadic probability mass functions (PMFs) can be generated by parsing a stream of independent equiprobable data bits by a full prefix-free code. Formally, is dyadic if , and . Such a PMF is generated by a prefix-free code with codeword lengths . To match dyadic PMFs to communication channels, the Kullback-Leibler distance between the dyadic PMF and the capacity achieving PMF of the considered channel has to be minimized. See Matching Dyadic Distributions to Channels for details. On this web site I provide implementations of algorithms that find the optimal dyadic PMF.

# References

- G. Böcherer, PhD thesis, 2012, Capacity Achieving Probabilistic Shaping for Noisy and Noiseless Channels
- G. Böcherer, F. Altenbach, M. Malsbender, R. Mathar, Writing on the Facade of RWTH ICT Cubes: Cost Constrained Geometric Huffman Coding, best paper award ISWCS 2011, Aachen.
- G. Böcherer and R. Mathar, Matching Dyadic Distributions to Channels, presented at DCC 2011, Snowbird.

# Geometric Huffman Coding (GHC)

Given is a vector with non-negative entries. If additionally the entries sum up to one, than is a PMF. The objective is to minimize

subject to is a dyadic PMF. Geometric Huffman Coding (GHC) finds the dyadic PMF that minimizes . GHC constructs a Huffman tree using the following updating rule. Denote by and the two smallest entries of . Then

.

For comparison, conventional Huffman coding finds the dyadic PMF that minimizes (minimization is here over the second argument) by using the updating rule .

ghc.m in matching.tar is a Matlab implementation of GHC.

# Normalized Geometric Huffman Coding (nGHC)

Given is a target vector with non-negative entries and a weight vector with strictly positive entries. The objective is to minimize the Kullback-Leibler distance normalized by the average weight , i.e., to minimize the fraction

subject to is a dyadic PMF. Normalized Geometric Huffman Coding (nGHC) iteratively finds the solution. nGHC supersedes the LEC Algorithm stated in Matching Dyadic Distributions to Channels.

`nghc.m`

in matching.tar is a Matlab implementation of nGHC.

# Cost Constrained Geometric Huffman Coding (ccGHC)

Given is a target vector with non-negative entries and a weight vector with strictly positive entries. The objective is to minimize the Kullback-Leibler distance subject to an average cost constraint over all dyadic PMFs . Cost Constrained Geometric Huffman Coding (ccGHC) iteratively finds the solution.

`ccghc.m`

in matching.tar is a Matlab implementation of ccGHC.

# Example 1

# Example 2

`example2.m`

:

Output: