On Fri, Apr 24, 2015 at 7:03 PM, Roger Hui <[email protected]> wrote:
> The details of implementing this algorithm are left as an exercise for the
> reader. :-)
Do I qualify as a reader?
comb=: 4 : 0
k=. i.>:d=.y-x
z=. (d$<i.0 0),<i.1 0
for. i.x do. z=. k ,.&.> ,&.>/\. >:&.> z end.
; z
)
peermm=:3 :0
r=.i.1 0
for_d.</.~y do.
u=.{.s=.>d
n=.i.(#s)+{:$r
e=.n e."1 s comb&#n
r=.,/(u*e)+"1/"_1 (1-e)#inv"1/r
end.
)
peermm 1 1 2 2
2 2 1 1
2 1 2 1
2 1 1 2
1 2 2 1
1 2 1 2
1 1 2 2
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm