code: public static Basic1DMatrix from2DArray(double[][] array) {
          int rows = array.length;
          int columns = array[0].length;
          double[] array1D = new double[rows * columns];
  
          int offset = 0;
          for (int i = 0; i < rows; i++) {
              System.arraycopy(array[i], 0, array1D, offset, columns);
              offset += columns;
          }
  
          return new Basic1DMatrix(rows, columns, array1D);
      }
docs: Creates a {@link Basic1DMatrix} of the given 2D {@code array} with
  copying the underlying array.