The following should work for quite large data sets and provided you are within the bounds of integers , reasonably large sets of categories f.
Like Raul it uses the key adverb.  For larger problems b is the indices of
sparse array elements.

I think one approach might be something like the following
'b1 b2 b3' =: b =: 3 100000 $ ?. 300000#20  NB. indices for cells
bt =: |: b
n =: 'n0 n1 n2' =: 20 20 20
v =: n #.bt
vcounts =: v # /. v

NB.  in this case there are no empty cells so the distribution
NB.  across the array is given by
n $ vcounts /: ~.v
NB.  with empty cells you would need to expand first

Fraser


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

Reply via email to