[email protected]
>  What is the fastest way to calculate the indices for all exact matches
from
>  k that exist in v.

The naive approach in J would be  I.@:E.  (or just  E.  if we wanted a
boolean mask instead of an index list):  

           ss=:I.@:E.

           ('hello j';'software community') ss L:0 'hello j software
community ...'
        +-+-+
        |0|8|
        +-+-+   

Notationally speaking, J could run this code in parallel (the DoJ makes no
promises about execution order), but currently J is single-threaded and will
run the searches in series.

Faster approaches are probably possible, such as looking for shared
sub-sequences among the sought strings first, but I'll leave that for people
who enjoy code optimization.

-Dan




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

Reply via email to