static DirectUpdateDoublesSketch newInstance ( final int k , final WritableMemory dstMem ) { // must be able to hold at least an empty sketch final long memCap = dstMem . getCapacity ( ) ; checkDirectMemCapacity ( k , 0 , memCap ) ; //initialize dstMem dstMem . putLong ( 0 , 0L ) ; //clear pre0 insertPreLongs ( dstMem , 2 ) ; insertSerVer ( dstMem , DoublesSketch . DOUBLES_SER_VER ) ; insertFamilyID ( dstMem , Family . QUANTILES . getID ( ) ) ; insertFlags ( dstMem , EMPTY_FLAG_MASK ) ; insertK ( dstMem , k ) ; if ( memCap >= COMBINED_BUFFER ) { insertN ( dstMem , 0L ) ; insertMinDouble ( dstMem , Double . NaN ) ; insertMaxDouble ( dstMem , Double . NaN ) ; } final DirectUpdateDoublesSketch dds = new DirectUpdateDoublesSketch ( k ) ; dds . mem_ = dstMem ; return dds ; }
Obtains a new Direct instance of a DoublesSketch which may be off - heap .