/* gep.c Steve Cox, October 1, 2000 A driver and routines for solving a general linear system The system is a dynamically allocated one dimensional array of pointers. The right hand side is overwritten with the solution. All arrays begin indexing from 0. */ #include #include void trisolve(double *[], int); void rzero(double *[], int , int , int , int ); int gauss(double *[], int); void matview(double *[], int); main() { int j, k, /* counters */ n, /* dimension of A */ info; /* gauss indicator */ double *ptr[100]; /* the matrix */ printf("\n"); printf("How large is your problem? "); scanf("%d",&n); printf("\n"); for (j=0;j max ){ max = fabs(ptr[j][k]); r1 = j; } } if (max < 1e-12) /* if max is small return the bad k */ return k; tmp = ptr[k]; /* swap row#k and row#r1 */ ptr[k] = ptr[r1]; ptr[r1] = tmp; printf("after swapping\n"); matview(ptr,n); for (j=k+1;j=0;j=j-1){ /* now back up through the rows */ tmp = 0; for (k=j+1;k