[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
huffmandict: Matlab compatibility, Matlab bugs..
From: |
Muthiah Annamalai |
Subject: |
huffmandict: Matlab compatibility, Matlab bugs.. |
Date: |
Thu, 05 Oct 2006 14:59:09 -0500 |
Hi there,
Im trying to write some functions in Matlab communication toolbox
(source coding functions) for Octave forge.
While I was doing that, I came across a funny bug in Matlab.
Huffman encoding is done in 2 steps (according to Matlab),
and the first step generates dictionary.
Essentially all Huffman coding does it map low probability symbols
to long codewords and vice-verca.
So the wierd thing (in Matlab impl) is that for 0-probability symbols
have long code words assigned to them. I wonder... why someone will
infact even have a zero probability symbols occur in their data?
A conceptual error of the user is magnified in the matlab implementation
and it assigns long really long codewords to 0 prob' symbols.
Im just assigning an empty matrix to that, which I think is logical.
try the code using Octave forge functions(CVS) & matlab.
prob=[0.5 0 0.3 0.2 0];
x=huffmandict(1:5,prob);
x{:}
What do you think?
Thanks
Muthu
- huffmandict: Matlab compatibility, Matlab bugs..,
Muthiah Annamalai <=