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 #37055 is a reply to message #37054] Thu, 20 November 2003 08:08 Go to previous messageGo to previous message
Chris[1] is currently offline  Chris[1]
Messages: 23
Registered: January 2003
Junior Member
Darnit! I was so proud of my answer... only to find that Chris Lee already
proposed the same method (the "memory-hogging" one), albeit using more
lines and this "if count eq 0 then ..." after WHERE, which always annoys
me for some stupid reason. It can be avoided, which gives me an excuse to
post my suggestion anyway:

function Get_Match, a, b
na = n_elements(a) & nb = n_elements(b)
return, where(total((rebin(a,na,nb) - rebin(transpose(b), na, nb)) eq 0, 2))
end

Cheers,

Timm

Today at 10:09 -0000, Christopher Lee wrote:

> [...]
>
> function get_match,a,b
>
> ;needs some up-to-date version of IDL, 5.4 I think.
>
> na=n_elements(a)
> nb=n_elements(b)
>
> ;some checks go here to make sure the world won't explode, an exersice
> ;for the reader.
>
> reb_a=[na,nb]
> ref_a=[na,1]
> reb_b=[na,nb]
> ref_b=[1,nb]
>
> a_temp=rebin(reform(a, ref_a),reb_a)
> b_temp=rebin(reform(b, ref_b),reb_b)
>
> c_temp=a_temp-b_temp
> a_temp=0
> b_temp=0
>
> w=where(c_temp eq 0, count)
>
> c_temp=0
> ;memory...
>
> if( count gt 0) then c=w mod na
> if( count eq 0) then c=-1
>
> return, c
> end
>
> [...]

--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
[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 01:03:05 PDT 2025

Total time taken to generate the page: 0.00217 seconds