static HeapQuickSelectSketch heapifyInstance ( final Memory srcMem , final long seed ) { final int preambleLongs = extractPreLongs ( srcMem ) ; //byte 0 final int lgNomLongs = extractLgNomLongs ( srcMem ) ; //byte 3 final int lgArrLongs = extractLgArrLongs ( srcMem ) ; //byte 4 checkUnionQuickSelectFamily ( srcMem , preambleLongs , lgNomLongs ) ; checkMemIntegrity ( srcMem , seed , preambleLongs , lgNomLongs , lgArrLongs ) ; final float p = extractP ( srcMem ) ; //bytes 12-15 final int lgRF = extractLgResizeFactor ( srcMem ) ; //byte 0 ResizeFactor myRF = ResizeFactor . getRF ( lgRF ) ; final int familyID = extractFamilyID ( srcMem ) ; final Family family = Family . idToFamily ( familyID ) ; if ( ( myRF == ResizeFactor . X1 ) && ( lgArrLongs != Util . startingSubMultiple ( lgNomLongs + 1 , myRF , MIN_LG_ARR_LONGS ) ) ) { myRF = ResizeFactor . X2 ; } final HeapQuickSelectSketch hqss = new HeapQuickSelectSketch ( lgNomLongs , seed , p , myRF , preambleLongs , family ) ; hqss . lgArrLongs_ = lgArrLongs ; hqss . hashTableThreshold_ = setHashTableThreshold ( lgNomLongs , lgArrLongs ) ; hqss . curCount_ = extractCurCount ( srcMem ) ; hqss . thetaLong_ = extractThetaLong ( srcMem ) ; hqss . empty_ = PreambleUtil . isEmpty ( srcMem ) ; hqss . cache_ = new long [ 1 << lgArrLongs ] ; srcMem . getLongArray ( preambleLongs << 3 , hqss . cache_ , 0 , 1 << lgArrLongs ) ; //read in as hash table return hqss ; }
Heapify a sketch from a Memory UpdateSketch or Union object containing sketch data .