Beispiel #1
0
  protected BigRational multiplyRow(int index) throws UndefinedMultiplyException {

    BigRational result = BigRational.ZERO;

    for (int j = 0; j < size.col; j++) {
      if (!array[index][j].isZero()) {
        if (basis.getNewValue(j + position.col).isPositive()) {
          result = result.add((array[index][j].multiply(basis.getNewValue(j + position.col))));
        } else if (basis.getNewValue(j + position.col).isUndefined()) {
          throw new UndefinedMultiplyException();
        }
      }
    }
    return result;
  }
Beispiel #2
0
  private BigRational multiplyBlockRow(BigRational[][] array, int index, int starting_col)
      throws UndefinedMultiplyException {

    BigRational result = BigRational.ZERO;
    int cols = array[0].length;

    for (int j = 0; j < cols; j++) {
      if (!array[index][j].isZero()) {
        if (basis.getNewValue(j + starting_col).isPositive()) {
          result = result.add((array[index][j].multiply(basis.getNewValue(j + starting_col))));
        } else if (basis.getNewValue(j + starting_col).isUndefined()) {
          throw new UndefinedMultiplyException();
        }
      }
    }
    return result;
  }
Beispiel #3
0
  public void write(int row, int col, BigRational value) {
    int block_row = row / rows_in_blocks;
    int row_in_block = row % rows_in_blocks;

    int block_col = col / cols_in_blocks;
    int col_in_block = col % cols_in_blocks;

    matrix[block_row][block_col][row_in_block][col_in_block] = value.copy(); // TODO copy?
  }