home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.compression
- 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
- From: daf10@po.CWRU.Edu (David A. Ferrance)
- Subject: more entropy
- Message-ID: <1992Jul23.174740.14559@usenet.ins.cwru.edu>
- Sender: news@usenet.ins.cwru.edu
- Nntp-Posting-Host: cwns2.ins.cwru.edu
- Reply-To: daf10@po.CWRU.Edu (David A. Ferrance)
- Organization: Case Western Reserve University, Cleveland, OH (USA)
- Date: Thu, 23 Jul 92 17:47:40 GMT
- Lines: 21
-
-
- If I have an unsigned int count[256][256], what is wrong with
- calculating entropy like this:
-
- for (i=0;i<256;i++) for (j=0;j<256;j++) {
- freq = count[i][j] / total;
- ent += freq * log10(1/freq) / 0.30103;
- }
- Where total and ent are doubles, total is the # of bytes total, ent
- starts off as 0, and the values of the array are the # of occurances of
- each 2 letter combination?
-
- I get values > 8.
-
- Any help appreciated,
- Dave
- --
- David Ferrance Sigma Nu Delta Alpha 1061 daf10@po.cwru.edu
-
- And on the seventh day, He exited from append mode.
-