public double determinant() {
    if (width != height) throw new IllegalArgumentException("not a square");
    if (width == 1) return vector.get(0);
    if (width == 2) return vector.get(0) * vector.get(3) - vector.get(1) * vector.get(2);
    double result = 0;
    for (int i = 0; i < width; i++) {
      double value = vector.get(i) * exclude(i, 0).determinant();
      result -= isEven(i) ? -value : value;
    }
    return result;
  }
public double determinant()