/* nag_real_general_eigensystem (f02bjc) Example Program. * * Copyright 1991 Numerical Algorithms Group. * * Mark 2, 1991. * Mark 8 revised, 2004. */ #include #include #include #include #include #include #define A(I,J) a[(I)*tda + J] #define B(I,J) b[(I)*tdb + J] #define Z(I,J) z[(I)*tdz + J] int main(void) { Nag_Boolean matz; Complex *alfa=0; Integer exit_status=0, i, ip, *iter=0, j, k, n, tda, tdb, tdz; NagError fail; double *a=0, *b=0, *beta=0, eps1, *z=0; INIT_FAIL(fail); Vprintf("nag_real_general_eigensystem (f02bjc) Example Program Results\n"); Vscanf("%*[^\n]"); /* Skip heading in data file */ Vscanf("%ld", &n); if (n>=1) { if ( !( beta = NAG_ALLOC(n, double)) || !( a = NAG_ALLOC(n*n, double)) || !( b = NAG_ALLOC(n*n, double)) || !( z = NAG_ALLOC(n*n, double)) || !( iter = NAG_ALLOC(n, Integer)) || !( alfa = NAG_ALLOC(n, Complex)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } tda = n; tdb = n; tdz = n; } else { Vprintf("Invalid n.\n"); exit_status = 1; return exit_status; } for (i=0; i