/* nag_runs_test (g08eac) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * Mark 6, 2000. */ #include #include #include #include #include int main(void) { double chi, df, enda, endb, p, *x=0; Integer i, init, max_run, n, nruns; Integer exit_status=0; NagError fail; INIT_FAIL(fail); Vprintf("g08eac Example Program Results\n"); n = 10000; if (!(x = NAG_ALLOC(n, double))) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } init = 0; g05cbc(init); enda = 0.0; endb = 1.0; for (i = 0; i < n; i++) x[i] = g05dac(enda, endb); max_run = 6; g08eac(n, x, max_run, &nruns, &chi, &df, &p, &fail); if (fail.code == NE_NOERROR || fail.code == NE_G08EA_RUNS) { Vprintf("\n"); Vprintf("%s%10ld\n", "Total number of runs found = ", nruns); if (fail.code == NE_G08EA_RUNS) Vprintf("%s\n", " ** Note : the number of runs requested were not found."); Vprintf("\n"); Vprintf("%s%10.4f\n", "Chisq = ", chi); Vprintf("%s%8.2f\n", "DF = ", df); Vprintf("%s%10.4f\n", "Prob = ", p); } else { Vprintf("Error from g08eac.\n%s\n", fail.message); exit_status = 1; goto END; } END: if (x) NAG_FREE(x); return exit_status; }