/* nag_mv_prin_coord_analysis (g03fac) Example Program. * * Copyright 1998 Numerical Algorithms Group. * * Mark 5, 1998. * Mark 7 revised, 2001. * */ #include #include #include #include #define NMAX 14 #define NNMAX NMAX*(NMAX-1)/2 #define XTMP(I) xtmp[(I)-1] #define YTMP(I) ytmp[(I)-1] int main(void) { double d[NNMAX], e[NMAX], x[NMAX][NMAX]; Integer ndim; Integer tdx=NMAX; Integer i, j, n; Integer nn; char char_roots[2]; Nag_Eigenvalues roots; Vprintf("g03fac Example Program Results\n\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld",&n); Vscanf("%ld",&ndim); Vscanf("%s",char_roots); if (n <= NMAX) { nn = n * (n - 1) / 2; for (i = 0; i < nn; ++i) Vscanf("%lf",&d[i]); if (*char_roots == 'L') roots = Nag_LargeEigVals; else roots = Nag_AllEigVals; g03fac(roots, n, d, ndim, &x[0][0], tdx, e, NAGERR_DEFAULT); Vprintf("\nScaled Eigenvalues\n\n"); if (*char_roots == 'L') { for (i = 0; i < ndim; ++i) Vprintf("%10.4f",e[i]); } else { for (i = 0; i < n; ++i) Vprintf("%10.4f",e[i]); Vprintf("\n"); } Vprintf("\nCo-ordinates\n\n"); for (i = 0; i < n; ++i) { for (j = 0; j < ndim; ++j) Vprintf("%10.4f",x[i][j]); Vprintf("\n"); } return EXIT_SUCCESS; } else { Vprintf("Incorrect input value of n or m.\n"); return EXIT_FAILURE; } }