\defmodule {fknuth}

This module applies tests from the module {\tt sknuth}
to families of generators of different sizes, 
and prints tables of the corresponding $p$-values.
% The results are placed in tables of $p$-values.


\bigskip
\hrule
\code\hide
/* fknuth.h for ANSI C */
#ifndef FKNUTH_H
#define FKNUTH_H
\endhide
#include "gdef.h"
#include "ffam.h"
#include "fres.h"
#include "fcho.h"


extern long fknuth_Maxn;
\endcode
\tab
  Upper bound on $n$.
  A test is called only when $n$ does not exceed this value.
  Default value: $2^{22}$.
 \hpierre {Pourquoi $2^{22}$ ici et $2^{20}$ ailleurs? }
 \hrichard {Il n'y a pas de raison sp\'eciale. Je ne sais pas quelle valeur 
    mettre par d\'efaut.}
 \hpierre {Alors il me semble qu'il faut mettre la m\^eme valeur partout.
   Peut-\^etre $2^{22}$, ou plus. }
\endtab
\ifdetailed  %%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\guisec{Structure for test results}

The test results for the {\tt fknuth\_MaxOft} test can be recovered
in the following structure.

\code

typedef struct {
   fres_Cont *Chi;
   fres_Cont *AD;
} fknuth_Res1;
\endcode
 \tab
  Structure for keeping the tables of results of the tests in
  {\tt fknuth\_MaxOft}. The results for the chi-square test are kept in
  {\tt Chi}, and for the Anderson-Darling test in  {\tt AD}.
 \endtab
\code


fknuth_Res1 * fknuth_CreateRes1 (void);
\endcode
 \tab 
  Creates and returns a structure that will hold the results
  of a  {\tt fknuth\_MaxOft} test. 
 \endtab
\code


void fknuth_DeleteRes1 (fknuth_Res1 *res);
\endcode
 \tab 
  Frees the memory allocated by {\tt fknuth\_CreateRes1}.
 \endtab

\fi    %%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\guisec{Applying the tests}

\code

void fknuth_Serial1 (void);
\endcode
\tab This is equivalent to calling 
 {\tt fmultin\_Serial1} with {\tt Sparse = FALSE}, 
  {\tt NbDelta = 1}, and {\tt Val\-Delta[0] = 1}.
 \endtab
\code


void fknuth_SerialSparse1 (void);
\endcode
\tab This is equivalent to calling {\tt fmultin\_Serial1} with 
  {\tt Sparse = TRUE},  {\tt NbDelta = 1}, and {\tt Val\-Delta[0] = 1}.
 \endtab
\code


void fknuth_Collision1 (void);
\endcode
\tab This is equivalent to calling {\tt fmultin\_Serial1} with 
  {\tt Sparse = TRUE, NbDelta = 1}, and {\tt Val\-Delta[0] = -1}.
 \endtab
\code


void fknuth_Permutation1 (void);
\endcode
\tab This is equivalent to  calling {\tt fmultin\_Permut1} with 
  {\tt Sparse = FALSE, NbDelta = 1}, and
  {\tt Val\-Delta[0] = 1}.
 \endtab
\code


void fknuth_CollisionPermut1 (void);
\endcode
\tab This is equivalent to  calling {\tt fmultin\_Permut1} with 
  {\tt Sparse = TRUE},  {\tt NbDelta = 1},  and {\tt Val\-Delta[0] = -1}.
 \endtab
\code


void fknuth_Gap1 (ffam_Fam *fam, fres_Cont *res, fcho_Cho *cho,
                  long N, int r, double Alpha, double Beta,
                  int Nr, int j1, int j2, int jstep);
\endcode
\tab
 This function calls the test {\tt sknuth\_Gap} with parameters
 {\tt N, $n$, r, Alpha, Beta}, for sample size $n$ chosen by the function
 {\tt cho->Choose(param, i, j)},
 for the first {\tt Nr} generators of family {\tt fam}, for $j$ going from
 {\tt j1} to {\tt j2} by steps of {\tt jstep}. The parameters in {\tt param}
 were set at the creation of {\tt cho} and $i$ is the lsize of the
 generator being tested.
 When $n$ exceeds {\tt fknuth\_Maxn}, the test is not run.
\endtab
\code


void fknuth_SimpPoker1 (ffam_Fam *fam, fres_Cont *res, fcho_Cho *cho,
                        long N, int r, int d, int k,
                        int Nr, int j1, int j2, int jstep);
\endcode
  \tab Similar to {\tt fknuth\_Gap} but with {\tt sknuth\_SimpPoker}.
  \endtab
\code


void fknuth_CouponCollector1 (ffam_Fam *fam, fres_Cont *res, fcho_Cho *cho,
                              long N, int r, int d,
                              int Nr, int j1, int j2, int jstep);
\endcode
  \tab Similar to {\tt fknuth\_Gap} but with {\tt sknuth\_CouponCollector}.
 \endtab
\code


void fknuth_Run1 (ffam_Fam *fam, fres_Cont *res, fcho_Cho *cho,
                  long N, int r, lebool Up, lebool Indep,
                  int Nr, int j1, int j2, int jstep);

\endcode
  \tab Similar to {\tt fknuth\_Gap} but with {\tt sknuth\_RunIndep}
  if {\tt Indep = TRUE}, and {\tt sknuth\_Run} otherwise.
 \endtab
\code


void fknuth_MaxOft1 (ffam_Fam *fam, fknuth_Res1 *res, fcho_Cho *cho,
                     long N, int r, int d, int t,
                     int Nr, int j1, int j2, int jstep);
\endcode
  \tab Similar to {\tt fknuth\_Gap} but with {\tt sknuth\_MaxOft}.
 \endtab
\code\hide
#endif
\endhide\endcode
