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

Home » Public Forums » archive » Re: 2d where
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: 2d where [message #39024] Tue, 13 April 2004 15:16
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Reimar Bauer <R.Bauer@fz-juelich.de> writes:
...
>> IDL> foo = ["a", "b", "c", "d", "e", "f"]
>> IDL> bar = ["b", "e"]
>> IDL> print, where(foo eq bar)
>> -1
>> PERFECTDL> print, where(foo eq bar)
>> 1 4
...
>
> I believe this is duplicated to a thread on the archive
> http://groups.google.de/groups?hl=de&lr=&ie=ISO-8859 -1&q=Vector+comparison+group%3Acomp.lang.idl-pvwave& btnG=Suche&meta=group%3Dcomp.lang.idl-pvwave
... [ corrected link ] ...

Hey, you got German in my Google :-)

Seriously, Reimar is right this comes up often, and I claim you almost
always want CMSET_OP(FOO, 'AND', BAR, /INDICES). This routine works
transparently on both strings and numbers, and scales to large array
sizes without hogging too much memory. All other so-called solutions
are cursed! :-)

The only time you don't want this routine is if you want to preserve
duplicate matches, in which case, good luck!

Craig

P.S. http://cow.physics.wisc.edu/~craigm/idl/idl.html




The only time you don't want that is when


>
> There were 22 entries about this question.
>
>
> Cheers
>
> Reimar
>
> --
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
> http://www.fz-juelich.de/icg/icg-i/
> ============================================================ ======
> a IDL library at ForschungsZentrum Juelich
> http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
>

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: 2d where [message #39030 is a reply to message #39024] Tue, 13 April 2004 10:50 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Graham wrote:

> I have read through the IDL documentation and while it does explain
> why the following doesn't work, it doesn't offer any alternatives :(
>
> I am trying to find the indexes where the elements of 'bar' are equal
> to 'foo'.
>
> IDL> foo = ["a", "b", "c", "d", "e", "f"]
> IDL> bar = ["b", "e"]
> IDL> print, where(foo eq bar)
> -1
> PERFECTDL> print, where(foo eq bar)
> 1 4
>
> Any ideas?
>
> Graham

Dear Graham

I believe this is duplicated to a thread on the archive
http://groups.google.de/groups?hl=de&lr=&ie=ISO-8859 -1&q=Vector+compariso
+group%3Acomp.lang.idl-pvwave&btnG=Suche&meta=group% 3Dcomp.lang.idl-pvwave

There were 22 entries about this question.


Cheers

Reimar

--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: dimension problem in matrix multiplication
Next Topic: How to rebin complex array?

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

Current Time: Sat Oct 11 10:05:33 PDT 2025

Total time taken to generate the page: 0.80048 seconds