CCL Home Page
Up Directory CCL ryan_perm.c
#include

#define maxPermSize 50 /*=maxAtoms*/
#define maxPerms 200

static int pos[maxPermSize];
int perm[maxPerms][maxPermSize];
int permCount;

static double Fact(int n)
{
 if(n==1 || n==0)
 {
  return 1;
 }
 else
 {
  return n*Fact(n-1);
 }
}


static void Perm ( int k , int n , int N )
{
 int i;

 for(pos[k]=k ; pos[k]<=(n-N)+k ; pos[k]++)
 {
   if( pos[k]>pos[k-1] )
   {
     if(k==N)
     {
       permCount++;
       for(i=1;i<=N ; i++ )
       {
	perm[permCount][i]=pos[i];
       }
     }
     else /* k
  
Modified: Fri Dec 8 17:00:00 1995 GMT
Page accessed 4904 times since Sat Apr 17 21:59:49 1999 GMT