/* nag_real_eigenvalues (f02afc) Example Program. * * Copyright 1990 Numerical Algorithms Group. * * Mark 2 revised, 1992. * Mark 8 revised, 2004. */ #include #include #include #include #define COMPLEX(A) A.re, A.im #define A(I,J) a[(I)*tda + J] int main(void) { Complex *r=0; Integer exit_status=0, i, *iter=0, j, n, tda; NagError fail; double *a=0; INIT_FAIL(fail); Vprintf("nag_real_eigenvalues (f02afc) Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld",&n); if (n>=1) { if ( !( a = NAG_ALLOC(n*n, double)) || !( iter = NAG_ALLOC(n, Integer)) || !( r = NAG_ALLOC(n, Complex)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } tda = n; } else { Vprintf("Invalid n.\n"); exit_status = 1; return exit_status; } for (i=0; i