Path: utzoo!news-server.csri.toronto.edu!rutgers!sun-barr!decwrl!csus.edu!ucdavis!caldwr!rfinch From: rfinch@caldwr.water.ca.gov (Ralph Finch) Newsgroups: comp.lang.idl-pvwave Subject: Re: Summary: comparing arrays Message-ID: <273@locke.water.ca.gov> Date: 12 Mar 91 18:31:34 GMT References: <265@locke.water.ca.gov> <271@locke.water.ca.gov> Organization: Calif. Dept. of Water Resources, Sac. Lines: 25 Here is yet a fourth way; this technique was mentioned by others. From: RSI Here is solution #4 (and counting) to your array intersection problem. The algorithm is very efficient for byte, integer, and long arrays, that have a limited range. It will not work for other data types. function intersect, a, b ; Return the values that are common between two arrays. ; Restrictions: ; A and B should be integers, longs, or bytes. Their combined range ; should be relatively small, as two histogram arrays of length equal ; to the combined range are created. ; minv = min(a) < min(b) ;Smallest value return, where((histogram(a, min=minv) ne 0) and $ (histogram(b, min=minv) ne 0))+minv end -- Ralph Finch 916-445-0088 rfinch@water.ca.gov ...ucbvax!ucdavis!caldwr!rfinch Any opinions expressed are my own; they do not represent the DWR