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

  1. Newsgroups: comp.compression
  2. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!rpi!sarah!newserve!bingsuns!kym
  3. From: kym@bingsuns.cc.binghamton.edu (R. Kym Horsell)
  4. Subject: Re: more entropy
  5. Message-ID: <1992Jul24.195733.3757@newserve.cc.binghamton.edu>
  6. Sender: usenet@newserve.cc.binghamton.edu (Mr News)
  7. Nntp-Posting-Host: bingsuns.cc.binghamton.edu
  8. Organization: State University of New York at Binghamton
  9. References: <1992Jul23.174740.14559@usenet.ins.cwru.edu> <1992Jul24.003709.21603@s1.gov>
  10. Date: Fri, 24 Jul 1992 19:57:33 GMT
  11. Lines: 17
  12.  
  13. In article <1992Jul24.003709.21603@s1.gov> lip@s1.gov (Loren I. Petrich) writes:
  14. >In article <1992Jul23.174740.14559@usenet.ins.cwru.edu> daf10@po.CWRU.Edu (David A. Ferrance) writes:
  15. >
  16. >>If I have an unsigned int count[256][256], what is wrong with
  17. >>calculating entropy like this:
  18. >
  19. >>for (i=0;i<256;i++) for (j=0;j<256;j++)  {
  20. >>    freq = count[i][j] / total;
  21. >>    ent += freq * log10(1/freq) / 0.30103;
  22. >>    }
  23. >    Yes, some versions of C do have a "log2" function (logarithm
  24. >to base two).
  25.  
  26. But the choice of log10 is somewhat ``unusual'' given M_LN2 is
  27. typically in math.h.
  28.  
  29. -kym
  30.