@Test public void testSwap() { Matrix m = new DenseMatrix(10, 10); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { m.set(i, j, 10 * i + j); } } PivotedMatrix pm = new PivotedMatrix(m); pm.swap(3, 5); assertEquals(0, pm.viewDiagonal().minus( new DenseVector(new double[]{0, 11, 22, 55, 44, 33, 66, 77, 88, 99})).norm(1), 1.0e-10); pm.swap(2, 7); assertEquals(0, pm.viewDiagonal().minus( new DenseVector(new double[]{0, 11, 77, 55, 44, 33, 66, 22, 88, 99})).norm(1), 1.0e-10); pm.swap(5, 8); assertEquals(0, pm.viewColumn(4).minus( new DenseVector(new double[]{4.0,14.0,74.0,54.0,44.0,84.0,64.0,24.0,34.0,94.0})).norm(1), 1.0e-10); assertEquals(0, pm.viewDiagonal().minus( new DenseVector(new double[]{0, 11, 77, 55, 44, 88, 66, 22, 33, 99})).norm(1), 1.0e-10); }
public void swap(int i, int j) { swapRows(i, j); swapColumns(i, j); }
PivotedMatrix extends AbstractMatrix { public void swap(int i, int j) { swapRows(i, j); swapColumns(i, j); } }
PivotedMatrix extends AbstractMatrix { public void swap(int i, int j) { swapRows(i, j); swapColumns(i, j); } PivotedMatrix(Matrix base, int[] pivot);  PivotedMatrix(Matrix base, int[] rowPivot, int[] columnPivot);  PivotedMatrix(Matrix base); }
PivotedMatrix extends AbstractMatrix { public void swap(int i, int j) { swapRows(i, j); swapColumns(i, j); } PivotedMatrix(Matrix base, int[] pivot);  PivotedMatrix(Matrix base, int[] rowPivot, int[] columnPivot);  PivotedMatrix(Matrix base); void swap(int i, int j); void swapRows(int i, int j); void swapColumns(int i, int j); @Override Matrix assignColumn(int column, Vector other); @Override Matrix assignRow(int row, Vector other); @Override Vector viewColumn(int column); @Override Vector viewRow(int row); @Override double getQuick(int row, int column); @Override Matrix like(); @Override Matrix clone(); @Override Matrix like(int rows, int columns); @Override void setQuick(int row, int column, double value); @Override int[] getNumNondefaultElements(); @Override Matrix viewPart(int[] offset, int[] size); int rowUnpivot(int k); int columnUnpivot(int k); int[] getRowPivot(); int[] getInverseRowPivot(); int[] getColumnPivot(); int[] getInverseColumnPivot(); Matrix getBase(); }
PivotedMatrix extends AbstractMatrix { public void swap(int i, int j) { swapRows(i, j); swapColumns(i, j); } PivotedMatrix(Matrix base, int[] pivot);  PivotedMatrix(Matrix base, int[] rowPivot, int[] columnPivot);  PivotedMatrix(Matrix base); void swap(int i, int j); void swapRows(int i, int j); void swapColumns(int i, int j); @Override Matrix assignColumn(int column, Vector other); @Override Matrix assignRow(int row, Vector other); @Override Vector viewColumn(int column); @Override Vector viewRow(int row); @Override double getQuick(int row, int column); @Override Matrix like(); @Override Matrix clone(); @Override Matrix like(int rows, int columns); @Override void setQuick(int row, int column, double value); @Override int[] getNumNondefaultElements(); @Override Matrix viewPart(int[] offset, int[] size); int rowUnpivot(int k); int columnUnpivot(int k); int[] getRowPivot(); int[] getInverseRowPivot(); int[] getColumnPivot(); int[] getInverseColumnPivot(); Matrix getBase();  }