// invert.java invert(A[][]) in place public class invert { invert(double A[][]) { int n = A.length; int row[] = new int[n]; int col[] = new int[n]; double temp[] = new double[n]; int hold , I_pivot , J_pivot; double pivot, abs_pivot; if(A[0].length!=n) { System.out.println("Error inverse, inconsistent array sizes."); } // set up row and column interchange vectors for(int k=0; k abs_pivot) { I_pivot = i ; J_pivot = j ; pivot = A[row[i]][col[j]] ; } } } if(Math.abs(pivot) < 1.0E-10) { System.out.println("Matrix is singular !"); return; } hold = row[k]; row[k]= row[I_pivot]; row[I_pivot] = hold ; hold = col[k]; col[k]= col[J_pivot]; col[J_pivot] = hold ; // reduce about pivot A[row[k]][col[k]] = 1.0 / pivot ; for(int j=0; j