I am unclear on what you are trying to do. If I understand
your description then I wonder, does the following define
what you want?

   ]x =. ?. 20$20
6 15 19 12 14 19 0 17 0 14 6 18 13 18 11 12 18 0 10 2

   ]y =. ?. 10$10
6 5 9 2 4 9 0 7 0 4

   <@I. y =/ x
+----+++--+++------++------++
|0 10|||19|||6 8 17||6 8 17||
+----+++--+++------++------++

If so, then the question is how to make it work with large
x and y vectors.

- joey

At 11:50  +0930 2007/04/03, Saunders, John (TQEH) wrote:
Hi guys I'm using the below loop to match 2 lists of numbers it
generates a boxed list of the index of matches,(the nth item in the
boxed list xs contains the index of the matches in x of the nth item of
y) there can be multiple matches or none; the lists contain around
30,000 items and this will increase so it's slow and I'm sure its not a
good way to do it could anyone please suggest improved methods.

match =: 3 : 0
for. y do.
index =: index + 1
if. index = #y do. break. end.
x =: (I. ( dex { y) E. ,x) xs =: xs,(<x) end.
)

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

Reply via email to