code: private VarOptItemsSketch<T> migrateMarkedItemsByDecreasingK() {
      final VarOptItemsSketch<T> gcopy = gadget_.copyAndSetN(false, n_);
  
      final int rCount = gcopy.getRRegionCount();
      final int hCount = gcopy.getHRegionCount();
      final int k = gcopy.getK();
  
      assert gcopy.getNumMarksInH() > 0; // ensured by caller
      // either full (of samples), or in pseudo-exact mode, or both
      assert (rCount == 0) || (k == (hCount + rCount));
  
      // if non-full and pseudo-exact, change k so that gcopy is full
      if ((rCount == 0) && (hCount < k)) {
        gcopy.forceSetK(hCount);
      }
  
      // Now k equals the number of samples, so reducing k will increase tau.
      // Also, we know that there are at least 2 samples because 0 or 1 would have been handled
      // by the earlier logic in getResult()
      assert gcopy.getK() >= 2;
      gcopy.decreaseKBy1();
  
      // gcopy is now in estimation mode, just like the final result must be (due to marked items)
      assert gcopy.getRRegionCount() > 0;
      assert gcopy.getTau() > 0.0;
  
      // keep reducing k until all marked items have been absorbed into the reservoir
      while (gcopy.getNumMarksInH() > 0) {
        assert gcopy.getK() >= 2; // because h_ and r_ are both at least 1
        gcopy.decreaseKBy1();
      }
  
      gcopy.stripMarks();
      return gcopy;
    }
docs: this is basically a continuation of getResult()