code: public static DenseMatrix matrix(int nrows, int ncols, double value) {
          if (nlmatrixOnes != null) {
              try {
                  return (DenseMatrix) nlmatrixOnes.newInstance(nrows, ncols, value);
              } catch (Exception e) {
                  logger.error("Failed to call NLMatrix(int, int, double): {}", e);
              }
          }
  
          return new JMatrix(nrows, ncols, value);
      }
docs: Creates a matrix filled with given value.