private Matrix exclude(int column, int row) {
    validate(column, width);
    validate(row, height);

    int width = getColumns() - 1;
    if (width == 0) throw new IllegalArgumentException("cannot exclude last column");

    int height = getRows() - 1;
    if (height == 0) throw new IllegalArgumentException("cannot exclude last row");

    double[] result = new double[width * height];
    int index = 0;
    for (int i = 0, h = 0; h <= height; h++) {
      for (int w = 0; w <= width; w++, i++) {
        if (w != column && h != row) {
          result[index++] = vector.get(i);
        }
      }
    }
    return new Matrix(width, height, result);
  }
private Matrix exclude(int column, int row)