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