I was writing a C program on LU Decomposition.

As a start, I was able to do the following for the library file:

a is the matrix, n means the matrix a is n by n, dont mind b and c yet.

int LU(double ** a, int n, double ** b, double **c) { double p; int i, j; for(i=1; i < n; i++){ if( a[i][0] !=0 ) { p = a[i][0]; for(j=0; j < n; j++){ a[i][j] = a[i][j] - p*(a[0][j]/a[0][0]); } } } return 1; }

But the following is only good for the first column of the matrix.

By the way, this screenshot shows the progress of the U MATRIX.

As you can see, this is not yet a complete U Matrix.

How do I expand the function I wrote? Thanks!