public static void swapCols(double[][] matrix, int col1, int col2) {
		double temp = 0;
		int rows = matrix.length;
		double[] r = null;
		for (int row = 0; row < rows; row++) {
			r = matrix[row];
			temp = r[col1];
			r[col1] = r[col2];
			r[col2] = temp;
		}
	}
public static void swapCols ( double [ ] [ ] matrix , int col1 , int col2 ) { double temp = 0 ; int rows = matrix . length ; double [ ] r = null ; for ( int row = 0 ; row < rows ; row ++ ) { r = matrix [ row ] ; temp = r [ col1 ] ; r [ col1 ] = r [ col2 ] ; r [ col2 ] = temp ; } }
Swap components in the two columns.

@param matrix
the matrix to modify
@param col1
the first row
@param col2
the second row