hdc seems equal to the size of the symmetric difference between the sets 
which induced booleans.

for n <: -: m, it is (+: n) - i. >: n, the # of which is >: n
for n > -: m, it is (+:n) - (m-n){. i.>: n, the # of which is  m- >:n

so it is the >. of the two, as you said.

On 10/4/2011 9:51 AM, Roger Hui wrote:
> A problem posed by Tony Corso (an APL user).
>
> m comb n computes all the size m combinations
> of i.n:
>
> comb=: 4 : 0
>   c=. 1 {.~ - d=. 1+y-x
>   z=. i.1 0
>   for_j. (d-1+y)+/&i.d do. z=. (c#j) ,. z{~;(-c){.&.><i.{.c=. +/\.c end.
> )
>
>     3 comb 5
> 0 1 2
> 0 1 3
> 0 1 4
> 0 2 3
> 0 2 4
> 0 3 4
> 1 2 3
> 1 2 4
> 1 3 4
> 2 3 4
>
> Each row of the result specifies a boolean
> vector of length n with m 1s.  What is the
> number of distinct Hamming distances
> between the rows of m comb n?  (The Hamming
> distance between two boolean vectors is +/x~:y.)
> n can be up to 200.
>
> bcomb=: i.@] e."1 comb
> hd   =: ~. @ , @ (+/@:~:"1/~) @ bcomb
> hdc  =: i.@>: #@hd&>  ]
> hdc1 =:>:@i.@>:<. ] -<:@i.@>:
>
> If m hdc n is the Hamming distance count
> for size m combinations of iota n, it looks
> like  (m hdc n) = (m+1)>.n-(m+1) , but I
> have not yet proven it.
>
>     hdc 10
> 1 2 3 4 5 6 5 4 3 2 1
>     hdc1 10
> 1 2 3 4 5 6 5 4 3 2 1
>     (hdc -: hdc1)"0 i.10
> 1 1 1 1 1 1 1 1 1 1
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to