#include #include #include #include #include main( int argc, char * argv[] ) { int nperms, nlocs, nsam ; double **dij, pval, kwithin(), ksto,kso,kt, permt(), **tdij ; int i, loc, wf, *ni, tni[3], loc1, loc2, j, sti, stj, endi, endj ; if( argc < 5 ) { printf( "usage: perm name-of-statistic weighting-factor y/n(print data?) n_permutations n_locals n1 n2 ... \n"); exit(1) ; } nperms = atoi( argv[4] ) ; wf = atoi( argv[2] ) ; nlocs = atoi( argv[5] ); if( (ni = (int *)malloc( (size_t) (nlocs+1)*sizeof(int) )) == NULL) perror( "malloc error1\n") ; nsam = 0 ; for( i=0; i 2 ){ if( (tdij = (double **)malloc((size_t)nsam*sizeof( double * ) ) ) == NULL) perror( "malloc error2\n") ; for(i=0;i 0 ; i--){ j = ran1()*(i + 1) ; temp = ran_vect[j]; ran_vect[j] = ran_vect[i] ; ran_vect[i] = temp ; } } double ran1() { double drand48(); return( (double)drand48() ); }