code: public static void swapPivot(double[][] source, int diag, double[][] s, double[][] t) {
  		// get swap row and col
  		int swapRow = diag;
  		int swapCol = diag;
  		double maxValue = Math.abs(source[diag][diag]);
  		int rows = source.length;
  		int cols = source[0].length;
  		double abs = 0;
  		double[] r = null;
  		for (int row = diag; row < rows; row++) {
  			r = source[row];
  			for (int col = diag; col < cols; col++) {
  				abs = Math.abs(r[col]);
  				if (abs > maxValue) {
  					maxValue = abs;
  					swapRow = row;
  					swapCol = col;
  				}
  			}
  		}
  
  		// swap rows and columns
  		if (swapRow != diag) {
  			swapRows(source, swapRow, diag);
  			swapRows(t, swapRow, diag);
  		}
  		if (swapCol != diag) {
  			swapCols(source, swapCol, diag);
  			swapCols(s, swapCol, diag);
  		}
  	}
docs: Swap the matrices so that the largest value is on the pivot
  
  @param source
  the matrix to modify
  @param diag
  the position on the diagonal
  @param s
  the matrix s
  @param t
  the matrix t