/* nag_normal_scores_exact (g01dac) Example Program. * * Copyright 2001 Numerical Algorithms Group. * * Mark 7, 2001. */ #include #include #include #include int main(void) { /* Scalars */ double errest, etol; Integer exit_status, i, j, n, nmax; NagError fail; /* Arrays */ double *pp=0; Vprintf("g01dac Example Program Results\n"); INIT_FAIL(fail); exit_status = 0; etol = 0.001; nmax = 15; /* Allocate memory */ if ( !(pp = NAG_ALLOC(nmax, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } for (j = 5; j <= nmax; j += 5) { n = j; g01dac(n, pp, etol, &errest, &fail); Vprintf("\nSet size = %2ld\n\n", n); Vprintf("Error tolerance (input) = %13.3e\n\n", etol); Vprintf("Error estimate (output) = %13.3e\n\n", errest); Vprintf("Normal scores\n"); for (i = 1; i <= n; ++i) { Vprintf("%10.3f", pp[i - 1]); Vprintf(i%5 == 0 || i == n ?"\n":" "); } Vprintf("\n"); if (fail.code != NE_NOERROR) { Vprintf("Error from g01dac.\n%s\n", fail.message); exit_status = 1; } } END: if (pp) NAG_FREE(pp); return exit_status; }