need help solving Gaussian method for inverse

i got some code but its not working or compiling. i need to use this code to find inverse of any size matrix. specific help would be appreciated. here is my code:

public static double[][] GaussianEliminverse(double[][] A,int B)

{

double[][] b = new double[B][B];

for (int row = 0; row < B; row++) {

for (int col = 0; col < B; col++) {

if (row == col) {

b[row][col] = 1;

} else {

b[row][col] = 0;

}

}

}

double pivot, factor;

int i;

int j;

int k;

int n = b.length;

for (i = 0; i < n; i++) {

pivot = A[i][i];

for (j = 0; j < n; j++)

A[i][j] = A[i][j] / pivot;

b[i][j] = b[i][j] / pivot;

for (k = 0; k < n; k++) {

if (k != i) {

factor = A[k][i];

for (j = 0; j < n; j++)

A[k][j] = A[k][j] - factor * A[i][j];

b[k][j] = b[k][j] - factor * b[i][j];

}

}

}

for (int row = 0; row < b.length; row++) {

for (int col = 0; col < b[row].length; col++) {

System.out.print(b[row][col] + " ");

}

System.out.println();

}

return (b);

}

Re: need help solving Gaussian method for inverse

Please keep this discussion in your other thread:

http://www.javaprogrammingforums.com...-matrices.html

I am locking this thread.