home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / compress / 2789 < prev    next >
Encoding:
Text File  |  1992-07-23  |  1.1 KB  |  33 lines

  1. Newsgroups: comp.compression
  2. Path: sparky!uunet!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!po.CWRU.Edu!daf10
  3. From: daf10@po.CWRU.Edu (David A. Ferrance)
  4. Subject: more entropy
  5. Message-ID: <1992Jul23.174740.14559@usenet.ins.cwru.edu>
  6. Sender: news@usenet.ins.cwru.edu
  7. Nntp-Posting-Host: cwns2.ins.cwru.edu
  8. Reply-To: daf10@po.CWRU.Edu (David A. Ferrance)
  9. Organization: Case Western Reserve University, Cleveland, OH (USA)
  10. Date: Thu, 23 Jul 92 17:47:40 GMT
  11. Lines:       21
  12.  
  13.  
  14. If I have an unsigned int count[256][256], what is wrong with
  15. calculating entropy like this:
  16.  
  17. for (i=0;i<256;i++) for (j=0;j<256;j++)  {
  18.     freq = count[i][j] / total;
  19.     ent += freq * log10(1/freq) / 0.30103;
  20.     }
  21. Where total and ent are doubles, total is the # of bytes total, ent
  22. starts off as 0, and the values of the array are the # of occurances of
  23. each 2 letter combination?
  24.  
  25. I get values > 8.
  26.  
  27.             Any help appreciated,
  28.               Dave
  29. -- 
  30. David Ferrance       Sigma Nu Delta Alpha 1061     daf10@po.cwru.edu
  31.  
  32.          And on the seventh day, He exited from append mode.
  33.