/usr/share/doc/libsprng2-doc/TESTS/maxt.c is in libsprng2-doc 2.0a-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | #include <stdio.h>
#include "tests.h"
#include <math.h>
#ifndef ANSI_ARGS
#ifdef __STDC__
#define ANSI_ARGS(args) args
#else
#define ANSI_ARGS(args) ()
#endif
#endif
double xt ANSI_ARGS((double x));
double maxt ANSI_ARGS((long n, int t));
void set_t ANSI_ARGS((int t));
double *V2;
int xt_t = 1;
#ifdef __STDC__
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
long ntests, n, i;
double *V, result;
int t;
if(argc != N_STREAM_PARAM + 3)
{
fprintf(stderr,"USAGE: %s (... %d arguments)\n",argv[0], N_STREAM_PARAM+2);
exit(1);
}
ntests = init_tests(argc,argv);
n = atol(argv[N_STREAM_PARAM+1]);
t = atoi(argv[N_STREAM_PARAM+2]);
V = (double *) mymalloc(NTESTS*sizeof(double));
V2 = (double *) mymalloc(n*sizeof(double));
for(i=0; i<ntests; i++)
{
V[i] = maxt(n,t);
next_stream();
}
set_KS_n(NTESTS);
#if defined(SPRNG_MPI)
getKSdata(V,NTESTS);
#endif
if(proc_rank == 0)
{
result = KS(V,NTESTS,KSF);
printf("\nResult: KS value = %f", result);
result = KSpercent(result,NTESTS);
printf("\t %% = %.2f\n\n", result*100.0);
}
#if defined(SPRNG_MPI)
MPI_Finalize();
#endif
}
#ifdef __STDC__
double xt(double x)
#else
double xt(x)
double x;
#endif
{
return pow(x,(double) xt_t);
}
#ifdef __STDC__
void set_t(int t)
#else
void set_t(t)
int t;
#endif
{
xt_t = t;
}
#ifdef __STDC__
double maxt(long n, int t)
#else
double maxt(n, t)
int t;
long n;
#endif
{
double *V=V2, temp;
int j;
long i;
for(i=0; i<n; i++)
{
V[i] = 0.0;
for(j=0; j<t; j++)
{
temp=get_rn();
if( temp > V[i])
V[i] = temp;
}
}
set_t(t);
temp = KS(V,n,xt);
/*printf("\tKS for stream = %f, %% = %f\n", temp, KSpercent(temp,n));*/
/*free(V);*/
return temp;
}
|