I tried sparse arrays and sped it up a little, I think.
time =: 6!:2
W =: 9
H =: 12
C =: 2 ^ 2 * W
Mem =: 1$.( C, W , H );0 1 2;_1
time 'Mem =: 4 ( < 1 2 3 ) } Mem'
0.104455
Mem
1 2 3 | 4
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
