Roger wrote:
> (~.y)i.y finds the indices of y in the nub of y .
> Can you do it faster?
Not yet. But here's a fun approach:
db0 =: (/:~&:; ((#~ #)~&.> i.@:#))@:(</. [EMAIL PROTECTED])
rewriting that to leverage more special code, at the cost of a slight
redundancy:
db1 =: I.@:(#/.~) /: ;@:(</. [EMAIL PROTECTED])
> y=: 1e4 [EMAIL PROTECTED] 900
> 6!:2 '(~.y) i. y'
> 0.000147784
>
> 6!:2 ',I.|:=y'
> 0.186556
y=: 1e4 [EMAIL PROTECTED] 900
6!:2 '(~.y) i. y'
0.000170692
6!:2 ',I.|:=y'
0.1902
6!:2 'db0 y'
0.00259726
6!:2 'db1 y'
0.00141219
So, only an order of magnitude slower at this point. I'll try to come up with
something faster during the day.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm