Main Page | Report this Page
 
   
Science Forum Index  »  Compression Forum  »  Unary Representation
Page 1 of 1    
Author Message
Fibonacci Code
Posted: Tue Feb 19, 2008 2:55 am
Guest
Hi All,


Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

FYI, unary coding

1 0
2 10
3 110
4 1110
5 11110
......

If I had a binary string of 111100001010011
Unary representation is 111011100001010

But if I had binary string of 000011110101100 (Inverse of
111100001010011)
Unary representation is 111011100001010

Hence both of the string 111100001010011 and 000011110101100 were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray
biject
Posted: Tue Feb 19, 2008 5:57 am
Guest
On Feb 19, 5:55 am, Fibonacci Code <angli...@gmail.com> wrote:
Quote:
Hi All,

Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

FYI, unary coding

1 0
2 10
3 110
4 1110
5 11110
......

If I had a binary string of 111100001010011
Unary representation is 111011100001010

But if I had binary string of 000011110101100 (Inverse of
111100001010011)
Unary representation is 111011100001010

Hence both of the string 111100001010011 and 000011110101100 were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray

yes there is you just think of the leading bit as the continuation bit
and every time a
change you chane exmple::
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
opposite excpet ends

This is actually a simple two state mtf where first state seen is zero
which is how I write
MTFQ which is exactly like Marks MTF except zero is first character
seen and so on.You
could all do the sitcgky verion of MTF in binary a simalar way

David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"
biject
Posted: Tue Feb 19, 2008 6:23 am
Guest
On Feb 19, 8:57 am, biject <davvid_a_sc...@email.com> wrote:
Quote:
On Feb 19, 5:55 am, Fibonacci Code <angli...@gmail.com> wrote:



Hi All,

Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

FYI, unary coding

1 0
2 10
3 110
4 1110
5 11110
......

If I had a binary string of 111100001010011
Unary representation is 111011100001010

But if I had binary string of 000011110101100 (Inverse of
111100001010011)
Unary representation is 111011100001010

Hence both of the string 111100001010011 and 000011110101100 were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray

yes there is you just think of the leading bit as the continuation bit
and every time a
change you chane exmple::
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
opposite excpet ends

This is actually a simple two state mtf where first state seen is zero
which is how I write
MTFQ which is exactly like Marks MTF except zero is first character
seen and so on.You
could all do the sitcgky verion of MTF in binary a simalar way

David A. Scott
--
My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jamesd/Kong/scott19u.zipold version
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"

The method I gave above was bijective. However most people here
don't like bijective compression so
here is a non bijective way. Suppose you writing a compression scheme
where you know that
there will alwasy be more zeroes than ones in the files you care
about. If that the case
just use your original methd. At the end when you undo the conversion
you could change by inverting
every bit to its opposite.
if you used such a method
111011100001010 woud convert on reverse to
000011110101100
and the other string would not be a result of your compression since
you
only want strings with more zeros than ones. Hay I don't like this
method
I prefer the first but I see in the standard BWT the goal for many
programers
is to increase the run of zeroes so it might appeal to them and its
not bijective.
Again I would not to this so you might!

David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"
Fibonacci Code
Posted: Tue Feb 19, 2008 6:56 am
Guest
On Feb 20, 12:23 am, biject <davvid_a_sc...@email.com> wrote:
Quote:
On Feb 19, 8:57 am, biject <davvid_a_sc...@email.com> wrote:





On Feb 19, 5:55 am, Fibonacci Code <angli...@gmail.com> wrote:

Hi All,

           Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

           FYI, unary coding

                1          0
                2          10
                3          110
                4          1110
                5          11110
                ......

If I had a binary string of   111100001010011
Unary representation is    111011100001010

But if I had binary string of    000011110101100 (Inverse of
111100001010011)
Unary representation is        111011100001010

Hence both of the string 111100001010011  and   000011110101100  were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray

yes there is you just think of the leading bit as the continuation bit
and every time a
change you chane exmple::
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
opposite excpet ends

This is actually a simple two state mtf where first state seen is zero
which is how I write
MTFQ which is exactly like Marks MTF except zero is first character
seen and so on.You
could all do the sitcgky verion of MTF in binary a simalar way

David A. Scott
--
 My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jame...version
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
 made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"

  The method I gave above was bijective. However most people here
don't like bijective compression so
here is a non bijective way. Suppose you writing a compression scheme
where you know that
there will alwasy be more zeroes than ones in the files you care
about. If that the case
just use your original methd. At the end when you undo the conversion
you could change by inverting
every bit to its opposite.
 if you used such a method
111011100001010  woud convert on reverse to
000011110101100
and the other string would not be a result of your compression since
you
only want strings with more zeros than ones.  Hay I don't like this
method
I prefer the first but I see in the standard BWT the goal for many
programers
is to increase the run of zeroes so it might appeal to them and its
not bijective.
Again I would not to this so you might!

David A. Scott
--
 My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jamesd/Kong/scott19u.zipold version
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
 made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"- Hide quoted text -

- Show quoted text -

Woah,

Really thanks a lot, I never think about that. by
the way you are encoding from the right to left ?
I will do a more detail study on this encoding.

Regards,
Ray
Fibonacci Code
Posted: Tue Feb 19, 2008 8:12 am
Guest
On Feb 20, 12:56 am, Fibonacci Code <angli...@gmail.com> wrote:
Quote:
On Feb 20, 12:23 am, biject <davvid_a_sc...@email.com> wrote:





On Feb 19, 8:57 am, biject <davvid_a_sc...@email.com> wrote:

On Feb 19, 5:55 am, Fibonacci Code <angli...@gmail.com> wrote:

Hi All,

           Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

           FYI, unary coding

                1          0
                2          10
                3          110
                4          1110
                5          11110
                ......

If I had a binary string of   111100001010011
Unary representation is    111011100001010

But if I had binary string of    000011110101100 (Inverse of
111100001010011)
Unary representation is        111011100001010

Hence both of the string 111100001010011  and   000011110101100  were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray

yes there is you just think of the leading bit as the continuation bit
and every time a
change you chane exmple::
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
opposite excpet ends

This is actually a simple two state mtf where first state seen is zero
which is how I write
MTFQ which is exactly like Marks MTF except zero is first character
seen and so on.You
could all do the sitcgky verion of MTF in binary a simalar way

David A. Scott
--
 My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jame...
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
 made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"

  The method I gave above was bijective. However most people here
don't like bijective compression so
here is a non bijective way. Suppose you writing a compression scheme
where you know that
there will alwasy be more zeroes than ones in the files you care
about. If that the case
just use your original methd. At the end when you undo the conversion
you could change by inverting
every bit to its opposite.
 if you used such a method
111011100001010  woud convert on reverse to
000011110101100
and the other string would not be a result of your compression since
you
only want strings with more zeros than ones.  Hay I don't like this
method
I prefer the first but I see in the standard BWT the goal for many
programers
is to increase the run of zeroes so it might appeal to them and its
not bijective.
Again I would not to this so you might!

David A. Scott
--
 My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jame...version
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
 made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"- Hide quoted text -

- Show quoted text -

Woah,

                  Really thanks a lot, I never think about that.  by
the way you are encoding from the right to left ?
                  I will do a more detail study on this encoding.

Regards,
Ray- Hide quoted text -

- Show quoted text -

Hi David,


There is one more question,

---Quote---
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends
different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
---Quote---

If there is a string 11110000101001 (111100001010011 remove trailing
1) according to your way
should I put 1 or put 0 at the first bit ? to my understand, we should
put 0 as next bit is changed.
but if we put 0, how can we know it is start with 1 ?

Please advise.



Ray
biject
Posted: Tue Feb 19, 2008 9:20 am
Guest
On Feb 19, 11:12 am, Fibonacci Code <angli...@gmail.com> wrote:
Quote:
On Feb 20, 12:56 am, Fibonacci Code <angli...@gmail.com> wrote:



On Feb 20, 12:23 am, biject <davvid_a_sc...@email.com> wrote:

On Feb 19, 8:57 am, biject <davvid_a_sc...@email.com> wrote:

On Feb 19, 5:55 am, Fibonacci Code <angli...@gmail.com> wrote:

Hi All,

Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

FYI, unary coding

1 0
2 10
3 110
4 1110
5 11110
......

If I had a binary string of 111100001010011
Unary representation is 111011100001010

But if I had binary string of 000011110101100 (Inverse of
111100001010011)
Unary representation is 111011100001010

Hence both of the string 111100001010011 and 000011110101100 were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray

yes there is you just think of the leading bit as the continuation bit
and every time a
change you chane exmple::
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
opposite excpet ends

This is actually a simple two state mtf where first state seen is zero
which is how I write
MTFQ which is exactly like Marks MTF except zero is first character
seen and so on.You
could all do the sitcgky verion of MTF in binary a simalar way

David A. Scott
--
My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jame...
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"

The method I gave above was bijective. However most people here
don't like bijective compression so
here is a non bijective way. Suppose you writing a compression scheme
where you know that
there will alwasy be more zeroes than ones in the files you care
about. If that the case
just use your original methd. At the end when you undo the conversion
you could change by inverting
every bit to its opposite.
if you used such a method
111011100001010 woud convert on reverse to
000011110101100
and the other string would not be a result of your compression since
you
only want strings with more zeros than ones. Hay I don't like this
method
I prefer the first but I see in the standard BWT the goal for many
programers
is to increase the run of zeroes so it might appeal to them and its
not bijective.
Again I would not to this so you might!

David A. Scott
--
My Crypto codehttp://bijective.dogma.net/crypto/scott19u.ziphttp://www.jim.com/jame...
My Compression codehttp://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"- Hide quoted text -

- Show quoted text -

Woah,

Really thanks a lot, I never think about that. by
the way you are encoding from the right to left ?
I will do a more detail study on this encoding.

Regards,
Ray- Hide quoted text -

- Show quoted text -

Hi David,

There is one more question,

---Quote---
111100001010011 starting string
111101110000101 my way
111011100001010 your way Notive if shifted one bit only ends
different

000011110101100 strting string
000010001111010 my way Notice opposite of my way above
111011100001010 your way Notive if shited one bit every bit exactly
---Quote---

If there is a string 11110000101001 (111100001010011 remove trailing
1) according to your way
should I put 1 or put 0 at the first bit ? to my understand, we should
put 0 as next bit is changed.
but if we put 0, how can we know it is start with 1 ?

Please advise.

Ray

ONLY EXPLAINING THE BIJECTIVE WAY!!
look you always start with the first bit seen if its a 0 then you
have the following
0 0
00 00
000 000 if string only zeros then you output unchanged
..... etc for for more zeros

top ofloop
now for the ones if there are any
1 -1
11 10
111 100
1111 10000
,,,, etc
now if more ones
0 1
00 10
000 100
... etc
if 1's follow go to top till done


if its startes with
fitst time ones is only string of ones
1 1
11 11
111 111
for sets of zero following
0 0
00 01
000 011
.... etc
for ones in the loop
1 0
11 01
111 011
....etc
etc loop as for above example.

11110000101001 becomes
11110111000010

111100001010011 becomes
111101110000101

with ones and zeroes reveresd
00001111010110
00001000111101

000011110101100 becomes
000010001111010

I hope that makes it easier

David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"
biject
Posted: Tue Feb 19, 2008 11:51 am
Guest
On Feb 19, 1:17 pm, inconnu <unkn...@unknown.fr> wrote:
Quote:
with ones and zeroes reveresd

00001111010110
00001000111101

000011110101100 becomes
000010001111010

in my opinion, this is called XOR !

do an XOR on a bit and the previous bit

right ?

No not correct! for several reasons
1) you need to define the
previous bit at start is it 0 or 1 or function of first bit seen?
2) because as shown
00001111 would go to 00001000
but
11110000 would go to 11110111

but at least your thinking and that more than most
looking at your methid in detail and knowing that it
really has to be reversable you could assume that
previous bit is zero. I actually often do this in bijective
codings. the first string
00001111 would go to 00001000 not bad same as mine
second string
11110000 would go to 10001000 if you follow this with
an entropy coder it would not compress as well It would
be bijective though and it may be what the herd would
want since the coding is shorter and whats a bit among
friends. Its why most would use Marks MTF over my MTFQ.



..
David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"
inconnu
Posted: Tue Feb 19, 2008 4:17 pm
Guest
Quote:
with ones and zeroes reveresd
00001111010110
00001000111101

000011110101100 becomes
000010001111010



in my opinion, this is called XOR !

do an XOR on a bit and the previous bit

right ?
inconnu
Posted: Fri Feb 22, 2008 4:05 pm
Guest
Quote:
No not correct! for several reasons
1) you need to define the
previous bit at start is it 0 or 1 or function of first bit seen?
2) because as shown
00001111 would go to 00001000
but
11110000 would go to 11110111

David,

let's imagine you keep the first bit at 1
so a xor would give:
10001000

so, except the first bit, you do a simple "not" on all of the bits and
you get your result:
11110111

so, with a "not" or without, it remains a "xor"

right ?
biject
Posted: Mon Feb 25, 2008 4:50 am
Guest
On Feb 22, 1:05 pm, inconnu <unkn...@unknown.fr> wrote:
Quote:
No not correct! for several reasons
1) you need to define the
previous bit at start is it 0 or 1 or function of first bit seen?
2) because as shown
00001111 would go to 00001000
but
11110000 would go to 11110111

David,

let's imagine you keep the first bit at 1
so a xor would give:
10001000

so, except the first bit, you do a simple "not" on all of the bits and
you get your result:
11110111

so, with a "not" or without, it remains a "xor"

right ?

Dont't get me wrong XOR can be used any where
and I was noted among my peers for the use
of XOR for everything at one time. I even won one
of the EDN design awards. Look it up if theres
a data base one line,

My favorite way of swapping to registers was
using only XOR's since on dec machines it
was the fasted way.

IN TTL design why use nand gates when you
have a bin full of XOR gates you can do
any function only with XOR.

Can you think of a digital function where
one couldn't USE a XOR, right?

David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Sun Sep 07, 2008 3:22 am