1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#include "config.h"
#include <stdio.h>
#include <schroedinger/schro.h>
#include <schroedinger/schroarith.h>
#include <math.h>
#include "arith.h"
#define N 1000
double speed_arith_dirac (int x, unsigned char *data, int n);
double speed_arith_qm (int x, unsigned char *data, int n);
double speed_arith_dirac_byte (int x, unsigned char *data, int n);
double speed_arith_dirac_stats (int x, unsigned char *data, int n);
double speed_arith_dirac_both (int x, unsigned char *data, int n);
double speed_arith_exp (int x, unsigned char *data, int n);
unsigned char data[N];
int
main (int argc, char *argv[])
{
int x;
schro_init();
printf("Number of cycles for 5%% 0's, 95%% 1's:\n");
x = 256*0.05;
printf(" Dirac (original) %g\n",
speed_arith_dirac (x, data, N));
printf(" Dirac (bytewise shift) %g\n",
speed_arith_dirac_byte (x, data, N));
printf(" Dirac (periodic stats update) %g\n",
speed_arith_dirac_stats (x, data, N));
printf(" Dirac (both) %g\n",
speed_arith_dirac_both (x, data, N));
printf(" Dirac (experimental) %g\n",
speed_arith_exp (x, data, N));
printf(" QM coder %g\n",
speed_arith_qm (x, data, N));
printf("Number of cycles for 40%% 0's, 60%% 1's:\n");
x = 256*0.40;
printf(" Dirac (original) %g\n",
speed_arith_dirac (x, data, N));
printf(" Dirac (bytewise shift) %g\n",
speed_arith_dirac_byte (x, data, N));
printf(" Dirac (periodic stats update) %g\n",
speed_arith_dirac_stats (x, data, N));
printf(" Dirac (both) %g\n",
speed_arith_dirac_both (x, data, N));
printf(" Dirac (experimental) %g\n",
speed_arith_exp (x, data, N));
printf(" QM coder %g\n",
speed_arith_qm (x, data, N));
return 0;
}
|