code: public double[][] toDenseArray() {
          double[][] m = new double[rows][cols];
          int i = 0;
          for (int row = 0; row < rows; ++row) {
              for (int col = 0; col < cols; ++col)
                  m[row][col] = matrix[i++];
          }
          return m;
      }
docs: {@inheritDoc}