List of utility methods to do Matrix Swap
void | swap(double[][] noteOrder, final int i, final int j) swap double temp; for (int a = 0; a < 4; a++) { temp = noteOrder[i][a]; noteOrder[i][a] = noteOrder[j][a]; noteOrder[j][a] = temp; |
void | swap2d(Object[][] array, int c1, int r1, int c2, int r2) A method for swapping matrix cells in-place. if (array == null) { throw new IllegalArgumentException("Array must not be null"); Object swap = array[c1][r1]; array[c1][r1] = array[c2][r2]; array[c2][r2] = swap; |
void | swapColumns(byte[][] matrix, int a, int b) swap Columns byte auxPos; for (int row = 0; row < matrix.length; row++) { auxPos = matrix[row][a]; matrix[row][a] = matrix[row][b]; matrix[row][b] = auxPos; |
void | swapColumns(double[][] front, int colA, int colB) swap Columns if (front.length == 0 || (colA > front.length) || (colB > front.length)) throw new Exception("Selected dimensions exceed front size"); else { int setPointMin = Math.min(colA, colB); int setPointMax = Math.max(colA, colB); for (int i = 0; i < front.length; i++) { double back = 0.0; for (int j = 0; j < front[0].length; j++) { ... |
void | swapColumns(int i, int j, boolean[][] matrix) swap Columns int m = matrix.length; if (m == 0) { return; int n = matrix[0].length; if (i >= n || j >= n || i == j) { return; boolean temp; for (int k = 0; k < m; k++) { temp = matrix[k][i]; matrix[k][i] = matrix[k][j]; matrix[k][j] = temp; |
double[][] | swapRows(double[][] a, int i, int j) Swap two rows in the matrix double[] temp = a[i]; a[i] = a[j]; a[j] = temp; return a; |
void | swapRows(double[][] Ab, int k, int i) swap Rows double[] aux = Ab[i];
Ab[i] = Ab[k];
Ab[k] = aux;
|
void | swapRows(double[][] matrix, int i1, int i2) Swaps two rows of a matrix. double[] row1 = matrix[i1];
matrix[i1] = matrix[i2];
matrix[i2] = row1;
|
byte[][] | swapShorts(byte bs[][]) swap Shorts int carry = 0; for (int i = 0; i < bs.length; i++) { byte[] b = bs[i]; if (carry != 0) swapLastFirst(bs[i - 1], b); int len = b.length - carry; swapShorts(b, carry, len & ~1); carry = len & 1; ... |
int[][] | swapTwoBlocks(int[][] pattern, int block1, int block2) swap Two Blocks int[] temp_row1 = pattern[0 + 3 * block1]; int[] temp_row2 = pattern[1 + 3 * block1]; int[] temp_row3 = pattern[2 + 3 * block1]; pattern[0 + 3 * block1] = pattern[0 + 3 * block2]; pattern[1 + 3 * block1] = pattern[1 + 3 * block2]; pattern[2 + 3 * block1] = pattern[2 + 3 * block2]; pattern[0 + 3 * block2] = temp_row1; pattern[1 + 3 * block2] = temp_row2; ... |