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

Home » Public Forums » archive » Re: Combinatorial
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: Combinatorial [message #40734 is a reply to message #40724] Mon, 30 August 2004 07:58 Go to previous messageGo to previous message
andrade_bahia is currently offline  andrade_bahia
Messages: 5
Registered: August 2004
Junior Member
Dear Bowman,
I Would like to thank the orientation.
But if the combination will be of more attributes, or either, 4x4,
5x5?? How I could make?
Thanks in advance for your help.

Adilson Andrade



Kenneth Bowman <k-bowman@null.tamu.edu> wrote in message news:<k-bowman-20D54B.08512927082004@news.tamu.edu>...
> In article <e8ecd642.0408270539.19ddd96a@posting.google.com>,
> andrade_bahia@yahoo.com.br (Adilson) wrote:
>
>> Dear all,
>> Would like to know as I make to effect combinations in the IDL I have
>> a problem where I want to execute a fixed combination of elements
>> contained in a vector. EX: A=[0,1,2,3,4,5 ] --> six elements I want
>> to make combinations 3x3 of the elements contained in. The formed
>> vector is of 6!/3!*(6-3)! = 20 elements. Example of the vector to be
>> formed->[0,1,2],[0,1,3]... [3,4,5 ]. In the total of 20 combinations.
>> Which the best form to execute this operation? If you to be able to
>> help me would be grateful.
>> I subscribe myself with the highest consideration.
>> Thanks in advance for your help.
>>
>> Adilson
>
> Not elegant, but I think this does what you want.
>
> IDL> n = 6
> IDL> comb = lonarr(3)
> IDL> for i = 0, n-1 do for j = i+1, n-1 do for k = j+1, n-1 do comb =
> [[comb], [i,j,k]]
> IDL> comb = comb[*,1:*]
> IDL> print, comb
> 0 1 2
> 0 1 3
> 0 1 4
> 0 1 5
> 0 2 3
> 0 2 4
> 0 2 5
> 0 3 4
> 0 3 5
> 0 4 5
> 1 2 3
> 1 2 4
> 1 2 5
> 1 3 4
> 1 3 5
> 1 4 5
> 2 3 4
> 2 3 5
> 2 4 5
> 3 4 5
>
> Ken Bowman
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Beyond 7-bit ASCII
Next Topic: Re: User Interface realization in IDL

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

Current Time: Tue Dec 02 08:48:41 PST 2025

Total time taken to generate the page: 1.19989 seconds