I observe the perfomance difference:
x0 =: #~ e.&'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
x1 =: -.&(a.-.'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
M =: 4e6$a.
(x0 -: x1) M
1
ts =: 6!:2 , 7!:2@:]
%/ 100 ts&> x0`x1 ,L:0 ' M'
3.80106 1.12498
The difference is even more pronounced with integers:
w =: 20?100
xi0 =: #~ e.&w
xi1 =: -.&((i.100)-.w)
N =: ?1e6$100
(xi0 -: xi1) N
1
%/ 100 ts&> xi0`xi1 ,L:0 ' N'
7.4249 0.500099
I think the first form is the clear, obvious way to code this verb. It's also
more general, in the case where we know only the identities of items we want to
retain, not the whole universe.
Could it be supported by special code (e.g. by avoiding the intermediate
boolean array)?
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm