/* test1.c: (ANSI-)C-program for testing a random bit/number file by calculating the autocorrelation function of the bits, bytes, words, the bits of the words and the crosscorelation function with a pseudorandom sequence. The program starts with the countig of the binary zeros and ones, listing of the numbers of the Bytes i=0x00..0xff and the listing of the frequency of the word counts. The default is the analysing of the first 10^7 Byte of the input file. The whole program needs approx. 10 h on a K5 115,5MHz (PR 166). 1998, rolf.freitag at email.de 2005: Added byte and word autocorrelation test for clarity. Because of the many data these tests are harder, so e. g. the z5000 data do not pass the word autocorrelation test. This Program is free software; you can redistribute it and/od modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at yout option) any later version. This Program is distributed in the hop that it will be useful, but WITHOUT ANY WARRENTY; without even the implied warrenty of MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this Program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include /* #include */ #include #include // simple version number from 2005-09-03 #define SOFTWARE_VERSION_NUMBER 1.1 static double ans[0xffff]; // for privisional result struct // list of output values { double v[401]; /* value */ } y; union a { long l[2500000]; unsigned short w[5000000]; unsigned char c[10000000]; }; static union a a; static long zk[0xffff] = // for privisional result { 0 }; static long zw[0xffff] = // for privisional result and conversion { 0 }; static FILE *ofp; // output file pointer void sig_handler (int sig) { fprintf (ofp, "\nSignal %d - program exiting... \n", sig); fprintf (stdout, "\a\a\a\a"); exit (0); } void createz () // calclulates the croscorrelation function of the trinary sequence and { // the input sequence and stores the result in z[] */ int i = 0, j = 0, l = 0; unsigned short sr1 = 0xffff, sr2 = 0xffff; // virtual shift registers unsigned short o; //for logical shift int c1 = 0, c2 = 0; // output values of the virtual shift registers double s = 0.0; for (i = 0; i <= 0xfffe; i++) // the complete sequence { sr1 = 0xffff; sr2 = 0xffff; for (l = 1; l <= 0xffff + 11 - i; l++) { o = sr1 >> 15; sr1 <<= 1; // shift inside the virtual shift register // polynom, input sr1 |= o ^ (sr1 & 2) >> 1 ^ (sr1 & 8) >> 3 ^ (sr1 & 4096) >> 12; } c1 = (sr1 & 0x8000) ? 1 : -1; for (l = 1; l <= 11 + 1; l++) { o = sr2 >> 15; sr2 <<= 1; // shift inside the virtual shift register // polynom, input sr2 |= o ^ (sr2 & 2) >> 1 ^ (sr2 & 8) >> 3 ^ (sr2 & 4096) >> 12; } c2 = (sr2 & 0x8000) ? 1 : -1; s = 0.0; for (j = 0; j <= 0xfffe; j++) // loop for the addends { s += (abs ((double) a.l[j])) * ((double) (c1 - c2)) * 0.5; o = sr1 >> 15; sr1 <<= 1; // shift inside the virtual shift register // polynom, input sr1 |= o ^ (sr1 & 2) >> 1 ^ (sr1 & 8) >> 3 ^ (sr1 & 4096) >> 12; c1 = (sr1 & 0x8000) ? 1 : -1; o = sr2 >> 15; sr2 <<= 1; // shift inside the virtual shift register // polynom, input sr2 |= o ^ (sr2 & 2) >> 1 ^ (sr2 & 8) >> 3 ^ (sr2 & 4096) >> 12; c2 = (sr2 & 0x8000) ? 1 : -1; } /* for j, one point calculated */ ans[i] = s / ((double) 0xffff); } /* for i */ for (i = 0; i <= 0xfffe; i++) zk[i] = (ans[i] > -0.5) ? ((long) (0.5 + ans[i])) : ((long) (-0.5 + ans[i])); return; } /* createz */ void createy1 () /* creates and noise-reduces the output value table for the akf */ { /* and skk (that is max. 295 ASCII output values) */ int i = 0, j = 0, k = 0; double dtmp = 0.0; /* averaging */ for (i = 0; i <= 18; i++) y.v[i] = (double) zk[i]; j = 19; /* j=privisional-nr. */ for (i = 19; i <= 28; i++) /* i=output-nr. */ { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp *= 0.5; y.v[i] = dtmp; j = j + 2; } j = 39; for (i = 29; i <= 35; i++) { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp += (double) zk[j + 2]; dtmp *= 0.333333333333333; y.v[i] = dtmp; j = j + 3; } j = 60; for (i = 36; i <= 40; i++) { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp += (double) zk[j + 2]; dtmp += (double) zk[j + 3]; dtmp *= 0.25; y.v[i] = dtmp; j = j + 4; } j = 80; for (i = 41; i <= 44; i++) { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp += (double) zk[j + 2]; dtmp += (double) zk[j + 3]; dtmp += (double) zk[j + 4]; dtmp *= 0.2; y.v[i] = dtmp; j = j + 5; } j = 100; for (i = 45; i <= 294; i++) { dtmp = 0.0; for (k = 1; k <= i - 39; k++) dtmp += (double) zk[j + k]; dtmp /= (double) (i - 39); y.v[i] = dtmp; j += i - 39; } return; } /* createy1 */ void createy2 () // creates and noise-reduces the output value table for the kkf { /* (that is max. 401 ASCII output values) */ int i = 0, j = 0, k = 0; double dtmp = 0.0; /* averaging */ for (i = 0; i <= 18; i++) y.v[i] = ((double) zk[i]); j = 19; /* j=privisional-nr. */ for (i = 19; i <= 28; i++) /* i=output-nr. */ { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp *= 0.5; y.v[i] = dtmp; j = j + 2; } j = 39; for (i = 29; i <= 35; i++) { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp += (double) zk[j + 2]; dtmp *= 0.333333333333333; y.v[i] = dtmp; j = j + 3; } j = 60; for (i = 36; i <= 40; i++) { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp += (double) zk[j + 2]; dtmp += (double) zk[j + 3]; dtmp *= 0.25; y.v[i] = dtmp; j = j + 4; } j = 80; for (i = 41; i <= 44; i++) { dtmp = (double) zk[j]; dtmp += (double) zk[j + 1]; dtmp += (double) zk[j + 2]; dtmp += (double) zk[j + 3]; dtmp += (double) zk[j + 4]; dtmp *= 0.2; y.v[i] = dtmp; j = j + 5; } j = 100; for (i = 45; i <= 400; i++) { dtmp = 0.0; for (k = 1; k <= i - 39; k++) dtmp += (double) zk[j + k]; dtmp /= (double) (i - 39); y.v[i] = dtmp; j += i - 39; } return; } /* createy2 */ void single_generators_akf () { /* Calculates the autocorrelation function (akf) of the Bits 0..15 from the words of the input sequence. The first value should be close to 2^15=32768 and all other should be close to 2^14=16384. */ double dtmp = 0.0; long ltmp = 0; int i = 0, j = 0, ii = 0, bit_nr = 0; unsigned short w = 0; for (ii = 1; ii <= 0x8000; ii *= 2) { /* conversion: Byte -> Bit */ for (ltmp = 0; ltmp < 0xfffe; ltmp++) { w = a.w[ltmp]; zw[ltmp] = ((w & ii) > 0); } /* for */ /* calculation of the autocorrelation function */ for (i = 0; i <= 32767; i++) /* 32768 function values */ { dtmp = 0.0; for (j = 0; j <= 0xfffe; j++) /* sum for one value */ dtmp += (double) zw[j] * (double) zw[(j + i) % 0xffff]; ans[i] = dtmp; } /* for i */ for (i = 0; i <= 0xfffe; i++) zk[i] = (ans[i] > -0.5) ? ((long) (0.5 + ans[i])) : ((long) (-0.5 + ans[i])); createy1 (); fprintf (ofp, "Autocorrelation function of Bit %d of the words ", bit_nr++); fprintf (ofp, "and difference to the average value\n"); fprintf (ofp, "from a sequence or random and independent Bits\n"); fprintf (ofp, "Value Difference\n"); fprintf (ofp, "%7.1f %8.1f\n", y.v[0], y.v[0] - 32767.5); for (i = 1; i <= 294; i++) fprintf (ofp, "%7.1f %8.1f\n", y.v[i], y.v[i] - 16383.5); fprintf (ofp, "\n"); fflush (ofp); } /* for */ } /* single_generators_akf */ void akf () { /* Calculates the autocorrelation function (akf) of the input bit sequence. The first value should be close to 2^15=32768 and all other should be close to 2^14=16384. */ double dtmp = 0.0; long ltmp = 0, dw = 0; int i = 0, j = 0; /* conversion of double words to bits */ for (ltmp = 0; ltmp < 0xfffe; ltmp++) { dw = a.l[ltmp / 32]; switch (ltmp % 32) { case 0: zw[ltmp] = (dw & 0x00000001); break; case 1: zw[ltmp] = ((dw & 0x00000002) > 0); break; case 2: zw[ltmp] = ((dw & 0x00000004) > 0); break; case 3: zw[ltmp] = ((dw & 0x00000008) > 0); break; case 4: zw[ltmp] = ((dw & 0x00000010) > 0); break; case 5: zw[ltmp] = ((dw & 0x00000020) > 0); break; case 6: zw[ltmp] = ((dw & 0x00000040) > 0); break; case 7: zw[ltmp] = ((dw & 0x00000080) > 0); break; case 8: zw[ltmp] = ((dw & 0x00000100) > 0); break; case 9: zw[ltmp] = ((dw & 0x00000200) > 0); break; case 10: zw[ltmp] = ((dw & 0x00000400) > 0); break; case 11: zw[ltmp] = ((dw & 0x00000800) > 0); break; case 12: zw[ltmp] = ((dw & 0x00001000) > 0); break; case 13: zw[ltmp] = ((dw & 0x00002000) > 0); break; case 14: zw[ltmp] = ((dw & 0x00004000) > 0); break; case 15: zw[ltmp] = ((dw & 0x00008000) > 0); break; case 16: zw[ltmp] = ((dw & 0x00010000) > 0); break; case 17: zw[ltmp] = ((dw & 0x00020000) > 0); break; case 18: zw[ltmp] = ((dw & 0x00040000) > 0); break; case 19: zw[ltmp] = ((dw & 0x00080000) > 0); break; case 20: zw[ltmp] = ((dw & 0x00100000) > 0); break; case 21: zw[ltmp] = ((dw & 0x00200000) > 0); break; case 22: zw[ltmp] = ((dw & 0x00400000) > 0); break; case 23: zw[ltmp] = ((dw & 0x00800000) > 0); break; case 24: zw[ltmp] = ((dw & 0x01000000) > 0); break; case 25: zw[ltmp] = ((dw & 0x02000000) > 0); break; case 26: zw[ltmp] = ((dw & 0x04000000) > 0); break; case 27: zw[ltmp] = ((dw & 0x08000000) > 0); break; case 28: zw[ltmp] = ((dw & 0x10000000) > 0); break; case 29: zw[ltmp] = ((dw & 0x20000000) > 0); break; case 30: zw[ltmp] = ((dw & 0x40000000) > 0); break; case 31: zw[ltmp] = ((dw & 0x80000000) > 0); break; default: exit (-1); break; } /* switch */ } /* for */ /* calculation of the autocorrelation function */ for (i = 0; i <= 32767; i++) /* 32768 function values */ { dtmp = 0.0; for (j = 0; j <= 0xfffe; j++) /* sum for one value */ dtmp += (double) zw[j] * (double) zw[(j + i) % 0xffff]; ans[i] = dtmp; } /* for i */ for (i = 0; i <= 0xfffe; i++) zk[i] = (ans[i] > -0.5) ? ((long) (0.5 + ans[i])) : ((long) (-0.5 + ans[i])); createy1 (); fprintf (ofp, "Autocorrelation function of the input bit sequence "); fprintf (ofp, "and difference to the average value\n"); fprintf (ofp, "from a sequence or random and independent Bits\n"); fprintf (ofp, "Value Difference\n"); fprintf (ofp, "%7.1f %8.1f\n", y.v[0], y.v[0] - 32767.5); for (i = 1; i <= 294; i++) fprintf (ofp, "%7.1f %8.1f\n", y.v[i], y.v[i] - 16383.5); fprintf (ofp, "\n"); fflush (ofp); } /*akf */ void akfb () { /* Calculates the autocorrelation function (akf) of the input byte sequence. The first value should be close to 2^30 (approx. 10^9) and all other should be close to 2^29 */ const double n = 255.0; const double N = 65535.0; const double C0 = N * (n * (2.0 * n + 1.0)) / 6.0; const double C1 = N * (n * n) / 4.0; double dtmp = 0.0, d_sum=0., d_tmp=0.; long ltmp = 0, dw = 0; int i = 0, j = 0; /* conversion of double words to bytes */ for (ltmp = 0; ltmp < 0xfffe; ltmp++) { dw = a.l[ltmp / 4]; switch (ltmp % 4) { case 0: zw[ltmp] = (dw & 0x000000ff); break; case 1: zw[ltmp] = (dw & 0x0000ff00) >> 8; break; case 2: zw[ltmp] = (dw & 0x00ff0000) >> 16; break; case 3: zw[ltmp] = (dw & 0xff000000) >> 24; break; default: exit (-1); break; } /* switch */ } /* for */ /* calculation of the autocorrelation function */ for (i = 0; i <= 32767; i++) /* 32768 function values */ { dtmp = 0.0; for (j = 0; j <= 0xfffe; j++) /* sum for one value */ dtmp += ((double) zw[j]) * ((double) zw[(j + i) % 0xffff]); ans[i] = dtmp / 2.0; d_sum += dtmp; } /* for i */ for (i = 0; i <= 0xfffe; i++) zk[i] = (ans[i] > -0.5) ? ((long) (0.5 + ans[i])) : ((long) (-0.5 + ans[i])); createy1 (); fprintf (ofp, "Autocorrelation function (* 1/2) of the input byte sequence "); fprintf (ofp, "and difference to the average value\n"); fprintf (ofp, "from a sequence or random and independent Bytes\n"); fprintf (ofp, "Value Difference\n"); fprintf (ofp, "%12.1f %12.1f\n", y.v[0], y.v[0] - C0 / 2.0); for (i = 1; i <= 294; i++) fprintf (ofp, "%12.1f %12.1f\n", y.v[i], y.v[i] - C1 / 2.0); fprintf (ofp, "\n"); // calculate the theory value of byte autocorrelation d_tmp = 0.; for (i=0; i<0x100; i++) for (j=0; j<0x100; j++) d_tmp += ((double)i) * ((double)j); d_tmp /= 0x10000; // normalise d_sum /= 32768. *0xffffp0; // normalise fprintf(ofp, "Average byte autocorrelation/theory value: %f", d_tmp/d_sum); fprintf (ofp, " \t(should be close to 1).\n"); if (d_tmp/d_sum < .995) fprintf (ofp, "Byte autocorrelation test FAILED: %f < 0.995 !\n", d_tmp/d_sum); if (d_tmp/d_sum > 1.005) fprintf (ofp, "Byte autocorrelation test FAILED: %f > 1.005 !\n", d_tmp/d_sum); fprintf (ofp, "\n"); fflush (ofp); } /*akfb */ void akfw () { /* Calculates the autocorrelation function (akf) of the input word sequence. The first value should be close to 2^30 (approx. 10^9) and all other should be close to 2^29 */ const double n = 65535.0; const double N = 65535.0; const double C0 = N * (n * (2.0 * n + 1.0)) / 6.0; const double C1 = N * (n * n) / 4.0; double dtmp = 0.0, d_sum=0., d_tmp=0.; long ltmp = 0, dw = 0; int i = 0, j = 0; /* conversion of double words to words */ for (ltmp = 0; ltmp < 0xfffe; ltmp++) { dw = a.l[ltmp / 2]; switch (ltmp % 2) { case 0: zw[ltmp] = (dw & 0x0000ffff); break; case 1: zw[ltmp] = (dw & 0xffff0000) >> 16; break; default: exit (-1); break; } /* switch */ } /* for */ /* calculation of the autocorrelation function */ for (i = 0; i <= 32767; i++) /* 32768 function values */ { dtmp = 0.0; for (j = 0; j <= 0xfffe; j++) /* sum for one value */ dtmp += (double) zw[j] * (double) zw[(j + i) % 0xffff]; ans[i] = dtmp / ((double) 0x20000); /* Normierung, um Overflow zu verhindern */ d_sum += dtmp; } /* for i */ for (i = 0; i <= 0xfffe; i++) zk[i] = (ans[i] > -0.5) ? ((long) (0.5 + ans[i])) : ((long) (-0.5 + ans[i])); createy1 (); fprintf (ofp, "Autocorrelation function (* 1/0x20000) of the input word sequence "); fprintf (ofp, "and difference to the average value\n"); fprintf (ofp, "from a sequence or random and independent words\n"); fprintf (ofp, "Value Difference\n"); fprintf (ofp, "%12.1f %12.1f\n", y.v[0], y.v[0] - C0 / ((double) 0x20000)); for (i = 1; i <= 294; i++) fprintf (ofp, "%12.1f %12.1f\n", y.v[i], y.v[i] - C1 / ((double) 0x20000)); fprintf (ofp, "\n"); // calculate the theory value of word autocorrelation d_tmp = 0.; for (i=0; i<0x10000; i++) for (j=0; j<0x10000; j++) d_tmp += ((double)i) * ((double)j); d_tmp /= 0x100000000p0; // normalise d_sum /= 32768. *0xffffp0; // normalise fprintf(ofp, "Average word autocorrelation/theory value: %f", d_tmp/d_sum); fprintf (ofp, " \t(should be close to 1).\n"); if (d_tmp/d_sum < .995) fprintf (ofp, "Word autocorrelation test FAILED: %f < 0.995 !\n", d_tmp/d_sum); if (d_tmp/d_sum > 1.005) fprintf (ofp, "Word autocorrelation test FAILED: %f > 1.005 !\n", d_tmp/d_sum); fprintf (ofp, "\n"); fflush (ofp); } /* akfw */ void kkf () { /* Calculates the crosscorrelation function (kkf) of the input double word sequence and a trinary pseudorandom bit sequence. (The average should be close to zero.) */ int i = 0; /* calculation of the crosscorrelation function */ createz (); createy2 (); fprintf (ofp, "\nCroscorrelation function with a trinary pseudo random sequence\n"); fprintf (ofp, "(should be noise around zero) \n"); for (i = 0; i <= 400; i++) fprintf (ofp, "\n %-12.1f", y.v[i]); fprintf (ofp, "\n\n"); fflush (ofp); } /* kkf */ int main (const int argc, const char * const argv[]) { const int N = 5000000; /* Nr. of input words (16-Bit-Values) */ char inname[100] = /* input file name */ { '\0' }; FILE *ifp; /* Input-File-Pointer */ char outname[100] = /* Output file name */ { '\0' }; int m = 0, i = 0, ii = 0, j = 0, k = 0, itmp = 0, bit1 = 0, bit0 = 0; int byten[0x100] = /* for byte-counting */ { 0 }; unsigned char b = { '\0' }; int w_count[0x10000] = /* for word-counting */ { 0 }; int w_count_count[130] = /* for probability of word occurance */ { 0 }; long double ltmp = 0.0; time_t now; struct tm *ptr_tm=(time(&now), localtime(&now)); signal (SIGHUP, sig_handler); signal (SIGINT, sig_handler); signal (SIGQUIT, sig_handler); signal (SIGILL, sig_handler); signal (SIGTRAP, sig_handler); signal (SIGIOT, sig_handler); /* signal(SIGEMT, sig_handler); */ signal (SIGFPE, sig_handler); signal (SIGKILL, sig_handler); signal (SIGBUS, sig_handler); signal (SIGSEGV, sig_handler); /* signal(SIGSYS, sig_handler); */ signal (SIGPIPE, sig_handler); signal (SIGALRM, sig_handler); signal (SIGTERM, sig_handler); signal (SIGABRT, sig_handler); if ( (argc>1) and not strncmp (argv[1], "-V", 123) ) { fprintf (stdout, "%s version %.1f\n", argv[0], SOFTWARE_VERSION_NUMBER); exit ( (2 == argc) ? 0 : -1); } if ((argc < 3) || (argc > 4)) { fprintf (stderr, "\aUsage: %s [in-file] [out-file] \n", argv[0]); fprintf (stderr, "\aor: %s -V\n", argv[0]); fprintf (stderr, "[] = Optional <> = Parameter Requirement. 1<=N<=3 parameters required.\n"); exit (-1); } if (argc < 4) itmp = 0xff; else itmp = strtol (argv[3], (char **)NULL, 0); // sscanf (argv[3], "%d", &itmp); sprintf (inname, "%s", argv[1]); sprintf (outname, "%s", argv[2]); ifp = fopen (inname, "rb"); if (ifp == NULL) { fprintf (stderr, "\a Can't open in-file \"%s\"", inname); perror (" "); exit (-errno); } ofp = fopen (outname, "w"); if (ofp == NULL) { fprintf (stderr, "\a Can't open out-file \"%s\"", outname); perror (" "); exit (-errno); } fprintf (ofp, "Evaluation of %s at %d-%s%d-%s%d %s%d:%s%d:%s%d (start):\n\n", inname, ptr_tm->tm_year+1900, ptr_tm->tm_mon+1 > 9 ? "" : "0", ptr_tm->tm_mon+1, ptr_tm->tm_mday > 9 ? "" : "0", ptr_tm->tm_mday, ptr_tm->tm_hour > 9 ? "" : "0", ptr_tm->tm_hour, ptr_tm->tm_min > 9 ? "" : "0", ptr_tm->tm_min, ptr_tm->tm_sec > 9 ? "" : "0", ptr_tm->tm_sec); /* Main part */ for (i = 0; i < 2500000; i++) // read 10^7 Byte if (fread (&a.l[i], sizeof (long int), 1, ifp) == 1); else { perror ("\a error: input file size < 10000000 byte\n"); fprintf (stderr, " ii=%d\n", ii); exit (-errno); } if (ferror (ifp)) { perror ("\ainput file error"); exit (-errno); } fclose (ifp); bit0 = 0; bit1 = 0; for (i = 0; i <= 0xff; i++) byten[i] = 0; for (i = 0; i < 5000000; i++) /* estimate probabilitys of word occurance */ w_count[((int) a.w[i])]++; for (i = 0; i <= 0xffff; i++) /* estimate probability distribution */ { j = ((int) (w_count[i] < ((unsigned short) 129)) ? ((int) w_count[i]) : 129); w_count_count[j]++; } for (i = 0; i < 10000000; i++) { b = a.c[i]; byten[b]++; for (ii = 1; ii <= 0x80; ii *= 2) { if ((b & ii) != 0) bit1++; else bit0++; } } /* for */ fprintf (ofp, "%d 0-Bits %d 1-Bits\n", bit0, bit1); fprintf (ofp, "\n"); fprintf (ofp, "List of Byte counts : \n"); for (k = 0; k <= 0xf; k++) { for (i = 0; i <= 0x7; i++) fprintf (ofp, "%9d", byten[k * 0x10 + i]); fprintf (ofp, "\n"); for (i = 0x8; i <= 0xf; i++) fprintf (ofp, "%9d", byten[k * 0x10 + i]); fprintf (ofp, "\n"); } fprintf (ofp, "\n"); if (itmp & 16) { fprintf (ofp, "Probability distribution of word counts and theoretic values: \n"); for (k = 0; k <= 129; k++) { /* calculation of the binominal distribution */ ltmp = powl (2.0, 16.0); /* for the sum over all word */ ltmp *= powl (powl (2.0, -16.0), ((long double) k)); ltmp *= powl ((1.0 - powl (2.0, -16.0)), ((long double) N) - ((long double) k)); for (m = 0; (k - m) >= 1; m++) ltmp *= ((long double) (N - m)) / ((long double) (k - m)); j = (ltmp > -0.5) ? ((int) (0.5 + ltmp)) : ((int) (-0.5 + ltmp)); if (k < 129) fprintf (ofp, "%9d %9d %9d", k, w_count_count[k], j); else fprintf (ofp, ">=%7d %9d %9d", k, w_count_count[k], j); fprintf (ofp, "\n"); } } fprintf (ofp, "\n"); fflush (ofp); if (itmp & 1) akf (); if (itmp & 2) akfb (); if (itmp & 4) akfw (); if (itmp & 8) kkf (); if (itmp & 16) single_generators_akf (); fclose (ofp); return (0); } /* main */