// Fast computation of the non asymptotic Cochran's Q statistic for heterogeneity detection
// Fahmy and Belletoile
//

****************
** User guide **
****************

The program is called xlstatCoqExact and takes 3 arguments described below. 

Returned signed integer value of the program is 0 if computations went ok until the end. In this case, the p-value is correct and accessible in the argument called Pvalue. 

If anything went wrong, the returned value is a negative integer. The p-value should not be trusted in this case. Possible returned negative value are:
* -1 : bad allocation (could happen with a large dataset and no time limit, the user is expected to use a smaller dataset)
* -2 : out of range error (not supposed to happen)
* -3 : problem with parameters (user should check the function parameters)
* -4 : unknown error (not supposed to happen)
* -5 : time limit exceeded (user should either increase the time limit or use a smaller dataset)
* -6 : unkown exception (not supposed to happen)

Detailed arguments:

* Table
	- Entry matrix of 16 bit unsigned integers
	- Matrix should be row major
	- Observations are on rows
	- Treatements are on columns
	- Size of the matrix is N x P where N is the number of rows and P is the number of columns
	- Coded with "0" for failure ans "1" successes

* Pvalue
	- double precision output value contains the resulting p-value if computations all went ok (called function returned 0)

* TimeLimit
	- double precision real number 
	- sets a maximum time duration on computations
	- expressed in seconds
	- programs exits if time limit is exceeded and returns -5
	- value below or equal to 0 means no time limit (not recommended)

To compile:	
g++ -Wextra -pedantic -std=c++11 -o3 xlstatExaple.cpp xlstatExactCoq.cpp -o exactCochran	

To execute:
./exactCochran

Source files should be located in the same directory

	