/* nag_mv_z_scores (g03zac) Example Program. * * Copyright 1998 Numerical Algorithms Group. * * Mark 5, 1998. * */ #include #include #include #include #define NMAX 4 #define MMAX 3 int main(void) { double e[MMAX], s[MMAX], x[NMAX][MMAX], z[NMAX][MMAX]; Integer nvar; Integer isx[MMAX]; Integer i, j, m, n; Integer tdx=MMAX, tdz=MMAX; Vprintf("g03zac Example Program Results\n\n"); /* Skip headings in data file */ Vscanf("%*[^\n]"); Vscanf("%ld",&n); Vscanf("%ld",&m); Vscanf("%ld",&nvar); if (m <= MMAX && n <= NMAX) { for (i = 0; i < n; ++i) { for (j = 0; j < m; ++j) Vscanf("%lf",&x[i][j]); } for (j = 0; j < m; ++j) Vscanf("%ld",&isx[j]); for (j = 0; j < m; ++j) Vscanf("%lf",&e[j]); for (j = 0; j < m; ++j) Vscanf("%lf",&s[j]); g03zac(n, m, &x[0][0], tdx, nvar, isx, s, e, &z[0][0], tdz, NAGERR_DEFAULT); Vprintf("\nStandardized Values\n\n"); for (i = 0; i < n; ++i) { for (j = 0; j < nvar; ++j) Vprintf("%8.3f",z[i][j]); Vprintf("\n"); } return EXIT_SUCCESS; } else { Vprintf("Incorrect input value of n or m.\n"); return EXIT_FAILURE; } }