@Test public void testInvertRandomlyBinary() { final int TRIALS = 1000; BinaryField f = new BinaryField(BigInteger.valueOf(0x481)); for (int i = 0; i < TRIALS; i++) { int size = (int)(Math.sqrt(random.nextDouble()) * 9) + 2; size = Math.max(Math.min(size, 10), 1); Matrix<BigInteger> mat = new Matrix<>(size, size, f); for (int j = 0; j < size; j++) { for (int k = 0; k < size; k++) mat.set(j, k, new BigInteger(f.modulus.bitLength() - 1, random)); } testInvert(f, mat); } }
public void set(int row, int col, E val) { if (row < 0 || row >= values.length || col < 0 || col >= values[0].length) throw new IndexOutOfBoundsException("Row or column index out of bounds"); values[row][col] = val; }
Matrix implements Cloneable { public void set(int row, int col, E val) { if (row < 0 || row >= values.length || col < 0 || col >= values[0].length) throw new IndexOutOfBoundsException("Row or column index out of bounds"); values[row][col] = val; } }
Matrix implements Cloneable { public void set(int row, int col, E val) { if (row < 0 || row >= values.length || col < 0 || col >= values[0].length) throw new IndexOutOfBoundsException("Row or column index out of bounds"); values[row][col] = val; } Matrix(int rows, int cols, Field<E> f); }
Matrix implements Cloneable { public void set(int row, int col, E val) { if (row < 0 || row >= values.length || col < 0 || col >= values[0].length) throw new IndexOutOfBoundsException("Row or column index out of bounds"); values[row][col] = val; } Matrix(int rows, int cols, Field<E> f); int rowCount(); int columnCount(); @SuppressWarnings("unchecked") E get(int row, int col); void set(int row, int col, E val); Matrix<E> clone(); Matrix<E> transpose(); String toString(); void swapRows(int row0, int row1); void multiplyRow(int row, E factor); void addRows(int srcRow, int destRow, E factor); Matrix<E> multiply(Matrix<E> other); void reducedRowEchelonForm(); void invert(); E determinantAndRef(); }
Matrix implements Cloneable { public void set(int row, int col, E val) { if (row < 0 || row >= values.length || col < 0 || col >= values[0].length) throw new IndexOutOfBoundsException("Row or column index out of bounds"); values[row][col] = val; } Matrix(int rows, int cols, Field<E> f); int rowCount(); int columnCount(); @SuppressWarnings("unchecked") E get(int row, int col); void set(int row, int col, E val); Matrix<E> clone(); Matrix<E> transpose(); String toString(); void swapRows(int row0, int row1); void multiplyRow(int row, E factor); void addRows(int srcRow, int destRow, E factor); Matrix<E> multiply(Matrix<E> other); void reducedRowEchelonForm(); void invert(); E determinantAndRef();  }