Harvey - doing this row-wise not only is faster but simplifies all the
suggested expressions as well:
mm=: /:~"1 ?100000 100$1e6 NB. As originally specified
10 (6!:2) '({:,~ }:- }.)&.|: mm'
0.51509724
10 (6!:2) '2-/\"1 mm,.0'
0.24292836
10 (6!:2) '(_1&}. - 1&}.)"1 mm,"1]0'
0.19471974
mm=: /:~ ?100 100000$1e6 NB. Now do it row-wise...
10 (6!:2) '({:,~ }:- }.) mm'
0.19174804
10 (6!:2) '2-/\ mm,.0'
0.093385365
10 (6!:2) '(_1&}. - 1&}.) mm,0'
0.19073624
This last method shows no improvement row-wise.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm