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