public Matrix inverse() {
    double value = determinant();
    if (value == 0) throw new IllegalArgumentException("determinant is 0");
    return cofactor().transpose().multiply(1 / value);
  }
public Matrix inverse()