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

Home » Public Forums » archive » Re: Vector comparison.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Vector comparison. [message #37120 is a reply to message #37068] Thu, 20 November 2003 00:23 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:
> P.S. I know we are all busy, but maybe we should make
> it a new rule that we all have to take a deep breath and
> a stretch, then read the question TWICE before
> posting an answer. :-)

Heh, I am guilty of the same thing in my own reply. The original
poster's requirement of keeping duplicates is a bit harder. From my
experience, an efficient set-intersection routine is very likely going
to do a sort/unique, which removes duplicates.

If one knows that the intersection is going to be small, then a simple
post-processing loop, with a brute force search, will do the trick.

As in:
c0 = cmset_op(a, 'AND', b, /index, count=ct)
if ct EQ 0 then message, 'ERROR: No intersection found'

c = -1L
for i = 0 , n_elements(c0)-1 do begin & wh = where(a EQ a(c0(i)), ct) & $
if ct GT 0 then c = [c, wh] & end
c = c(1:*)

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDLWAVE takes over
Next Topic: Byte Swapping

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

Current Time: Fri Oct 10 09:46:56 PDT 2025

Total time taken to generate the page: 0.79579 seconds