Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.physics > #626049
| From | Jeff-Relf.Me @. |
|---|---|
| Newsgroups | comp.os.linux.advocacy, sci.physics, comp.lang.c++ |
| Subject | 21 lines, 74 columns, no macros. |
| Date | 2017-03-30 20:21 -0700 |
| Organization | MB-NET.NET for Open-News-Network e.V. |
| Message-ID | <Jeff-Relf.Me@Mar.30--8.21P.Seattle.2017> (permalink) |
| References | (1 earlier) <obii4i$m36$1@dont-email.me> <njtpdc5354qqii10m80t3htjglscka44rs@4ax.com> <obj166$7rj$3@dont-email.me> <Jeff-Relf.Me@Mar.30--1.07P.Seattle.2017> <obk7sg$det$4@dont-email.me> |
Cross-posted to 3 groups.
You ( DFS ) asked me:
> > What does "spent energy" have to do with compression ? ! nothing.
>
> What's all this overmedicated rambling about?
"Shannon Entropy" is misnomer, and I've no use for it.
> It's a tiny program - around 50 lines probably
Yours was 62 lines, 90 columns, not counting the #includes;
mine is 21 lines, 74 columns, no macros, Sh() is printf( L"\n" ); to wit:
int Len, _Len, Row, Cnt ; float Dist, BitsRow, Bits ;
wchar_t TheCh, Data[] = L"Abbcccdddd1223334444" ;
Row = Bits = 0, Len = sizeof Data / sizeof *Data - 1 ;
Sh( L"%d Glyphs in \" %s \".", Len, Data );
Sh();
Sh( L" # Glyph Cnt Dist D*log2(D) H(X) sum ");
Sh( L" -- ----- --- ------ --------- ---------- ");
Row: Row++, _Len = Len, TheCh = Cnt = 0 ;
while( --_Len >= 0 ) { wchar_t &aCh = Data[ _Len ];
if ( !aCh ) continue ; if ( !TheCh ) TheCh = aCh ;
if ( aCh == TheCh ) aCh = 0, Cnt++ ; }
if ( !Cnt ) goto Done ;
Dist = float( Cnt )/Len, BitsRow = Dist*log2f( Dist ), Bits += BitsRow ;
Sh( L" %d %c %d %.3f %.3f %.5f ",
Row, TheCh, Cnt, Dist, BitsRow, -1*Bits ); goto Row ;
Done: Sh();
Sh( L" Shannon Entropy: %.5f bits. ", -1*Bits );
Sh( L" Metric Entropy: %.5f bits per Glyph. ", -1*Bits / Len );
// 20 Glyphs in " Abbcccdddd1223334444 ".
//
// # Glyph Cnt Dist D*log2(D) H(X) sum
// -- ----- --- ------ --------- ----------
// 1 A 1 0.050 -0.216 0.21610
// 2 b 2 0.100 -0.332 0.54829
// 3 c 3 0.150 -0.411 0.95883
// 4 d 4 0.200 -0.464 1.42322
// 5 1 1 0.050 -0.216 1.63932
// 6 2 2 0.100 -0.332 1.97151
// 7 3 3 0.150 -0.411 2.38205
// 8 4 4 0.200 -0.464 2.84644
//
// Shannon Entropy: 2.84644 bits.
// Metric Entropy: 0.14232 bits per Glyph.
Back to sci.physics | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I found a CostFree INN ( Usenet ) server that allows HTML. Jeff-Relf.Me @. - 2017-03-30 01:54 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-03-30 11:14 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-03-30 07:38 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. chrisv <chrisv@nospam.invalid> - 2017-03-30 07:17 -0500
No _serious programming language lacks "evil" macros ! ! Jeff-Relf.Me @. - 2017-03-30 13:07 -0700
21 lines, 74 columns, no macros. Jeff-Relf.Me @. - 2017-03-30 20:21 -0700
Re: No _serious programming language lacks "evil" macros ! ! Juha Nieminen <nospam@thanks.invalid> - 2017-04-03 06:12 +0000
No _serious programming language lacks "evil" macros ! ! Jeff-Relf.Me @. - 2017-04-03 00:42 -0700
Re: No _serious programming language lacks "evil" macros ! ! Juha Nieminen <nospam@thanks.invalid> - 2017-04-04 06:08 +0000
Re: No _serious programming language lacks "evil" macros ! ! Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-04 09:06 -0400
Re: No _serious programming language lacks "evil" macros ! ! Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-04 09:08 -0400
You know it's inlined when you can't set a break point on it. Jeff-Relf.Me @. - 2017-04-04 10:47 -0700
Re: You know it's inlined when you can't set a break point on it. Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-04 14:08 -0400
Re: No _serious programming language lacks "evil" macros ! ! chrisv <chrisv@nospam.invalid> - 2017-04-04 07:23 -0500
Re: No _serious programming language lacks "evil" macros ! ! Silver-Tongued Heel <sl@im.er> - 2017-04-04 12:43 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. "jasper@shared-secrets.com" <jasper@shared-secrets.com> - 2017-04-10 00:58 +0000
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 08:36 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. chrisv <chrisv@nospam.invalid> - 2017-04-10 06:51 -0500
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 08:12 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 14:22 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 12:10 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 19:48 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. snipeco.2@gmail.com (Sn!pe) - 2017-04-10 19:12 +0100
Re: I found a CostFree INN ( Usenet ) server that allows HTML. chrisv <chrisv@nospam.invalid> - 2017-04-10 13:38 -0500
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 15:14 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Chris Ahlstrom <OFeem1987@teleworm.us> - 2017-04-10 18:52 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 19:22 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 15:13 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Snit <usenet@gallopinginsanity.com> - 2017-04-10 13:04 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2017-04-10 22:07 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. chrisv <chrisv@nospam.invalid> - 2017-04-10 07:48 -0500
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 12:11 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Nomen Nescio <nobody@dizum.com> - 2017-04-11 07:33 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Snit <usenet@gallopinginsanity.com> - 2017-04-10 09:48 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 19:46 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Snit <usenet@gallopinginsanity.com> - 2017-04-10 11:05 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Cornelis Tromp <nobody@holland.remailer.nl> - 2017-04-11 06:41 +0100
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 08:12 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 14:22 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 12:13 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 19:44 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Snit <usenet@gallopinginsanity.com> - 2017-04-10 11:13 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Silver-Tongued Heel <sl@im.er> - 2017-04-10 15:17 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Snit <usenet@gallopinginsanity.com> - 2017-04-10 12:36 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Peter Köhlmann <peter-koehlmann@t-online.de> - 2017-04-10 23:29 +0200
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Snit <usenet@gallopinginsanity.com> - 2017-04-10 14:41 -0700
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Chris Ahlstrom <OFeem1987@teleworm.us> - 2017-04-10 18:48 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Anonymous <anonymous@foto.nl1.torservers.net> - 2017-04-10 07:08 -0400
Re: I found a CostFree INN ( Usenet ) server that allows HTML. Fritz Wuehler <fritz@spamexpire-201704.rodent.frell.theremailer.net> - 2017-04-10 13:53 +0000
csiph-web