Constant Composition Distribution Matching At Play.
The Matlab Package can be downloaded here:
Please cite the use of this package in any publication as:
P. Schulte, F. Steiner, G. Böcherer. “shapecomm WebDM: Online constant composition distribution matcher”, URL: http://dm.shapecomm.de/
The employed algorithm is detailed in:
P. Schulte and G. Böcherer, “Constant Composition Distribution Matching,” IEEE Trans. Inform. Theory, vol. 62, no. 1, pp. 430–434, Jan. 2016.
Download the Shapecomm webdm
package and unzip the corresponding zip file. After unpacking, the folder
+shapecomm will be created. At this point, you are ready to start.
If you want to access the package from any directory, the current directory has to be added
to your MATLAB path permanently. This can be done by:
>>> addpath(pwd); >>> savepath;
>>> denotes your MATLAB prompt.
For the first run, we specify the properties of our DM object. In the following, we aim at having a 4-ary output alphabet and output length of 150 symbols, while ensuring a rate of 1.5 bits per output symbol:
>>> M = 4; >>> n = 100; >>> rate = 1.5; >>> dm = shapecomm.webdm(M, n, rate);
dm object now has the following properties:
webdm with properties: k: 150 n: 100 M: 4 pA: [4×1 double] type_seq: [4×1 double] host: 'http://dm.shapecomm.de' num_retries: 10
The properties have the following meaning:
k: number of input bits
n: number of output symbols
M: size of output alphabet (four amplitudes)
pA: empirical distribution on the output symbols
type_seq: number of occurances of each output symbol
host: server address
num_retries: retries for encode or decode queries (in case of interupted connections)
We then create uniform input bits and pass them to the encode function:
>>> bits = randi([0 1], [dm.k 1]); >>> symbols = dm.encode(bits); >>> symbols
We can obtain the original bit-stream by passing the symbols to the DM decoder method:
>>> bits_out = dm.decode(symbols); >>> sum(bits_out ~= bits) 0
The full documentation can be downloaded here: