/* nag_return_multi_normal (g05ezc) Example Program. * * Copyright 1991 Numerical Algorithms Group. * * Mark 2, 1991. * * Mark 3 revised, 1994. */ #include #include #include #include #define N 2 #define TDC N int main(void) { Integer exit_status = 0; Integer i, j; double a[N], c[N][TDC], z[N]; double *r; double eps = 0.01; NagError fail; INIT_FAIL(fail); printf("nag_return_multi_normal (g05ezc) Example Program Results\n"); a[0] = 1.0; a[1] = 2.0; c[0][0] = 2.0; c[1][1] = 3.0; c[0][1] = 1.0; c[1][0] = 1.0; /* nag_random_init_repeatable (g05cbc). * Initialize random number generating functions to give * repeatable sequence */ nag_random_init_repeatable((Integer) 0); /* nag_ref_vec_multi_normal (g05eac). * Set up reference vector for multivariate Normal * distribution */ nag_ref_vec_multi_normal(a, (Integer) N, &c[0][0], (Integer) TDC, eps, &r, &fail); if (fail.code != NE_NOERROR) { printf("Error from nag_return_multi_normal (g05ezc) %s\n", fail.message); exit_status = 1; goto END; } for (i = 1; i <= 5; i++) { /* nag_return_multi_normal (g05ezc). * Pseudo-random multivariate Normal vector from reference * vector */ nag_return_multi_normal(z, r); for (j = 0; j < (Integer) N; j++) printf("%10.4f", z[j]); printf("\n"); } END: if (r) NAG_FREE(r); return exit_status; }