//Two files in the VAc dynamic model software package //parent-routine: column.c //Copyright: Rong Chen and Kedar Dave, June 2002 //VERSION 1.0 //This routine is to do the LU decomposition calculation //The matrix A is now a vector A of size N^2 //The variable N does not refer to the number of grid points along the x or y axis //It instead refers to the total number of grid points in the problem //So if you split your 2-D area into a 11x11 grid, N would equal 121. //source code is from http://www.cen.uiuc.edu/~me310/home.html //Courtesy: Travis Grove #include Ludcmp(int N, double A[], int Indx[]) { int i, j, k, D, Imax; double Tiny, Dum, sum, AAmax; double *VV; VV = (double *)calloc(N, sizeof(double)); Tiny=1E-20; D=1; for (i=0; iAAmax) { AAmax=fabs(A[i*N+j]); } } if(AAmax==0) { printf("Singular Matrix \n"); } VV[i]=(double) 1/AAmax; } for(j=0; j0) { for(i=0; i0) { for(k=0; k0) { for(k=0; k=AAmax) { Imax=i; AAmax=Dum; } } if(j!=Imax) { for(k=0; k=0; i--) { sum=B[i]; if(i