Re: A Random Data Compression method -draft #7

There with the eggs down my throat and stummie it's now time for the move to 
front to perform it's miracles ;) :)

Let's see... where's my input:

Random input:

 1  2  3  4  5  6  7  8  9  10 11 12
11 10 10 01 01 10 11 01 01 01 01 01

Ok... man...

Now for the table which will always stay the same as according to the 
original mtf algo:

[0, 10, 110, 111]

OK, now for the initial table for the values:

[00, 01, 10, 11]

And now the encoding begins:

1: 11 -> 111   table-> [11, 00, 01, 10]
2: 10 -> 111   table-> [10, 11, 00, 01]
3: 10 -> 0     table-> [10, 11, 00, 01]
4: 01 -> 111   table-> [01, 10, 11, 00]
5: 01 -> 0     table-> [01, 10, 11, 00]
6: 10 -> 10    table-> [10, 01, 11, 00]
7: 11 -> 110   table-> [11, 10, 01, 00]
8: 01 -> 110   table-> [01, 11, 10, 00]
9: 01 -> 0     table-> [01, 11, 10, 00]
10: 01 -> 0     table-> [01, 11, 10, 00]
11: 01 -> 0     table-> [01, 11, 10, 00]
12: 01 -> 0     table-> [01, 11, 10, 00]

Final result: 6x1 + 1x2 + 5x3 bits = 23 bits.

Input was 24 bits, 1 bit saved therefore... not bad.
Much better than huffman code at least for this short code.

Perhaps recursive encoding might provide further compression, let's try:
Endings will be padded with zero's.

Output from last round:

 1  2  3  4  5  6  7  8  9 10 11 12
11 11 11 01 11 01 01 10 11 00 00 00

table[00,01,10,11]

1: 11->111  table->[11,00,01,10]
2: 11->0    table->[11,00,01,10]
3: 11->0    table->[11,00,01,10]
4: 01->110  table->[01,11,00,10]
5: 11->10   table->[11,01,00,10]
6: 01->10   table->[01,11,00,10]
7: 01->0    table->[01,11,00,10]
8: 10->111  table->[10,01,11,00]
9: 11->110  table->[11,10,01,00]
10: 00->111  table->[00,11,10,01]
11: 00->0    table->[00,11,10,01]
12: 00->0    table->[00,11,10,01]

Result of round2: 5x1 + 2x2 + 5x3 = 24 bits.

Back to square one again ! ;) :)

Unless we leave last code at 1 bit hehe.

Now purely for my own interest I will give the bubble to front a try to see 
how it performs:

Random input:

 1  2  3  4  5  6  7  8  9  10 11 12
11 10 10 01 01 10 11 01 01 01 01 01

table[00, 01, 10, 11]

1: 11->111   table->[00,01,11,10]
2: 10->111   table->[00,01,10,11]
3: 10->110   table->[00,10,01,11]
4: 01->110   table->[00,01,10,11]
5: 01->10    table->[01,00,10,11]
6: 10->110   table->[01,10,00,11]
7: 11->111   table->[01,10,11,00]
8: 01->0     table->[01,10,11,00]
9: 01->0     table->[01,10,11,00]
10: 01->0     table->[01,10,11,00]
11: 01->0     table->[01,10,11,00]
12: 01->0     table->[01,10,11,00]

BubbleToFront Result: 5x1 + 1x2 + 6x3 = 25 bits

Slightly worse... then input.

Let's do bubble to front one more time just to see what happens:

 1  2  3  4  5  6  7  8  9 10 11 12 13
11 11 11 11 01 10 10 11 01 11 00 00 00

table[00,01,10,11]

1: 11->111   table->[00,01,11,10]
2: 11->110   table->[00,11,01,10]
3: 11->10    table->[11,00,01,10]
4: 11->0     table->[11,00,01,10]
5: 01->110   table->[11,01,00,10]
6: 10->111   table->[11,01,10,00]
7: 10->110   table->[11,10,01,00]
8: 11->0     table->[11,10,01,00]
9: 01->110   table->[11,01,10,00]
10: 11->0    table->[11,01,10,00]
11: 00->111  table->[11,01,00,10]
12: 00->110  table->[11,00,01,10]
13: 00->10   table->[00,11,01,10]

Result for round 2 of bubble: 3x1 + 2x2 + 8x3 = 31 bits

A big increase for bubble... so bubble is d.e.a.d for this case at least ;) 
:)

Pretty cool... maybe in next post I try his switch idea in table form ;) :)

Bye,
  Skybuck. 


0
Skybuck
1/10/2011 8:55:56 PM
comp.compression 4601 articles. 0 followers. Post Follow

0 Replies
356 Views

Similar Articles

[PageSpeed] 21
Reply:
Similar Artilces:

Re: ot
A very good all purpose server product of this nature that I have extensi= ve=20 experience with is FirstClass (www.firstclass.com). * To join/leave the list, search archives, change list settings, * * etc., please visit http://raven.utc.edu/archives/hp3000-l.html * ...

Re: Out of Area Calls #17
bonomi@host122.r-bonomi.com (Robert Bonomi) writes: > pointed out that the law made *no* such provision for delay on an > -internally-maintained- list, and required that they update my > _customer_record_ with a note that 'customer has ordered us -never- to > make marketing calls to him', and the date/time. Three days later, > somebody "didn't read" the notes, and called me. I promptly demanded > a supervisor, had them read the account 'notes', and asked if they > wanted to pay the statutory $500 minimum, or if I needed to go to &g...

Re: Creating a new variable? #4
Hi, Yes, you can do it easily. This is one solution: Proc sort data=3DTab1; by Id; run; Data Tab1; set Tab1; by Id; retain INC 0; if first.Id then INC=3D0; Inc=3Dinc+1; run; Le 16:01 7/02/2006, vous avez =E9crit: >Hi > >I have alarge data set in which I have a unique ID, for each id there are= 49 >observations, now I want to create a new variable which would be equal to 1 >for first observation and increment in steps of 1 to 49 and then reset to 1 >and continue. is there a way of doing this? > >thanks > >Vj Alexandre BAUDRY Unit=E9...

RE: Question to Kerry Main
> -----Original Message----- > From: JF Mezei [mailto:jfmezei.spamnot@vaxination.ca] > Sent: June 30, 2007 8:31 PM > To: Info-VAX@Mvb.Saic.Com > Subject: Question to Kerry Main >=20 > Mr Main, your arguments on c.o.v. are often rebutted as part of normal > debating process. (And you rebutt other arguments with your own > responses). >=20 > In real life, do you also find customers and potential customers > having > similar questions ? Or do you conclude that we, in c.o.v. are a > sepcial > bunch living in a totally different universe without a clue...

ruby 1.8.7 on Mac OS X Tiger ?
does someone knows how to install ruby 1.8.7 on Mac OS X Tiger ? this version is needed by Nokogiri. -- � Face au monde qui bouge, il vaut mieux penser le changement que changer le pansement ! � (Francis Blanche) ...

Re: Really Frustrating -9628 Errors #2
On Thu, 2005-11-17 at 14:23 -0500, Adam Tauno Williams wrote: > We've written several Informix stored procedures that return MULTISET as > the type; the application than does a SELECT a,b,c FROM > TABLE({procedurename}({parameterlist...})). And these WORK!!! But only > for awhile, the next day, or after a couple of days suddenly they stop > working - and they haven't been changed. They simply start to bomb out > with a -9628 (type not found) error for any SQL statement like the > above. > We are using "IBM Informix Dynamic Server Version 10.00...

Re: String question #6
As Howard example shows the last observation passed incorrectly, Is there a reason why the third observation(123 12) did not pass incorrectly. Is that a length issue or something different? On Thu, 1 May 2008 09:50:19 -0400, Howard Schreier <hs AT dc-sug DOT org> <schreier.junk.mail@GMAIL.COM> wrote: >On Thu, 1 May 2008 08:16:37 -0400, Richard A. DeVenezia ><rdevenezia@WILDBLUE.NET> wrote: > >>Dominic Mitchell wrote: >>> input var1 var2 $6.; >>> cards; >>> 99 9982 >>> 998 998 >>> ; >> >>The INPUT statem...

Re: More SQL simplification
Roger: In your version of the query, SAS 'remerges' summarized values back to the original dataset. It actually works the same as the query that joins a view to the original dataset. The simpler form of the query does not in general across different flavors of SQL. Sig -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Roger Lustig Sent: Tuesday, September 14, 2004 7:12 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: More SQL simplification Pat: You've answered your own question! No reason you can't do a GROUP BY while selecting colum...

Re: question about data values #11
Howdy Toby - The V9 compress function has new useful modifiers to handle all numbers, all letters, typewriter characters etc. http://xrl.us/gk8j In this case D is for digits 0-9 and K is for Keep (rather than compress). 10 data _null_ ; 11 x = 'A1234' ; 12 y = input(compress(x,'','DK'),5.0); 13 put x= y= ; 14 run ; x=A1234 y=1234 regards as always - Paul Choate DDS Data Extraction (916) 654-2160 -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of toby dunn Sent: Monday, June 27, 2005 4:41 PM To: SAS-L@...

Re:
This is an autoresponder. I'll never see your message. ...

Re: How to obtain FrameTicks List from an existing Plot?
t = Range[5]; p = ListPlot[t, Frame -> True]; FrameTicks /. AbsoluteOptions[p] Bob Hanlon ---- Nasser Abbasi <nma@12000.org> wrote: ============= I have a need to obtain the FrameTicks list from an existing plot. The reason I want to do this, is because I need to slightly modify the ticks, and then redraw the plot with the new Ticks. This would be much easier than having to generate the Ticks myself in the first place. This is an example: t = Range[5]; p = ListPlot[t, Frame -> True] But when I look at FullForm[p], I see no list would would look like the...

Re: [HP3000-L] Save and Re-Use a File Equation
Jay writes: > What I'd like to do is to save the file equation with the parameters the > user entered, and then re-use that file equation after the checks are > printed. Like this: > > 1. Enter printer name, etc for reports > 2. Submit job, which does: > a. file report;dev=<parameters from 1 above> > b. run program A > c. file print=checks;dev=lp;forms=mount checks > d. run program B to print checks > e. file report;dev=<parameters from 1 above> > f. run program C to create report to print on printer ...

Re: array label question #9
Here's another approach. conceptually similar to the previous posts..... data _null_; %let colmns = ; do yr = 2007,2008; do qtr = 1 to 4; do channel_cd = 1 to 3; do Incentive_Type = 1,2; call symput ('colmns', symget ('colmns') || ' ' || '_' || catx('_',yr,qtr,channel_Cd,Incentive_Type)); end; end; end; end; run; data transpose (drop = yr qtr channel_cd incentive_type contacts) ; format &colmns best32.; array all [2007:2008, 1:4, 1:3, 1:2] _all_; do until(last.indiv_id) ; set have; by indiv_id; all{yr,qtr,ch...

Re: Question re Canon iP1500 #2
Been busy for a few days, so didn't get a chance to get back here. But need to ask about your message below. "zakezuke" <zakezuke_us@yahoo.com> wrote in message news:1144285405.300198.236870@j33g2000cwa.googlegroups.com... > > Do y ou mean I could fix the problem of the waste ink absorber myself? I > > thought you can't see it by just looking into the printer > > The waste counter you can reset with the service tool QY9-0066 as Tony > explained. You can get it here > http://www.printersiam.com/data/download/iP1500%20Service%20Tool.zi...

Rolling 24 months data
I have rolling 24 months data as follows: Mth1-Mth24 with numeric values at ID level. Mth24 is the most current month. I want the Current Years YTD(CY_YTD) and Prev. Years YTD (PY_YTD) values based on the current month. I am using the logic as below. Is there any better way to do this? th rolling 24 %let curdate = today(); Format mnth $2.; Mnth = put(month(&curdate.) ,z2.) ; If Mnth = "01" then do; CY_YTD = Mth24; PY_YTD = Mth12; end; If Mnth = "02" then do; CY_YTD = sum(of Mth23-Mth24); PY_YTD = sum(of Mth11-Mth12);...

Re: own package doesnt work correctly?
Martin, Symbols like x and I are set up in the package`Private` context once you put the definition inside the package. So they won't match Global`x or Global`I in a notebook using the package. You could either add the Global` context to these symbols in the package, or better yet pass them as parameters to the rule. partintrulx[x_,I_]:= ..... David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: Martin [mailto:ms_usenet@gmx.de] Hello, I started to - try to - use packages written on my own, using the Notebook editor, marking the cells as initializa...

Re: Now That They're Mounted ... #9
Correct me if I'm wrong, but MPE does not provide automatic failover in the event a controller dies. Yes, you can connect 2 controllers, but one won't take over for the other in the event of failure. That's an important distinction to recognize. John Lee Vaske Computer Solutions At 03:35 PM 8/18/04 -0400, Gilles Schipper wrote: >At 03:20 PM 2004-08-18, you wrote: >>O.K. two brain farts. Can't have more than 7 logical drives. > > >The mod20 supports up to 8 luns or logical drives. > > >>And you can't split the SCSI, (and u...

Re: Apple's iPod Raises Bar For Digital Music Players
Hey- Check out this great site that is giving away totally FREE iPods! I've joined and I think you should as well. It's a completely legitimate offer, and this company has already given away $4 million in FREE stuff! All you have to do is join, complete an online offer, and refer friends to do the same. That's it! Here is my referral link. To help me get my iPod, click this exact link to join, or copy and paste it into a browser: http://www.freeiPods.com/?r=12703712 Monty Solomon wrote: > Apple's iPod Raises Bar For Digital Music Players > By W...

Re: Call System in UNIX #7 1547219
Dear SAS-L-ers, Michael D. Ross posted the following interesting question: > Hi All, > I'm having trouble with the following code in Unix. It > creates the "dump.txt" file in the specified directory; > however, it has 0 records in it. Any suggestions? > > > > %let progs = /temp/mydir; > > data _null_; > command= " ll &progs *.sas > &progs/dump.txt"; > call system (command); > run; > Michael, I see it! It appears that you are falling prey to a subtle problem in your DATA _NULL_ step. Your problem is with the spac...

Re: New to SAS #2
Here is a very good paper that covers "everything" about learning more about SAS. It lists many resources of varying types, including SAS-L: http://www2.sas.com/proceedings/sugi30/147-30.pdf -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of sfitzpatrick76@googlemail.com Sent: January 14, 2008 3:11 PM To: SAS-L@LISTSERV.UGA.EDU Subject: New to SAS I'm new to SAS and Data Extraction generally, does anyone have any hints, tips or advice that might be useful? I'm interested in: related websites, programming languages, programmes, b...

Re: Thanks Harry Re: SAS Data Step Qn.
Use Eric's solution, it's cleaner. -----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]On Behalf Of Jeff Morison Sent: Tuesday, August 09, 2005 3:03 PM To: Droogendyk, Harry; SAS-L@LISTSERV.UGA.EDU Subject: Thanks Harry Re: SAS Data Step Qn. This worked out perfectly Harry, thanks very much. --- "Droogendyk, Harry" <harry.droogendyk@RBC.COM> wrote: > data a; > input HRN : CDATE : date7. STAGE : > start : stop; > format cdate date9.; > cards; > 609 21JUL03 2 307 ...

Re: OT:Boys,Its Cold Outside #15
>While at K I Sawyer AFB, 74-77, there was discussion of Northern Michigan >becoming a seperate state. They though it was a SUPERIOR idea. I remember that - I come from Northwestern Wisconsin, and as I recall it was Upper Penninsula Michigan and the Northern Wisconsin wanted to combine and form a new state. I think that they actually wanted to call the state "Superior". In the pre-cable days, the only television we could get in were Minnesota stations. Couldn't even get in the Packer games unless they were playing the Vikings. If you didn't know that ther...

RE: Re: corrected RE: Re: Computing sets of equivalences #2
This was all nonsense, >-----Original Message----- >From: Wolf, Hartmut >Sent: Wednesday, February 25, 2004 3:05 AM >To: mathgroup@smc.vnet.net >Subject: Re: corrected RE: Re: >Computing sets of >equivalences > > > >Bobby, > >it took me a while to discern what you added to Carl's >algorithm. It's the >line where you map addequiv over the rest of the argument sequence. > >But it is not at all obvious to do so, since in effect you do >not built on >the work done, but, in a way restore equivalences, which w...

Re: Canada to Criminalize Watching Foreign TV and Radio #2
On Mon, 10 May 2004 cfarrar@spamcop.net wrote: > Ex-patroit and "snowbird" Canadians are know to take Bell ExpressVu > satellite receivers down to their winter homes in Florida, South > Carolina, and Nevada so they can received CBC and other "home" > programming. However. Bell isn't licenced for use in the US and the > FCC could just as easily start seizing their receivers. There is nothing illegal under US law in taking your legitimate Bell ExpressVu receivers into the US and using them in the US. -- Mark -- http://staff.washington.edu/...

US-TX-Austin: Sr. Test Lead, 7+yrs total industry exp., 802.11 Mac/related proto (45336332401)
US-TX-Austin: Sr. Test Lead, 7+yrs total industry exp., 802.11 Mac/related proto (45336332401) ============================================================================================== Position: Sr. Test Lead Reference: SMC01893 Location: Austin TX Duration: Perm Skills: Strong verbal and written communication skills Exceptional team and results orientation Deep understanding of networking technology in the LAN, WLAN or Telecom fields both at the client station and the infrastructure levels. ...