/* nag_gaps_test (g08edc) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * Mark 6, 2000. */ #include #include #include #include #include int main (void) { Integer i, init, max_gap, n, num_gaps; Integer exit_status=0; double chi, df, enda, endb, lower, length, p, upper, *x=0; NagError fail; INIT_FAIL(fail); Vprintf("g08edc Example Program Results\n"); init = 0; g05cbc(init); n = 5000; if (!(x = NAG_ALLOC(n, double))) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } enda = 0.0; endb = 1.0; for (i = 0; i < n; i++) x[i] = g05dac(enda, endb); num_gaps = 0; max_gap = 10; length = 1.0; lower = 0.4; upper = 0.6; g08edc(n, x, num_gaps, max_gap, lower, upper, length, &chi, &df, &p, &fail); if (fail.code != NE_NOERROR && fail.code != NE_G08ED_GAPS && NE_G08ED_FREQ_LT_ONE) { Vprintf("Error from g08edc.\n%s\n", fail.message); exit_status = 1; goto END; } Vprintf("\n"); Vprintf("%s%10.4f\n", "Chisq = ", chi); Vprintf("%s%7.1f\n", "DF = ", df); Vprintf("%s%10.4f\n", "Prob = ", p); if (fail.code == NE_G08ED_FREQ_LT_ONE) Vprintf("Error from g08edc.\n%s\n", fail.message); END: if (x) NAG_FREE(x); return exit_status; }