UpdateDoublesSketch downSampleInternal(final DoublesSketch srcSketch, final int smallerK,
                                         final WritableMemory dstMem) {
    final UpdateDoublesSketch newSketch = (dstMem == null)
            ? HeapUpdateDoublesSketch.newInstance(smallerK)
            : DirectUpdateDoublesSketch.newInstance(smallerK, dstMem);
    if (srcSketch.isEmpty()) { return newSketch; }
    DoublesMergeImpl.downSamplingMergeInto(srcSketch, newSketch);
    return newSketch;
  }
UpdateDoublesSketch downSampleInternal ( final DoublesSketch srcSketch , final int smallerK , final WritableMemory dstMem ) { final UpdateDoublesSketch newSketch = ( dstMem == null ) ? HeapUpdateDoublesSketch . newInstance ( smallerK ) : DirectUpdateDoublesSketch . newInstance ( smallerK , dstMem ) ; if ( srcSketch . isEmpty ( ) ) { return newSketch ; } DoublesMergeImpl . downSamplingMergeInto ( srcSketch , newSketch ) ; return newSketch ; }
/*
DoublesMergeImpl.downSamplingMergeInto requires the target sketch to implement update(), so
we ensure that the target is an UpdateSketch. The public API, on the other hand, just
specifies a DoublesSketch. This lets us be more specific about the type without changing the
public API.