Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Fastest way to list combinations
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
antar3...@gmail.com  
View profile  
 More options Jul 13 2012, 4:51 pm
Newsgroups: comp.lang.idl-pvwave
From: antar3...@gmail.com
Date: Fri, 13 Jul 2012 13:51:41 -0700 (PDT)
Local: Fri, Jul 13 2012 4:51 pm
Subject: Fastest way to list combinations
Hi

I have to solve a problem which includes listing all possible combinations to form a triplet for a given number of objects.

Say you have the objects:
a,b,c,d,e, so in total 5 which gives you 5!/(2!*3!) = 10 possibilities to list them without any doubles:

abc
abd
abe
acd
ace
ade
bcd
bce
bde
cde

I have solved this problem for any number (well up to some computer limit anyway) in three FOR loops but for large numbers this is rather small...

can you think of a better way than using loops to list all these possibilites?

thanks!!
:)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
antar3...@gmail.com  
View profile  
 More options Jul 13 2012, 5:01 pm
Newsgroups: comp.lang.idl-pvwave
From: antar3...@gmail.com
Date: Fri, 13 Jul 2012 14:01:40 -0700 (PDT)
Local: Fri, Jul 13 2012 5:01 pm
Subject: Re: Fastest way to list combinations

Sorry, instead of small it should say slow...stupid autocorrect... ;)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul van Delst  
View profile  
 More options Jul 13 2012, 5:28 pm
Newsgroups: comp.lang.idl-pvwave
From: Paul van Delst <paul.vande...@noaa.gov>
Date: Fri, 13 Jul 2012 17:28:29 -0400
Local: Fri, Jul 13 2012 5:28 pm
Subject: Re: Fastest way to list combinations
Hello,

On 07/13/12 16:51, antar3...@gmail.com wrote:

Dunno if it's the fastest and/or best way, but have a look at:
  http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/idl/
There should be three files.

If you look at the test_combination.pro you will see how to use it.

For example, getting a list of all the combos of three letters from 26:

IDL> t=systime(1) &  Test_Combination, 26, 3 & print, systime(1)-t
...lots and lots of output listing the combinations....
          22          23          25
          22          24          25
          23          24          25
Total combinations:     2600
     0.032832861
IDL>

You could use this sort of output to generate index arrays to extract your combination of letters from string arrays.

Anyhoo, hope they're useful.

cheers,

paulv

p.s. There may be a native solution for this as well. I wrote those routines a while back... perhaps even as an
exercise. Can't recall.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Bailin  
View profile  
 More options Jul 15 2012, 11:23 am
Newsgroups: comp.lang.idl-pvwave
From: Jeremy Bailin <astroco...@gmail.com>
Date: Sun, 15 Jul 2012 12:53:26 -0230
Local: Sun, Jul 15 2012 11:23 am
Subject: Re: Fastest way to list combinations
On 7/13/12 6:21 PM, antar3...@gmail.com wrote:

You could try COMBIGEN in JBIU.

http://astroconst.org/jbiu/jbiu-doc/math/combigen.html

-Jeremy.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
antar3...@gmail.com  
View profile  
 More options Jul 16 2012, 6:12 am
Newsgroups: comp.lang.idl-pvwave
From: antar3...@gmail.com
Date: Mon, 16 Jul 2012 03:12:31 -0700 (PDT)
Local: Mon, Jul 16 2012 6:12 am
Subject: Re: Fastest way to list combinations

> You could try COMBIGEN in JBIU.

> http://astroconst.org/jbiu/jbiu-doc/math/combigen.html

> -Jeremy.

That's the way to go I think! :)

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »