/* nag_mv_ordinal_multidimscale (g03fcc) Example Program. * * Copyright 1998 Numerical Algorithms Group. * * Mark 5, 1998. * Mark 6 revised, 2000. * Mark 7 revised, 2001. * */ #include #include #include #include #define NMAX 14 #define MMAX 2 #define NNMAX NMAX*(NMAX-1)/2 #define X(I,J) x[(I-1)*NMAX + (J-1)] #define XTMP(I) xtmp[(I)-1] #define YTMP(I) ytmp[(I)-1] int main(void) { double d[NNMAX], dfit[4*NNMAX], wk[NNMAX+15*NMAX*MMAX], x[NMAX*NMAX]; double stress; Integer ndim; Integer i, j, n; Integer nn; Integer tdx = NMAX; char char_type[2]; Nag_ScaleCriterion type; Vprintf("g03fcc Example Program Results\n\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld",&n); Vscanf("%ld",&ndim); Vscanf("%s",char_type); if (n <= NMAX) { nn = n * (n - 1) / 2; for (i = 1; i <= nn; ++i) Vscanf("%lf",&d[i-1]); g03fac(Nag_LargeEigVals, n, d, ndim, x, tdx, wk, NAGERR_DEFAULT); if (*char_type == 'T') type = Nag_Stress; else type = Nag_SStress; g03fcc(type, n, ndim, d, x, tdx, &stress, dfit, E04_DEFAULT, NAGERR_DEFAULT); Vprintf("\n STRESS = %13.4e\n\n",stress); Vprintf("Co-ordinates\n\n"); for (i = 1; i <= n; ++i) { for (j = 1; j <= ndim; ++j) Vprintf("%10.4f",X(i,j)); Vprintf("\n"); } return EXIT_SUCCESS; } else { Vprintf("Incorrect input value of n.\n"); return EXIT_FAILURE; } }