On 10/8/06, Egert, Bjoern <[EMAIL PROTECTED]> wrote: > Hello, > > Is there a way in R to construct an (error correcting) binary code > e.g. for an source alphabet containing integers from 1 to say 255 > with the property that each pair of distinct codewords of length m > is at Hamming distance exactly m/2 ? > > I was suggested to use so called simplex codes, which should be > fairly standard, but I haven't found a direct way via R packages > to do so, that's why I ask whether there might be in indirect way > to solve this problem. > > Example: > v1 =c(1,2,3,4) > v2 =c(1,2,5,6) > similarity(v1,v2)=0.5, (because 2 out of 4 elements are equal). > Obviously, a binary representation of would yield a different > similarity of: > binary(v1) =001 010 011 100 > binary(v1) =001 010 101 110 > similarity(binary(v1),binary(v2))= 9/12 > > Remark: The focus here is not on error correction, but rather the > binary encoding retaining similarity of the elements of vectors. > > Many thanks, > Bjoern
Bjoern, NB: I'm an R newbie and I only know a bit about error correcting codes. I haven't seen any responses to your questions and I don't know if you still have a need, but it is certainly possible to construct forward error correction codes with all the great math capability in R. It seems you want to generate code words that still have the original bits present. These are systematic codes and there are lots of them available to use. Many codes are specified by the code word length (n), number of original data bits in each code word (k), and the minimum Hamming distance of the code words (d) as a [n,k,d] code. Simplex Codes have these parameters: [2^k - 1, k, 2^(k - 1)]. These codes could be generated as a simple matrix multiply in R, but are you sure that's what you want? The code words will be quite long. Regards, Richard Graham ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.