comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Summary: comparing arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Summary: comparing arrays [message #8] Tue, 12 March 1991 10:31
rfinch is currently offline  rfinch
Messages: 51
Registered: March 1991
Member
Here is yet a fourth way; this technique was mentioned by others.

From: RSI <idl@pprince.Colorado.EDU>

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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Getting axis output ranges
Next Topic: Finding non-matching elements in arrays

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 19:01:12 PDT 2025

Total time taken to generate the page: 0.23984 seconds