/* nag_mv_orthomax (g03bac) Example Program. * * Copyright 1998 Numerical Algorithms Group. * * Mark 5, 1998. * */ #include #include #include #include #define NMAX 10 #define MMAX 3 int main(void) { double g; double r[MMAX][MMAX]; double fl[NMAX][MMAX],acc, flr[NMAX][MMAX]; Integer iter, nvar; Integer i, j, k; Integer maxit; Integer tdf = MMAX; Integer tdr = MMAX; char char_stand[2]; Nag_RotationLoading stand; Vprintf("g03bac Example Program Results\n\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld",&nvar); Vscanf("%ld",&k); Vscanf("%lf",&g); Vscanf("%s",char_stand); Vscanf("%lf",&acc); Vscanf("%ld",&maxit); if (*char_stand == 'S') stand = Nag_RoLoadStand; else stand = Nag_RoLoadNotStand; if (nvar <= NMAX && k <= MMAX) { for (i = 0; i < nvar; ++i) { for (j = 0; j < k; ++j) Vscanf("%lf",&fl[i][j]); } g03bac(stand, g, nvar, k, &fl[0][0], tdf, &flr[0][0], &r[0][0], tdr, acc, maxit, &iter, NAGERR_DEFAULT); Vprintf("\n Rotated factor loadings\n\n"); for (i = 0; i < nvar; ++i) { for (j = 0; j < k; ++j) Vprintf(" %8.3f",flr[i][j]); Vprintf("\n"); } Vprintf("\n Rotation matrix\n\n"); for (i = 0; i < k; ++i) { for (j = 0; j < k; ++j) Vprintf(" %8.3f",r[i][j]); Vprintf("\n"); } return EXIT_SUCCESS; } else { Vprintf("Incorrect input value of nvar or k.\n"); return EXIT_FAILURE; } }