// Solves Jacobi Computation // // Given an array A, iteratively replace its // elements with the average of their four nearest // neighbors, until the largest change between two // consecutive iterations is less than delta. // // Fixed size version // // Copyright by mpC team, 1999 // // http://www.ispras.ru/~cbr // mpc@ispras.ru // #include #define TYPE double #define N 10 #define DELTA 0.0001 #define PREC 0.01 typedef TYPE (*NxN) [N][N]; TYPE AA[N+2][N+2],T[N][N]; NxN An,As,Ae,Aw,A; int reps; void write_region( NxN r ) { int i,j; for(i=0;iDELTA); } void report() { printf("\nJacobi scheme used %d iterations.\n", reps); } main() { jacobi(); report(); }