code: public double det() {
          int m = lu.nrows();
          int n = lu.ncols();
  
          if (m != n)
              throw new IllegalArgumentException(String.format("Matrix is not square: %d x %d", m, n));
  
          double d = (double) pivsign;
          for (int j = 0; j < n; j++) {
              d *= lu.get(j, j);
          }
  
          return d;
      }
docs: Returns the matrix determinant