id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
54,900
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/DirectArrayOfDoublesQuickSelectSketch.java
DirectArrayOfDoublesQuickSelectSketch.rebuild
@Override protected void rebuild(final int newCapacity) { final int numValues = getNumValues(); checkIfEnoughMemory(mem_, newCapacity, numValues); final int currCapacity = getCurrentCapacity(); final long[] keys = new long[currCapacity]; final double[] values = new double[currCapacity * numValues]...
java
@Override protected void rebuild(final int newCapacity) { final int numValues = getNumValues(); checkIfEnoughMemory(mem_, newCapacity, numValues); final int currCapacity = getCurrentCapacity(); final long[] keys = new long[currCapacity]; final double[] values = new double[currCapacity * numValues]...
[ "@", "Override", "protected", "void", "rebuild", "(", "final", "int", "newCapacity", ")", "{", "final", "int", "numValues", "=", "getNumValues", "(", ")", ";", "checkIfEnoughMemory", "(", "mem_", ",", "newCapacity", ",", "numValues", ")", ";", "final", "int"...
rebuild in the same memory
[ "rebuild", "in", "the", "same", "memory" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/DirectArrayOfDoublesQuickSelectSketch.java#L256-L277
54,901
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java
HeapAlphaSketch.newHeapInstance
static HeapAlphaSketch newHeapInstance(final int lgNomLongs, final long seed, final float p, final ResizeFactor rf) { if (lgNomLongs < ALPHA_MIN_LG_NOM_LONGS) { throw new SketchesArgumentException( "This sketch requires a minimum nominal entries of " + (1 << ALPHA_MIN_LG_NOM_LONGS)); } ...
java
static HeapAlphaSketch newHeapInstance(final int lgNomLongs, final long seed, final float p, final ResizeFactor rf) { if (lgNomLongs < ALPHA_MIN_LG_NOM_LONGS) { throw new SketchesArgumentException( "This sketch requires a minimum nominal entries of " + (1 << ALPHA_MIN_LG_NOM_LONGS)); } ...
[ "static", "HeapAlphaSketch", "newHeapInstance", "(", "final", "int", "lgNomLongs", ",", "final", "long", "seed", ",", "final", "float", "p", ",", "final", "ResizeFactor", "rf", ")", "{", "if", "(", "lgNomLongs", "<", "ALPHA_MIN_LG_NOM_LONGS", ")", "{", "throw"...
Get a new sketch instance on the java heap. @param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLongs">See lgNomLongs</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a> @param p <a href="{@docRoot}/resources/dictionary.html#p">See Sampling Probability, <i>p</i...
[ "Get", "a", "new", "sketch", "instance", "on", "the", "java", "heap", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java#L77-L99
54,902
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java
HeapAlphaSketch.heapifyInstance
static HeapAlphaSketch 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 checkAlphaF...
java
static HeapAlphaSketch 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 checkAlphaF...
[ "static", "HeapAlphaSketch", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "int", "preambleLongs", "=", "extractPreLongs", "(", "srcMem", ")", ";", "//byte 0", "final", "int", "lgNomLongs", "=", "extractLgN...
Heapify a sketch from a Memory object containing sketch data. @param srcMem The source Memory object. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return instance of this sketch
[ "Heapify", "a", "sketch", "from", "a", "Memory", "object", "containing", "sketch", "data", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java#L108-L139
54,903
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java
HeapAlphaSketch.getR
private static final int getR(final double theta, final double alpha, final double p) { final double split1 = (p * (alpha + 1.0)) / 2.0; if (theta > split1) { return 0; } if (theta > (alpha * split1)) { return 1; } return 2; }
java
private static final int getR(final double theta, final double alpha, final double p) { final double split1 = (p * (alpha + 1.0)) / 2.0; if (theta > split1) { return 0; } if (theta > (alpha * split1)) { return 1; } return 2; }
[ "private", "static", "final", "int", "getR", "(", "final", "double", "theta", ",", "final", "double", "alpha", ",", "final", "double", "p", ")", "{", "final", "double", "split1", "=", "(", "p", "*", "(", "alpha", "+", "1.0", ")", ")", "/", "2.0", "...
Computes whether there have been 0, 1, or 2 or more actual insertions into the cache in a numerically safe way. @param theta <a href="{@docRoot}/resources/dictionary.html#theta">See Theta</a>. @param alpha internal computed value alpha. @param p <a href="{@docRoot}/resources/dictionary.html#p">See Sampling Probability,...
[ "Computes", "whether", "there", "have", "been", "0", "1", "or", "2", "or", "more", "actual", "insertions", "into", "the", "cache", "in", "a", "numerically", "safe", "way", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java#L528-L533
54,904
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java
ArrayOfDoublesUnion.wrap
public static ArrayOfDoublesUnion wrap(final Memory mem, final long seed) { return wrapUnionImpl((WritableMemory) mem, seed, false); }
java
public static ArrayOfDoublesUnion wrap(final Memory mem, final long seed) { return wrapUnionImpl((WritableMemory) mem, seed, false); }
[ "public", "static", "ArrayOfDoublesUnion", "wrap", "(", "final", "Memory", "mem", ",", "final", "long", "seed", ")", "{", "return", "wrapUnionImpl", "(", "(", "WritableMemory", ")", "mem", ",", "seed", ",", "false", ")", ";", "}" ]
Wrap the given Memory and seed as an ArrayOfDoublesUnion @param mem the given Memory @param seed the given seed @return an ArrayOfDoublesUnion
[ "Wrap", "the", "given", "Memory", "and", "seed", "as", "an", "ArrayOfDoublesUnion" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java#L90-L92
54,905
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java
ArrayOfDoublesUnion.update
public void update(final ArrayOfDoublesSketch sketchIn) { if (sketchIn == null) { return; } Util.checkSeedHashes(seedHash_, sketchIn.getSeedHash()); if (sketch_.getNumValues() != sketchIn.getNumValues()) { throw new SketchesArgumentException("Incompatible sketches: number of values mismatch " ...
java
public void update(final ArrayOfDoublesSketch sketchIn) { if (sketchIn == null) { return; } Util.checkSeedHashes(seedHash_, sketchIn.getSeedHash()); if (sketch_.getNumValues() != sketchIn.getNumValues()) { throw new SketchesArgumentException("Incompatible sketches: number of values mismatch " ...
[ "public", "void", "update", "(", "final", "ArrayOfDoublesSketch", "sketchIn", ")", "{", "if", "(", "sketchIn", "==", "null", ")", "{", "return", ";", "}", "Util", ".", "checkSeedHashes", "(", "seedHash_", ",", "sketchIn", ".", "getSeedHash", "(", ")", ")",...
Updates the union by adding a set of entries from a given sketch @param sketchIn sketch to add to the union
[ "Updates", "the", "union", "by", "adding", "a", "set", "of", "entries", "from", "a", "given", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java#L117-L130
54,906
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java
ArrayOfDoublesUnion.getResult
public ArrayOfDoublesCompactSketch getResult(final WritableMemory dstMem) { if (sketch_.getRetainedEntries() > sketch_.getNominalEntries()) { theta_ = Math.min(theta_, sketch_.getNewTheta()); } if (dstMem == null) { return new HeapArrayOfDoublesCompactSketch(sketch_, theta_); } return ne...
java
public ArrayOfDoublesCompactSketch getResult(final WritableMemory dstMem) { if (sketch_.getRetainedEntries() > sketch_.getNominalEntries()) { theta_ = Math.min(theta_, sketch_.getNewTheta()); } if (dstMem == null) { return new HeapArrayOfDoublesCompactSketch(sketch_, theta_); } return ne...
[ "public", "ArrayOfDoublesCompactSketch", "getResult", "(", "final", "WritableMemory", "dstMem", ")", "{", "if", "(", "sketch_", ".", "getRetainedEntries", "(", ")", ">", "sketch_", ".", "getNominalEntries", "(", ")", ")", "{", "theta_", "=", "Math", ".", "min"...
Returns the resulting union in the form of a compact sketch @param dstMem memory for the result (can be null) @return compact sketch representing the union (off-heap if memory is provided)
[ "Returns", "the", "resulting", "union", "in", "the", "form", "of", "a", "compact", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java#L137-L145
54,907
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/HllArray.java
HllArray.extractCommonHll
static final void extractCommonHll(final Memory srcMem, final HllArray hllArray) { hllArray.putOutOfOrderFlag(extractOooFlag(srcMem)); hllArray.putCurMin(extractCurMin(srcMem)); hllArray.putHipAccum(extractHipAccum(srcMem)); hllArray.putKxQ0(extractKxQ0(srcMem)); hllArray.putKxQ1(extractKxQ1(srcMem)...
java
static final void extractCommonHll(final Memory srcMem, final HllArray hllArray) { hllArray.putOutOfOrderFlag(extractOooFlag(srcMem)); hllArray.putCurMin(extractCurMin(srcMem)); hllArray.putHipAccum(extractHipAccum(srcMem)); hllArray.putKxQ0(extractKxQ0(srcMem)); hllArray.putKxQ1(extractKxQ1(srcMem)...
[ "static", "final", "void", "extractCommonHll", "(", "final", "Memory", "srcMem", ",", "final", "HllArray", "hllArray", ")", "{", "hllArray", ".", "putOutOfOrderFlag", "(", "extractOooFlag", "(", "srcMem", ")", ")", ";", "hllArray", ".", "putCurMin", "(", "extr...
used by heapify by all Heap HLL
[ "used", "by", "heapify", "by", "all", "Heap", "HLL" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllArray.java#L238-L248
54,908
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/DirectCompactSketch.java
DirectCompactSketch.compactMemoryToByteArray
static byte[] compactMemoryToByteArray(final Memory srcMem, final int preLongs, final int curCount) { final int outBytes = (curCount + preLongs) << 3; final byte[] byteArrOut = new byte[outBytes]; srcMem.getByteArray(0, byteArrOut, 0, outBytes); //copies the whole thing return byteArrOut; }
java
static byte[] compactMemoryToByteArray(final Memory srcMem, final int preLongs, final int curCount) { final int outBytes = (curCount + preLongs) << 3; final byte[] byteArrOut = new byte[outBytes]; srcMem.getByteArray(0, byteArrOut, 0, outBytes); //copies the whole thing return byteArrOut; }
[ "static", "byte", "[", "]", "compactMemoryToByteArray", "(", "final", "Memory", "srcMem", ",", "final", "int", "preLongs", ",", "final", "int", "curCount", ")", "{", "final", "int", "outBytes", "=", "(", "curCount", "+", "preLongs", ")", "<<", "3", ";", ...
Serializes a Memory based compact sketch to a byte array @param srcMem the source Memory @param preLongs current preamble longs @param curCount the current valid count @return this Direct, Compact sketch as a byte array
[ "Serializes", "a", "Memory", "based", "compact", "sketch", "to", "a", "byte", "array" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectCompactSketch.java#L126-L132
54,909
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/Rebuilder.java
Rebuilder.quickSelectAndRebuild
static final void quickSelectAndRebuild(final WritableMemory mem, final int preambleLongs, final int lgNomLongs) { //Note: This copies the Memory data onto the heap and then at the end copies the result // back to Memory. Even if we tried to do this directly into Memory it would require pre-clearing, ...
java
static final void quickSelectAndRebuild(final WritableMemory mem, final int preambleLongs, final int lgNomLongs) { //Note: This copies the Memory data onto the heap and then at the end copies the result // back to Memory. Even if we tried to do this directly into Memory it would require pre-clearing, ...
[ "static", "final", "void", "quickSelectAndRebuild", "(", "final", "WritableMemory", "mem", ",", "final", "int", "preambleLongs", ",", "final", "int", "lgNomLongs", ")", "{", "//Note: This copies the Memory data onto the heap and then at the end copies the result", "// back to M...
Rebuild the hashTable in the given Memory at its current size. Changes theta and thus count. This assumes a Memory preamble of standard form with correct values of curCount and thetaLong. ThetaLong and curCount will change. Afterwards, caller must update local class members curCount and thetaLong from Memory. @param m...
[ "Rebuild", "the", "hashTable", "in", "the", "given", "Memory", "at", "its", "current", "size", ".", "Changes", "theta", "and", "thus", "count", ".", "This", "assumes", "a", "Memory", "preamble", "of", "standard", "form", "with", "correct", "values", "of", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Rebuilder.java#L42-L70
54,910
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/Rebuilder.java
Rebuilder.resize
static final void resize(final WritableMemory mem, final int preambleLongs, final int srcLgArrLongs, final int tgtLgArrLongs) { //Note: This copies the Memory data onto the heap and then at the end copies the result // back to Memory. Even if we tried to do this directly into Memory it would require pre-c...
java
static final void resize(final WritableMemory mem, final int preambleLongs, final int srcLgArrLongs, final int tgtLgArrLongs) { //Note: This copies the Memory data onto the heap and then at the end copies the result // back to Memory. Even if we tried to do this directly into Memory it would require pre-c...
[ "static", "final", "void", "resize", "(", "final", "WritableMemory", "mem", ",", "final", "int", "preambleLongs", ",", "final", "int", "srcLgArrLongs", ",", "final", "int", "tgtLgArrLongs", ")", "{", "//Note: This copies the Memory data onto the heap and then at the end c...
Resizes existing hash array into a larger one within a single Memory assuming enough space. This assumes a Memory preamble of standard form with the correct value of thetaLong. The Memory lgArrLongs will change. Afterwards, the caller must update local copies of lgArrLongs and hashTableThreshold from Memory. @param me...
[ "Resizes", "existing", "hash", "array", "into", "a", "larger", "one", "within", "a", "single", "Memory", "assuming", "enough", "space", ".", "This", "assumes", "a", "Memory", "preamble", "of", "standard", "form", "with", "the", "correct", "value", "of", "the...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Rebuilder.java#L125-L147
54,911
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/Rebuilder.java
Rebuilder.actLgResizeFactor
static final int actLgResizeFactor(final long capBytes, final int lgArrLongs, final int preLongs, final int lgRF) { final int maxHTLongs = Util.floorPowerOf2(((int)(capBytes >>> 3) - preLongs)); final int lgFactor = Math.max(Integer.numberOfTrailingZeros(maxHTLongs) - lgArrLongs, 0); return (lgFactor ...
java
static final int actLgResizeFactor(final long capBytes, final int lgArrLongs, final int preLongs, final int lgRF) { final int maxHTLongs = Util.floorPowerOf2(((int)(capBytes >>> 3) - preLongs)); final int lgFactor = Math.max(Integer.numberOfTrailingZeros(maxHTLongs) - lgArrLongs, 0); return (lgFactor ...
[ "static", "final", "int", "actLgResizeFactor", "(", "final", "long", "capBytes", ",", "final", "int", "lgArrLongs", ",", "final", "int", "preLongs", ",", "final", "int", "lgRF", ")", "{", "final", "int", "maxHTLongs", "=", "Util", ".", "floorPowerOf2", "(", ...
Returns the actual log2 Resize Factor that can be used to grow the hash table. This will be an integer value between zero and the given lgRF, inclusive; @param capBytes the current memory capacity in bytes @param lgArrLongs the current lg hash table size in longs @param preLongs the current preamble size in longs @para...
[ "Returns", "the", "actual", "log2", "Resize", "Factor", "that", "can", "be", "used", "to", "grow", "the", "hash", "table", ".", "This", "will", "be", "an", "integer", "value", "between", "zero", "and", "the", "given", "lgRF", "inclusive", ";" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Rebuilder.java#L158-L163
54,912
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java
UpdateSketchBuilder.setLogNominalEntries
public UpdateSketchBuilder setLogNominalEntries(final int lgNomEntries) { bLgNomLongs = lgNomEntries; if ((bLgNomLongs > MAX_LG_NOM_LONGS) || (bLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException( "Log Nominal Entries must be >= 4 and <= 26: " + lgNomEntries); } return ...
java
public UpdateSketchBuilder setLogNominalEntries(final int lgNomEntries) { bLgNomLongs = lgNomEntries; if ((bLgNomLongs > MAX_LG_NOM_LONGS) || (bLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException( "Log Nominal Entries must be >= 4 and <= 26: " + lgNomEntries); } return ...
[ "public", "UpdateSketchBuilder", "setLogNominalEntries", "(", "final", "int", "lgNomEntries", ")", "{", "bLgNomLongs", "=", "lgNomEntries", ";", "if", "(", "(", "bLgNomLongs", ">", "MAX_LG_NOM_LONGS", ")", "||", "(", "bLgNomLongs", "<", "MIN_LG_NOM_LONGS", ")", ")...
Alternative method of setting the Nominal Entries for this sketch from the log_base2 value. This value is also used for building a shared concurrent sketch. The minimum value is 4 and the maximum value is 26. Be aware that sketches as large as this maximum value may not have been thoroughly tested or characterized for ...
[ "Alternative", "method", "of", "setting", "the", "Nominal", "Entries", "for", "this", "sketch", "from", "the", "log_base2", "value", ".", "This", "value", "is", "also", "used", "for", "building", "a", "shared", "concurrent", "sketch", ".", "The", "minimum", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java#L109-L116
54,913
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java
UpdateSketchBuilder.setLocalNominalEntries
public UpdateSketchBuilder setLocalNominalEntries(final int nomEntries) { bLocalLgNomLongs = Integer.numberOfTrailingZeros(ceilingPowerOf2(nomEntries)); if ((bLocalLgNomLongs > MAX_LG_NOM_LONGS) || (bLocalLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException( "Nominal Entries mus...
java
public UpdateSketchBuilder setLocalNominalEntries(final int nomEntries) { bLocalLgNomLongs = Integer.numberOfTrailingZeros(ceilingPowerOf2(nomEntries)); if ((bLocalLgNomLongs > MAX_LG_NOM_LONGS) || (bLocalLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException( "Nominal Entries mus...
[ "public", "UpdateSketchBuilder", "setLocalNominalEntries", "(", "final", "int", "nomEntries", ")", "{", "bLocalLgNomLongs", "=", "Integer", ".", "numberOfTrailingZeros", "(", "ceilingPowerOf2", "(", "nomEntries", ")", ")", ";", "if", "(", "(", "bLocalLgNomLongs", ">...
Sets the Nominal Entries for the concurrent local sketch. The minimum value is 16 and the maximum value is 67,108,864, which is 2^26. Be aware that sketches as large as this maximum value have not been thoroughly tested or characterized for performance. @param nomEntries <a href="{@docRoot}/resources/dictionary.html#n...
[ "Sets", "the", "Nominal", "Entries", "for", "the", "concurrent", "local", "sketch", ".", "The", "minimum", "value", "is", "16", "and", "the", "maximum", "value", "is", "67", "108", "864", "which", "is", "2^26", ".", "Be", "aware", "that", "sketches", "as...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java#L136-L143
54,914
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java
UpdateSketchBuilder.setLocalLogNominalEntries
public UpdateSketchBuilder setLocalLogNominalEntries(final int lgNomEntries) { bLocalLgNomLongs = lgNomEntries; if ((bLocalLgNomLongs > MAX_LG_NOM_LONGS) || (bLocalLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException( "Log Nominal Entries must be >= 4 and <= 26: " + lgNomEntries...
java
public UpdateSketchBuilder setLocalLogNominalEntries(final int lgNomEntries) { bLocalLgNomLongs = lgNomEntries; if ((bLocalLgNomLongs > MAX_LG_NOM_LONGS) || (bLocalLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException( "Log Nominal Entries must be >= 4 and <= 26: " + lgNomEntries...
[ "public", "UpdateSketchBuilder", "setLocalLogNominalEntries", "(", "final", "int", "lgNomEntries", ")", "{", "bLocalLgNomLongs", "=", "lgNomEntries", ";", "if", "(", "(", "bLocalLgNomLongs", ">", "MAX_LG_NOM_LONGS", ")", "||", "(", "bLocalLgNomLongs", "<", "MIN_LG_NOM...
Alternative method of setting the Nominal Entries for a local concurrent sketch from the log_base2 value. The minimum value is 4 and the maximum value is 26. Be aware that sketches as large as this maximum value have not been thoroughly tested or characterized for performance. @param lgNomEntries the Log Nominal Entri...
[ "Alternative", "method", "of", "setting", "the", "Nominal", "Entries", "for", "a", "local", "concurrent", "sketch", "from", "the", "log_base2", "value", ".", "The", "minimum", "value", "is", "4", "and", "the", "maximum", "value", "is", "26", ".", "Be", "aw...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java#L155-L162
54,915
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java
UpdateSketchBuilder.buildLocal
public UpdateSketch buildLocal(final UpdateSketch shared) { if ((shared == null) || !(shared instanceof ConcurrentSharedThetaSketch)) { throw new SketchesStateException("The concurrent shared sketch must be built first."); } return new ConcurrentHeapThetaBuffer(bLocalLgNomLongs, bSeed, (Concur...
java
public UpdateSketch buildLocal(final UpdateSketch shared) { if ((shared == null) || !(shared instanceof ConcurrentSharedThetaSketch)) { throw new SketchesStateException("The concurrent shared sketch must be built first."); } return new ConcurrentHeapThetaBuffer(bLocalLgNomLongs, bSeed, (Concur...
[ "public", "UpdateSketch", "buildLocal", "(", "final", "UpdateSketch", "shared", ")", "{", "if", "(", "(", "shared", "==", "null", ")", "||", "!", "(", "shared", "instanceof", "ConcurrentSharedThetaSketch", ")", ")", "{", "throw", "new", "SketchesStateException",...
Returns a local concurrent UpdateSketch to be used as a per-thread local buffer along with the given concurrent shared UpdateSketch and the current configuration of this Builder <p>The parameters unique to the local concurrent sketch are: <ul> <li>Local Nominal Entries or Local Log Nominal Entries</li> <li>Propagate O...
[ "Returns", "a", "local", "concurrent", "UpdateSketch", "to", "be", "used", "as", "a", "per", "-", "thread", "local", "buffer", "along", "with", "the", "given", "concurrent", "shared", "UpdateSketch", "and", "the", "current", "configuration", "of", "this", "Bui...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UpdateSketchBuilder.java#L465-L471
54,916
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.copy
CpcSketch copy() { final CpcSketch copy = new CpcSketch(lgK, seed); copy.numCoupons = numCoupons; copy.mergeFlag = mergeFlag; copy.fiCol = fiCol; copy.windowOffset = windowOffset; copy.slidingWindow = (slidingWindow == null) ? null : slidingWindow.clone(); copy.pairTable = (pairTable == nul...
java
CpcSketch copy() { final CpcSketch copy = new CpcSketch(lgK, seed); copy.numCoupons = numCoupons; copy.mergeFlag = mergeFlag; copy.fiCol = fiCol; copy.windowOffset = windowOffset; copy.slidingWindow = (slidingWindow == null) ? null : slidingWindow.clone(); copy.pairTable = (pairTable == nul...
[ "CpcSketch", "copy", "(", ")", "{", "final", "CpcSketch", "copy", "=", "new", "CpcSketch", "(", "lgK", ",", "seed", ")", ";", "copy", ".", "numCoupons", "=", "numCoupons", ";", "copy", ".", "mergeFlag", "=", "mergeFlag", ";", "copy", ".", "fiCol", "=",...
Returns a copy of this sketch @return a copy of this sketch
[ "Returns", "a", "copy", "of", "this", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L101-L114
54,917
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.getMaxSerializedBytes
public static int getMaxSerializedBytes(final int lgK) { checkLgK(lgK); if (lgK <= 19) { return empiricalMaxBytes[lgK - 4] + 40; } final int k = 1 << lgK; return (int) (0.6 * k) + 40; // 0.6 = 4.8 / 8.0 }
java
public static int getMaxSerializedBytes(final int lgK) { checkLgK(lgK); if (lgK <= 19) { return empiricalMaxBytes[lgK - 4] + 40; } final int k = 1 << lgK; return (int) (0.6 * k) + 40; // 0.6 = 4.8 / 8.0 }
[ "public", "static", "int", "getMaxSerializedBytes", "(", "final", "int", "lgK", ")", "{", "checkLgK", "(", "lgK", ")", ";", "if", "(", "lgK", "<=", "19", ")", "{", "return", "empiricalMaxBytes", "[", "lgK", "-", "4", "]", "+", "40", ";", "}", "final"...
The actual size of a compressed CPC sketch has a small random variance, but the following empirically measured size should be large enough for at least 99.9 percent of sketches. <p>For small values of <i>n</i> the size can be much smaller. @param lgK the given value of lgK. @return the estimated maximum compressed se...
[ "The", "actual", "size", "of", "a", "compressed", "CPC", "sketch", "has", "a", "small", "random", "variance", "but", "the", "following", "empirically", "measured", "size", "should", "be", "large", "enough", "for", "at", "least", "99", ".", "9", "percent", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L188-L193
54,918
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.heapify
public static CpcSketch heapify(final Memory mem, final long seed) { final CompressedState state = CompressedState.importFromMemory(mem); return uncompress(state, seed); }
java
public static CpcSketch heapify(final Memory mem, final long seed) { final CompressedState state = CompressedState.importFromMemory(mem); return uncompress(state, seed); }
[ "public", "static", "CpcSketch", "heapify", "(", "final", "Memory", "mem", ",", "final", "long", "seed", ")", "{", "final", "CompressedState", "state", "=", "CompressedState", ".", "importFromMemory", "(", "mem", ")", ";", "return", "uncompress", "(", "state",...
Return the given Memory as a CpcSketch on the Java heap. @param mem the given Memory @param seed the seed used to create the original sketch from which the Memory was derived. @return the given Memory as a CpcSketch on the Java heap.
[ "Return", "the", "given", "Memory", "as", "a", "CpcSketch", "on", "the", "Java", "heap", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L232-L235
54,919
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.heapify
public static CpcSketch heapify(final byte[] byteArray, final long seed) { final Memory mem = Memory.wrap(byteArray); return heapify(mem, seed); }
java
public static CpcSketch heapify(final byte[] byteArray, final long seed) { final Memory mem = Memory.wrap(byteArray); return heapify(mem, seed); }
[ "public", "static", "CpcSketch", "heapify", "(", "final", "byte", "[", "]", "byteArray", ",", "final", "long", "seed", ")", "{", "final", "Memory", "mem", "=", "Memory", ".", "wrap", "(", "byteArray", ")", ";", "return", "heapify", "(", "mem", ",", "se...
Return the given byte array as a CpcSketch on the Java heap. @param byteArray the given byte array @param seed the seed used to create the original sketch from which the byte array was derived. @return the given byte array as a CpcSketch on the Java heap.
[ "Return", "the", "given", "byte", "array", "as", "a", "CpcSketch", "on", "the", "Java", "heap", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L243-L246
54,920
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.reset
public final void reset() { numCoupons = 0; mergeFlag = false; fiCol = 0; windowOffset = 0; slidingWindow = null; pairTable = null; kxp = 1 << lgK; hipEstAccum = 0; }
java
public final void reset() { numCoupons = 0; mergeFlag = false; fiCol = 0; windowOffset = 0; slidingWindow = null; pairTable = null; kxp = 1 << lgK; hipEstAccum = 0; }
[ "public", "final", "void", "reset", "(", ")", "{", "numCoupons", "=", "0", ";", "mergeFlag", "=", "false", ";", "fiCol", "=", "0", ";", "windowOffset", "=", "0", ";", "slidingWindow", "=", "null", ";", "pairTable", "=", "null", ";", "kxp", "=", "1", ...
Resets this sketch to empty but retains the original LgK and Seed.
[ "Resets", "this", "sketch", "to", "empty", "but", "retains", "the", "original", "LgK", "and", "Seed", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L259-L270
54,921
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.toByteArray
public byte[] toByteArray() { final CompressedState state = CompressedState.compress(this); final long cap = state.getRequiredSerializedBytes(); final WritableMemory wmem = WritableMemory.allocate((int) cap); state.exportToMemory(wmem); return (byte[]) wmem.getArray(); }
java
public byte[] toByteArray() { final CompressedState state = CompressedState.compress(this); final long cap = state.getRequiredSerializedBytes(); final WritableMemory wmem = WritableMemory.allocate((int) cap); state.exportToMemory(wmem); return (byte[]) wmem.getArray(); }
[ "public", "byte", "[", "]", "toByteArray", "(", ")", "{", "final", "CompressedState", "state", "=", "CompressedState", ".", "compress", "(", "this", ")", ";", "final", "long", "cap", "=", "state", ".", "getRequiredSerializedBytes", "(", ")", ";", "final", ...
Return this sketch as a compressed byte array. @return this sketch as a compressed byte array.
[ "Return", "this", "sketch", "as", "a", "compressed", "byte", "array", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L276-L282
54,922
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.update
public void update(final long datum) { final long[] data = { datum }; final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); }
java
public void update(final long datum) { final long[] data = { datum }; final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); }
[ "public", "void", "update", "(", "final", "long", "datum", ")", "{", "final", "long", "[", "]", "data", "=", "{", "datum", "}", ";", "final", "long", "[", "]", "arr", "=", "hash", "(", "data", ",", "seed", ")", ";", "hashUpdate", "(", "arr", "[",...
Present the given long as a potential unique item. @param datum The given long datum.
[ "Present", "the", "given", "long", "as", "a", "potential", "unique", "item", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L289-L293
54,923
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.update
public void update(final int[] data) { if ((data == null) || (data.length == 0)) { return; } final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); }
java
public void update(final int[] data) { if ((data == null) || (data.length == 0)) { return; } final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); }
[ "public", "void", "update", "(", "final", "int", "[", "]", "data", ")", "{", "if", "(", "(", "data", "==", "null", ")", "||", "(", "data", ".", "length", "==", "0", ")", ")", "{", "return", ";", "}", "final", "long", "[", "]", "arr", "=", "ha...
Present the given integer array as a potential unique item. If the integer array is null or empty no update attempt is made and the method returns. @param data The given int array.
[ "Present", "the", "given", "integer", "array", "as", "a", "potential", "unique", "item", ".", "If", "the", "integer", "array", "is", "null", "or", "empty", "no", "update", "attempt", "is", "made", "and", "the", "method", "returns", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L365-L369
54,924
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.getFormat
Format getFormat() { final int ordinal; final Flavor f = getFlavor(); if ((f == Flavor.HYBRID) || (f == Flavor.SPARSE)) { ordinal = 2 | ( mergeFlag ? 0 : 1 ); //Hybrid is serialized as SPARSE } else { ordinal = ((slidingWindow != null) ? 4 : 0) | (((pairTable != null) && (pair...
java
Format getFormat() { final int ordinal; final Flavor f = getFlavor(); if ((f == Flavor.HYBRID) || (f == Flavor.SPARSE)) { ordinal = 2 | ( mergeFlag ? 0 : 1 ); //Hybrid is serialized as SPARSE } else { ordinal = ((slidingWindow != null) ? 4 : 0) | (((pairTable != null) && (pair...
[ "Format", "getFormat", "(", ")", "{", "final", "int", "ordinal", ";", "final", "Flavor", "f", "=", "getFlavor", "(", ")", ";", "if", "(", "(", "f", "==", "Flavor", ".", "HYBRID", ")", "||", "(", "f", "==", "Flavor", ".", "SPARSE", ")", ")", "{", ...
Returns the Format of the serialized form of this sketch. @return the Format of the serialized form of this sketch.
[ "Returns", "the", "Format", "of", "the", "serialized", "form", "of", "this", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L411-L422
54,925
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.promoteSparseToWindowed
private static void promoteSparseToWindowed(final CpcSketch sketch) { final int lgK = sketch.lgK; final int k = (1 << lgK); final long c32 = sketch.numCoupons << 5; assert ((c32 == (3 * k)) || ((lgK == 4) && (c32 > (3 * k)))); final byte[] window = new byte[k]; final PairTable newTable = new P...
java
private static void promoteSparseToWindowed(final CpcSketch sketch) { final int lgK = sketch.lgK; final int k = (1 << lgK); final long c32 = sketch.numCoupons << 5; assert ((c32 == (3 * k)) || ((lgK == 4) && (c32 > (3 * k)))); final byte[] window = new byte[k]; final PairTable newTable = new P...
[ "private", "static", "void", "promoteSparseToWindowed", "(", "final", "CpcSketch", "sketch", ")", "{", "final", "int", "lgK", "=", "sketch", ".", "lgK", ";", "final", "int", "k", "=", "(", "1", "<<", "lgK", ")", ";", "final", "long", "c32", "=", "sketc...
In terms of flavor, this promotes SPARSE to HYBRID.
[ "In", "terms", "of", "flavor", "this", "promotes", "SPARSE", "to", "HYBRID", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L431-L466
54,926
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.refreshKXP
static void refreshKXP(final CpcSketch sketch, final long[] bitMatrix) { final int k = (1 << sketch.lgK); // for improved numerical accuracy, we separately sum the bytes of the U64's final double[] byteSums = new double[8]; for (int j = 0; j < 8; j++) { byteSums[j] = 0.0; } for (int i = 0; i < k;...
java
static void refreshKXP(final CpcSketch sketch, final long[] bitMatrix) { final int k = (1 << sketch.lgK); // for improved numerical accuracy, we separately sum the bytes of the U64's final double[] byteSums = new double[8]; for (int j = 0; j < 8; j++) { byteSums[j] = 0.0; } for (int i = 0; i < k;...
[ "static", "void", "refreshKXP", "(", "final", "CpcSketch", "sketch", ",", "final", "long", "[", "]", "bitMatrix", ")", "{", "final", "int", "k", "=", "(", "1", "<<", "sketch", ".", "lgK", ")", ";", "// for improved numerical accuracy, we separately sum the bytes...
Also used in test
[ "Also", "used", "in", "test" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L477-L501
54,927
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.modifyOffset
private static void modifyOffset(final CpcSketch sketch, final int newOffset) { assert ((newOffset >= 0) && (newOffset <= 56)); assert (newOffset == (sketch.windowOffset + 1)); assert (newOffset == CpcUtil.determineCorrectOffset(sketch.lgK, sketch.numCoupons)); assert (sketch.slidingWindow != null); ...
java
private static void modifyOffset(final CpcSketch sketch, final int newOffset) { assert ((newOffset >= 0) && (newOffset <= 56)); assert (newOffset == (sketch.windowOffset + 1)); assert (newOffset == CpcUtil.determineCorrectOffset(sketch.lgK, sketch.numCoupons)); assert (sketch.slidingWindow != null); ...
[ "private", "static", "void", "modifyOffset", "(", "final", "CpcSketch", "sketch", ",", "final", "int", "newOffset", ")", "{", "assert", "(", "(", "newOffset", ">=", "0", ")", "&&", "(", "newOffset", "<=", "56", ")", ")", ";", "assert", "(", "newOffset", ...
This moves the sliding window @param sketch the given sketch @param newOffset the new offset, which must be oldOffset + 1
[ "This", "moves", "the", "sliding", "window" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L508-L552
54,928
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.updateHIP
private static void updateHIP(final CpcSketch sketch, final int rowCol) { final int k = 1 << sketch.lgK; final int col = rowCol & 63; final double oneOverP = k / sketch.kxp; sketch.hipEstAccum += oneOverP; sketch.kxp -= invPow2(col + 1); // notice the "+1" }
java
private static void updateHIP(final CpcSketch sketch, final int rowCol) { final int k = 1 << sketch.lgK; final int col = rowCol & 63; final double oneOverP = k / sketch.kxp; sketch.hipEstAccum += oneOverP; sketch.kxp -= invPow2(col + 1); // notice the "+1" }
[ "private", "static", "void", "updateHIP", "(", "final", "CpcSketch", "sketch", ",", "final", "int", "rowCol", ")", "{", "final", "int", "k", "=", "1", "<<", "sketch", ".", "lgK", ";", "final", "int", "col", "=", "rowCol", "&", "63", ";", "final", "do...
Call this whenever a new coupon has been collected. @param sketch the given sketch @param rowCol the given row / column
[ "Call", "this", "whenever", "a", "new", "coupon", "has", "been", "collected", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L559-L565
54,929
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.updateWindowed
private static void updateWindowed(final CpcSketch sketch, final int rowCol) { assert ((sketch.windowOffset >= 0) && (sketch.windowOffset <= 56)); final int k = 1 << sketch.lgK; final long c32pre = sketch.numCoupons << 5; assert c32pre >= (3L * k); // C < 3K/32, in other words flavor >= HYBRID final...
java
private static void updateWindowed(final CpcSketch sketch, final int rowCol) { assert ((sketch.windowOffset >= 0) && (sketch.windowOffset <= 56)); final int k = 1 << sketch.lgK; final long c32pre = sketch.numCoupons << 5; assert c32pre >= (3L * k); // C < 3K/32, in other words flavor >= HYBRID final...
[ "private", "static", "void", "updateWindowed", "(", "final", "CpcSketch", "sketch", ",", "final", "int", "rowCol", ")", "{", "assert", "(", "(", "sketch", ".", "windowOffset", ">=", "0", ")", "&&", "(", "sketch", ".", "windowOffset", "<=", "56", ")", ")"...
The flavor is HYBRID, PINNED, or SLIDING. @param sketch the given sketch @param rowCol the given rowCol
[ "The", "flavor", "is", "HYBRID", "PINNED", "or", "SLIDING", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L586-L627
54,930
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.uncompress
static CpcSketch uncompress(final CompressedState source, final long seed) { checkSeedHashes(computeSeedHash(seed), source.seedHash); final CpcSketch sketch = new CpcSketch(source.lgK, seed); sketch.numCoupons = source.numCoupons; sketch.windowOffset = source.getWindowOffset(); sketch.fiCol = source...
java
static CpcSketch uncompress(final CompressedState source, final long seed) { checkSeedHashes(computeSeedHash(seed), source.seedHash); final CpcSketch sketch = new CpcSketch(source.lgK, seed); sketch.numCoupons = source.numCoupons; sketch.windowOffset = source.getWindowOffset(); sketch.fiCol = source...
[ "static", "CpcSketch", "uncompress", "(", "final", "CompressedState", "source", ",", "final", "long", "seed", ")", "{", "checkSeedHashes", "(", "computeSeedHash", "(", "seed", ")", ",", "source", ".", "seedHash", ")", ";", "final", "CpcSketch", "sketch", "=", ...
also used in test
[ "also", "used", "in", "test" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L631-L644
54,931
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.hashUpdate
void hashUpdate(final long hash0, final long hash1) { int col = Long.numberOfLeadingZeros(hash1); if (col < fiCol) { return; } // important speed optimization if (col > 63) { col = 63; } // clip so that 0 <= col <= 63 final long c = numCoupons; if (c == 0) { promoteEmptyToSparse(this); } final l...
java
void hashUpdate(final long hash0, final long hash1) { int col = Long.numberOfLeadingZeros(hash1); if (col < fiCol) { return; } // important speed optimization if (col > 63) { col = 63; } // clip so that 0 <= col <= 63 final long c = numCoupons; if (c == 0) { promoteEmptyToSparse(this); } final l...
[ "void", "hashUpdate", "(", "final", "long", "hash0", ",", "final", "long", "hash1", ")", "{", "int", "col", "=", "Long", ".", "numberOfLeadingZeros", "(", "hash1", ")", ";", "if", "(", "col", "<", "fiCol", ")", "{", "return", ";", "}", "// important sp...
Used here and for testing
[ "Used", "here", "and", "for", "testing" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L647-L665
54,932
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.rowColUpdate
void rowColUpdate(final int rowCol) { final int col = rowCol & 63; if (col < fiCol) { return; } // important speed optimization final long c = numCoupons; if (c == 0) { promoteEmptyToSparse(this); } final long k = 1L << lgK; if ((c << 5) < (3L * k)) { updateSparse(this, rowCol); } else { upd...
java
void rowColUpdate(final int rowCol) { final int col = rowCol & 63; if (col < fiCol) { return; } // important speed optimization final long c = numCoupons; if (c == 0) { promoteEmptyToSparse(this); } final long k = 1L << lgK; if ((c << 5) < (3L * k)) { updateSparse(this, rowCol); } else { upd...
[ "void", "rowColUpdate", "(", "final", "int", "rowCol", ")", "{", "final", "int", "col", "=", "rowCol", "&", "63", ";", "if", "(", "col", "<", "fiCol", ")", "{", "return", ";", "}", "// important speed optimization", "final", "long", "c", "=", "numCoupons...
Used by union and in testing
[ "Used", "by", "union", "and", "in", "testing" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L668-L676
54,933
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcUnion.java
CpcUnion.getBitMatrix
static long[] getBitMatrix(final CpcUnion union) { checkUnionState(union); return (union.bitMatrix != null) ? union.bitMatrix : CpcUtil.bitMatrixOfSketch(union.accumulator); }
java
static long[] getBitMatrix(final CpcUnion union) { checkUnionState(union); return (union.bitMatrix != null) ? union.bitMatrix : CpcUtil.bitMatrixOfSketch(union.accumulator); }
[ "static", "long", "[", "]", "getBitMatrix", "(", "final", "CpcUnion", "union", ")", "{", "checkUnionState", "(", "union", ")", ";", "return", "(", "union", ".", "bitMatrix", "!=", "null", ")", "?", "union", ".", "bitMatrix", ":", "CpcUtil", ".", "bitMatr...
used for testing only
[ "used", "for", "testing", "only" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcUnion.java#L160-L165
54,934
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/UpdatableSketchBuilder.java
UpdatableSketchBuilder.setSamplingProbability
public UpdatableSketchBuilder<U, S> setSamplingProbability(final float samplingProbability) { if ((samplingProbability < 0) || (samplingProbability > 1f)) { throw new SketchesArgumentException("sampling probability must be between 0 and 1"); } samplingProbability_ = samplingProbability; return thi...
java
public UpdatableSketchBuilder<U, S> setSamplingProbability(final float samplingProbability) { if ((samplingProbability < 0) || (samplingProbability > 1f)) { throw new SketchesArgumentException("sampling probability must be between 0 and 1"); } samplingProbability_ = samplingProbability; return thi...
[ "public", "UpdatableSketchBuilder", "<", "U", ",", "S", ">", "setSamplingProbability", "(", "final", "float", "samplingProbability", ")", "{", "if", "(", "(", "samplingProbability", "<", "0", ")", "||", "(", "samplingProbability", ">", "1f", ")", ")", "{", "...
This is to set sampling probability. Default probability is 1. @param samplingProbability sampling probability from 0 to 1 @return this UpdatableSketchBuilder
[ "This", "is", "to", "set", "sampling", "probability", ".", "Default", "probability", "is", "1", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/UpdatableSketchBuilder.java#L68-L74
54,935
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/UpdatableSketchBuilder.java
UpdatableSketchBuilder.build
public UpdatableSketch<U, S> build() { return new UpdatableSketch<>(nomEntries_, resizeFactor_.lg(), samplingProbability_, summaryFactory_); }
java
public UpdatableSketch<U, S> build() { return new UpdatableSketch<>(nomEntries_, resizeFactor_.lg(), samplingProbability_, summaryFactory_); }
[ "public", "UpdatableSketch", "<", "U", ",", "S", ">", "build", "(", ")", "{", "return", "new", "UpdatableSketch", "<>", "(", "nomEntries_", ",", "resizeFactor_", ".", "lg", "(", ")", ",", "samplingProbability_", ",", "summaryFactory_", ")", ";", "}" ]
Returns an UpdatableSketch with the current configuration of this Builder. @return an UpdatableSketch
[ "Returns", "an", "UpdatableSketch", "with", "the", "current", "configuration", "of", "this", "Builder", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/UpdatableSketchBuilder.java#L80-L83
54,936
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/HeapCompactDoublesSketch.java
HeapCompactDoublesSketch.srcMemoryToCombinedBuffer
private void srcMemoryToCombinedBuffer(final Memory srcMem, final int serVer, final boolean srcIsCompact, final int combBufCap) { final int preLongs = 2; final int extra = (serVer == 1) ? 3 : 2; // space for min and max values, buf alloc (SerVer 1) final int preBytes...
java
private void srcMemoryToCombinedBuffer(final Memory srcMem, final int serVer, final boolean srcIsCompact, final int combBufCap) { final int preLongs = 2; final int extra = (serVer == 1) ? 3 : 2; // space for min and max values, buf alloc (SerVer 1) final int preBytes...
[ "private", "void", "srcMemoryToCombinedBuffer", "(", "final", "Memory", "srcMem", ",", "final", "int", "serVer", ",", "final", "boolean", "srcIsCompact", ",", "final", "int", "combBufCap", ")", "{", "final", "int", "preLongs", "=", "2", ";", "final", "int", ...
Loads the Combined Buffer from the given source Memory. The resulting Combined Buffer is allocated in this method and is always in compact form. @param srcMem the given source Memory @param serVer the serialization version of the source @param srcIsCompact true if the given source Memory is in compact form @param combB...
[ "Loads", "the", "Combined", "Buffer", "from", "the", "given", "source", "Memory", ".", "The", "resulting", "Combined", "Buffer", "is", "allocated", "in", "this", "method", "and", "is", "always", "in", "compact", "form", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/HeapCompactDoublesSketch.java#L222-L254
54,937
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/Hll4Update.java
Hll4Update.internalHll4Update
static final void internalHll4Update(final AbstractHllArray host, final int slotNo, final int newValue) { assert ((0 <= slotNo) && (slotNo < (1 << host.getLgConfigK()))); assert (newValue > 0); final int curMin = host.getCurMin(); AuxHashMap auxHashMap = host.getAuxHashMap(); //may be null final in...
java
static final void internalHll4Update(final AbstractHllArray host, final int slotNo, final int newValue) { assert ((0 <= slotNo) && (slotNo < (1 << host.getLgConfigK()))); assert (newValue > 0); final int curMin = host.getCurMin(); AuxHashMap auxHashMap = host.getAuxHashMap(); //may be null final in...
[ "static", "final", "void", "internalHll4Update", "(", "final", "AbstractHllArray", "host", ",", "final", "int", "slotNo", ",", "final", "int", "newValue", ")", "{", "assert", "(", "(", "0", "<=", "slotNo", ")", "&&", "(", "slotNo", "<", "(", "1", "<<", ...
Only called by Hll4Array and DirectHll4Array
[ "Only", "called", "by", "Hll4Array", "and", "DirectHll4Array" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/Hll4Update.java#L23-L102
54,938
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java
BoundsOnRatiosInSampledSets.getLowerBoundForBoverA
public static double getLowerBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 0.0; } if (f == 1.0) { return (double) b / a; } return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
java
public static double getLowerBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 0.0; } if (f == 1.0) { return (double) b / a; } return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
[ "public", "static", "double", "getLowerBoundForBoverA", "(", "final", "long", "a", ",", "final", "long", "b", ",", "final", "double", "f", ")", "{", "checkInputs", "(", "a", ",", "b", ",", "f", ")", ";", "if", "(", "a", "==", "0", ")", "{", "return...
Return the approximate lower bound based on a 95% confidence interval @param a See class javadoc @param b See class javadoc @param f the inclusion probability used to produce the set with size <i>a</i> and should generally be less than 0.5. Above this value, the results not be reliable. When <i>f</i> = 1.0 this returns...
[ "Return", "the", "approximate", "lower", "bound", "based", "on", "a", "95%", "confidence", "interval" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java#L38-L43
54,939
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java
BoundsOnRatiosInSampledSets.getUpperBoundForBoverA
public static double getUpperBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 1.0; } if (f == 1.0) { return (double) b / a; } return approximateUpperBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
java
public static double getUpperBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 1.0; } if (f == 1.0) { return (double) b / a; } return approximateUpperBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
[ "public", "static", "double", "getUpperBoundForBoverA", "(", "final", "long", "a", ",", "final", "long", "b", ",", "final", "double", "f", ")", "{", "checkInputs", "(", "a", ",", "b", ",", "f", ")", ";", "if", "(", "a", "==", "0", ")", "{", "return...
Return the approximate upper bound based on a 95% confidence interval @param a See class javadoc @param b See class javadoc @param f the inclusion probability used to produce the set with size <i>a</i>. @return the approximate lower bound
[ "Return", "the", "approximate", "upper", "bound", "based", "on", "a", "95%", "confidence", "interval" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java#L52-L57
54,940
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java
BoundsOnRatiosInSampledSets.hackyAdjuster
private static double hackyAdjuster(final double f) { final double tmp = Math.sqrt(1.0 - f); return (f <= 0.5) ? tmp : tmp + (0.01 * (f - 0.5)); }
java
private static double hackyAdjuster(final double f) { final double tmp = Math.sqrt(1.0 - f); return (f <= 0.5) ? tmp : tmp + (0.01 * (f - 0.5)); }
[ "private", "static", "double", "hackyAdjuster", "(", "final", "double", "f", ")", "{", "final", "double", "tmp", "=", "Math", ".", "sqrt", "(", "1.0", "-", "f", ")", ";", "return", "(", "f", "<=", "0.5", ")", "?", "tmp", ":", "tmp", "+", "(", "0....
This hackyAdjuster is tightly coupled with the width of the confidence interval normally specified with number of standard deviations. To simplify this interface the number of standard deviations has been fixed to 2.0, which corresponds to a confidence interval of 95%. @param f the inclusion probability used to produce...
[ "This", "hackyAdjuster", "is", "tightly", "coupled", "with", "the", "width", "of", "the", "confidence", "interval", "normally", "specified", "with", "number", "of", "standard", "deviations", ".", "To", "simplify", "this", "interface", "the", "number", "of", "sta...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java#L79-L82
54,941
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hllmap/Map.java
Map.coupon16
static final int coupon16(final byte[] identifier) { final long[] hash = MurmurHash3.hash(identifier, SEED); final int hllIdx = (int) (((hash[0] >>> 1) % 1024) & TEN_BIT_MASK); //hash[0] for 10-bit address final int lz = Long.numberOfLeadingZeros(hash[1]); final int value = (lz > 62 ? 62 : lz) + 1; ...
java
static final int coupon16(final byte[] identifier) { final long[] hash = MurmurHash3.hash(identifier, SEED); final int hllIdx = (int) (((hash[0] >>> 1) % 1024) & TEN_BIT_MASK); //hash[0] for 10-bit address final int lz = Long.numberOfLeadingZeros(hash[1]); final int value = (lz > 62 ? 62 : lz) + 1; ...
[ "static", "final", "int", "coupon16", "(", "final", "byte", "[", "]", "identifier", ")", "{", "final", "long", "[", "]", "hash", "=", "MurmurHash3", ".", "hash", "(", "identifier", ",", "SEED", ")", ";", "final", "int", "hllIdx", "=", "(", "int", ")"...
Returns the HLL array index and value as a 16-bit coupon given the identifier to be hashed and k. @param identifier the given identifier @return the HLL array index and value
[ "Returns", "the", "HLL", "array", "index", "and", "value", "as", "a", "16", "-", "bit", "coupon", "given", "the", "identifier", "to", "be", "hashed", "and", "k", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/Map.java#L155-L161
54,942
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/Sketches.java
Sketches.heapifySketch
public static <S extends Summary> Sketch<S> heapifySketch(final Memory mem, final SummaryDeserializer<S> deserializer) { final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem); if (sketchType == SerializerDeserializer.SketchType.QuickSelectSketch) { return new...
java
public static <S extends Summary> Sketch<S> heapifySketch(final Memory mem, final SummaryDeserializer<S> deserializer) { final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem); if (sketchType == SerializerDeserializer.SketchType.QuickSelectSketch) { return new...
[ "public", "static", "<", "S", "extends", "Summary", ">", "Sketch", "<", "S", ">", "heapifySketch", "(", "final", "Memory", "mem", ",", "final", "SummaryDeserializer", "<", "S", ">", "deserializer", ")", "{", "final", "SerializerDeserializer", ".", "SketchType"...
Instantiate Sketch from a given Memory @param <S> Type of Summary @param mem Memory object representing a Sketch @param deserializer instance of SummaryDeserializer @return Sketch created from its Memory representation
[ "Instantiate", "Sketch", "from", "a", "given", "Memory" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/Sketches.java#L30-L37
54,943
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/Sketches.java
Sketches.heapifyUpdatableSketch
public static <U, S extends UpdatableSummary<U>> UpdatableSketch<U, S> heapifyUpdatableSketch(final Memory mem, final SummaryDeserializer<S> deserializer, final SummaryFactory<S> summaryFactory) { return new UpdatableSketch<U, S>(mem, deserializer, summaryFactory); }
java
public static <U, S extends UpdatableSummary<U>> UpdatableSketch<U, S> heapifyUpdatableSketch(final Memory mem, final SummaryDeserializer<S> deserializer, final SummaryFactory<S> summaryFactory) { return new UpdatableSketch<U, S>(mem, deserializer, summaryFactory); }
[ "public", "static", "<", "U", ",", "S", "extends", "UpdatableSummary", "<", "U", ">", ">", "UpdatableSketch", "<", "U", ",", "S", ">", "heapifyUpdatableSketch", "(", "final", "Memory", "mem", ",", "final", "SummaryDeserializer", "<", "S", ">", "deserializer"...
Instantiate UpdatableSketch from a given Memory @param <U> Type of update value @param <S> Type of Summary @param mem Memory object representing a Sketch @param deserializer instance of SummaryDeserializer @param summaryFactory instance of SummaryFactory @return Sketch created from its Memory representation
[ "Instantiate", "UpdatableSketch", "from", "a", "given", "Memory" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/Sketches.java#L48-L52
54,944
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/BaseHllSketch.java
BaseHllSketch.update
public void update(final long[] data) { if ((data == null) || (data.length == 0)) { return; } couponUpdate(coupon(hash(data, DEFAULT_UPDATE_SEED))); }
java
public void update(final long[] data) { if ((data == null) || (data.length == 0)) { return; } couponUpdate(coupon(hash(data, DEFAULT_UPDATE_SEED))); }
[ "public", "void", "update", "(", "final", "long", "[", "]", "data", ")", "{", "if", "(", "(", "data", "==", "null", ")", "||", "(", "data", ".", "length", "==", "0", ")", ")", "{", "return", ";", "}", "couponUpdate", "(", "coupon", "(", "hash", ...
Present the given long array as a potential unique item. If the long array is null or empty no update attempt is made and the method returns. @param data The given long array.
[ "Present", "the", "given", "long", "array", "as", "a", "potential", "unique", "item", ".", "If", "the", "long", "array", "is", "null", "or", "empty", "no", "update", "attempt", "is", "made", "and", "the", "method", "returns", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/BaseHllSketch.java#L323-L326
54,945
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/XxHash.java
XxHash.hash
public static long hash(final long in, final long seed) { long hash = seed + P5; hash += 8; long k1 = in; k1 *= P2; k1 = Long.rotateLeft(k1, 31); k1 *= P1; hash ^= k1; hash = (Long.rotateLeft(hash, 27) * P1) + P4; return finalize(hash); }
java
public static long hash(final long in, final long seed) { long hash = seed + P5; hash += 8; long k1 = in; k1 *= P2; k1 = Long.rotateLeft(k1, 31); k1 *= P1; hash ^= k1; hash = (Long.rotateLeft(hash, 27) * P1) + P4; return finalize(hash); }
[ "public", "static", "long", "hash", "(", "final", "long", "in", ",", "final", "long", "seed", ")", "{", "long", "hash", "=", "seed", "+", "P5", ";", "hash", "+=", "8", ";", "long", "k1", "=", "in", ";", "k1", "*=", "P2", ";", "k1", "=", "Long",...
Returns a 64-bit hash. @param in a long @param seed A long valued seed. @return the hash
[ "Returns", "a", "64", "-", "bit", "hash", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/XxHash.java#L48-L58
54,946
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/CompactSketch.java
CompactSketch.toByteArray
@SuppressWarnings("null") @Override public byte[] toByteArray() { int summariesBytesLength = 0; byte[][] summariesBytes = null; final int count = getRetainedEntries(); if (count > 0) { summariesBytes = new byte[count][]; for (int i = 0; i < count; i++) { summariesBytes[i] = summa...
java
@SuppressWarnings("null") @Override public byte[] toByteArray() { int summariesBytesLength = 0; byte[][] summariesBytes = null; final int count = getRetainedEntries(); if (count > 0) { summariesBytes = new byte[count][]; for (int i = 0; i < count; i++) { summariesBytes[i] = summa...
[ "@", "SuppressWarnings", "(", "\"null\"", ")", "@", "Override", "public", "byte", "[", "]", "toByteArray", "(", ")", "{", "int", "summariesBytesLength", "=", "0", ";", "byte", "[", "]", "[", "]", "summariesBytes", "=", "null", ";", "final", "int", "count...
0 || | Flags | SkType | FamID | SerVer | Preamble_Longs |
[ "0", "||", "|", "Flags", "|", "SkType", "|", "FamID", "|", "SerVer", "|", "Preamble_Longs", "|" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/CompactSketch.java#L110-L169
54,947
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/HeapArrayOfDoublesUnion.java
HeapArrayOfDoublesUnion.heapifyUnion
static ArrayOfDoublesUnion heapifyUnion(final Memory mem, final long seed) { final SerializerDeserializer.SketchType type = SerializerDeserializer.getSketchType(mem); // compatibility with version 0.9.1 and lower if (type == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) { final A...
java
static ArrayOfDoublesUnion heapifyUnion(final Memory mem, final long seed) { final SerializerDeserializer.SketchType type = SerializerDeserializer.getSketchType(mem); // compatibility with version 0.9.1 and lower if (type == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) { final A...
[ "static", "ArrayOfDoublesUnion", "heapifyUnion", "(", "final", "Memory", "mem", ",", "final", "long", "seed", ")", "{", "final", "SerializerDeserializer", ".", "SketchType", "type", "=", "SerializerDeserializer", ".", "getSketchType", "(", "mem", ")", ";", "// com...
This is to create an instance given a serialized form and a custom seed @param mem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return a ArrayOfDoublesUnion on the Java heap
[ "This", "is", "to", "create", "an", "instance", "given", "a", "serialized", "form", "and", "a", "custom", "seed" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/HeapArrayOfDoublesUnion.java#L38-L62
54,948
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java
MurmurHash3Adaptor.asInteger
private static int asInteger(final long[] data, final int n) { int t; int cnt = 0; long seed = 0; if (n < 2) { throw new SketchesArgumentException("Given value of n must be &gt; 1."); } if (n > (1 << 30)) { while (++cnt < 10000) { final long[] h = MurmurHash3.hash(data, seed)...
java
private static int asInteger(final long[] data, final int n) { int t; int cnt = 0; long seed = 0; if (n < 2) { throw new SketchesArgumentException("Given value of n must be &gt; 1."); } if (n > (1 << 30)) { while (++cnt < 10000) { final long[] h = MurmurHash3.hash(data, seed)...
[ "private", "static", "int", "asInteger", "(", "final", "long", "[", "]", "data", ",", "final", "int", "n", ")", "{", "int", "t", ";", "int", "cnt", "=", "0", ";", "long", "seed", "=", "0", ";", "if", "(", "n", "<", "2", ")", "{", "throw", "ne...
Returns a deterministic uniform random integer with a minimum inclusive value of zero and a maximum exclusive value of n given the input data. <p>The integer values produced are only as random as the MurmurHash3 algorithm, which may be adequate for many applications. However, if you are looking for high guarantees of ...
[ "Returns", "a", "deterministic", "uniform", "random", "integer", "with", "a", "minimum", "inclusive", "value", "of", "zero", "and", "a", "maximum", "exclusive", "value", "of", "n", "given", "the", "input", "data", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java#L326-L380
54,949
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java
MurmurHash3Adaptor.modulo
public static int modulo(final long h0, final long h1, final int divisor) { final long d = divisor; final long modH0 = (h0 < 0L) ? addRule(mulRule(BIT62, 2L, d), (h0 & MAX_LONG), d) : h0 % d; final long modH1 = (h1 < 0L) ? addRule(mulRule(BIT62, 2L, d), (h1 & MAX_LONG), d) : h1 % d; final long modTop = ...
java
public static int modulo(final long h0, final long h1, final int divisor) { final long d = divisor; final long modH0 = (h0 < 0L) ? addRule(mulRule(BIT62, 2L, d), (h0 & MAX_LONG), d) : h0 % d; final long modH1 = (h1 < 0L) ? addRule(mulRule(BIT62, 2L, d), (h1 & MAX_LONG), d) : h1 % d; final long modTop = ...
[ "public", "static", "int", "modulo", "(", "final", "long", "h0", ",", "final", "long", "h1", ",", "final", "int", "divisor", ")", "{", "final", "long", "d", "=", "divisor", ";", "final", "long", "modH0", "=", "(", "h0", "<", "0L", ")", "?", "addRul...
Returns the remainder from the modulo division of the 128-bit output of the murmurHash3 by the divisor. @param h0 The lower 64-bits of the 128-bit MurmurHash3 hash. @param h1 The upper 64-bits of the 128-bit MurmurHash3 hash. @param divisor Must be positive and greater than zero. @return the modulo result.
[ "Returns", "the", "remainder", "from", "the", "modulo", "division", "of", "the", "128", "-", "bit", "output", "of", "the", "murmurHash3", "by", "the", "divisor", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java#L407-L413
54,950
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/FdtSketch.java
FdtSketch.getResult
public List<Group> getResult(final int[] priKeyIndices, final int limit, final int numStdDev, final char sep) { final PostProcessor proc = new PostProcessor(this, new Group(), sep); return proc.getGroupList(priKeyIndices, numStdDev, limit); }
java
public List<Group> getResult(final int[] priKeyIndices, final int limit, final int numStdDev, final char sep) { final PostProcessor proc = new PostProcessor(this, new Group(), sep); return proc.getGroupList(priKeyIndices, numStdDev, limit); }
[ "public", "List", "<", "Group", ">", "getResult", "(", "final", "int", "[", "]", "priKeyIndices", ",", "final", "int", "limit", ",", "final", "int", "numStdDev", ",", "final", "char", "sep", ")", "{", "final", "PostProcessor", "proc", "=", "new", "PostPr...
Returns an ordered List of Groups of the most frequent distinct population of subset tuples represented by the count of entries of each group. @param priKeyIndices these indices define the dimensions used for the Primary Keys. @param limit the maximum number of groups to return. If this value is &le; 0, all groups will...
[ "Returns", "an", "ordered", "List", "of", "Groups", "of", "the", "most", "frequent", "distinct", "population", "of", "subset", "tuples", "represented", "by", "the", "count", "of", "entries", "of", "each", "group", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L89-L93
54,951
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/FdtSketch.java
FdtSketch.getLowerBound
public double getLowerBound(final int numStdDev, final int numSubsetEntries) { if (!isEstimationMode()) { return numSubsetEntries; } return BinomialBoundsN.getLowerBound(numSubsetEntries, getTheta(), numStdDev, isEmpty()); }
java
public double getLowerBound(final int numStdDev, final int numSubsetEntries) { if (!isEstimationMode()) { return numSubsetEntries; } return BinomialBoundsN.getLowerBound(numSubsetEntries, getTheta(), numStdDev, isEmpty()); }
[ "public", "double", "getLowerBound", "(", "final", "int", "numStdDev", ",", "final", "int", "numSubsetEntries", ")", "{", "if", "(", "!", "isEstimationMode", "(", ")", ")", "{", "return", "numSubsetEntries", ";", "}", "return", "BinomialBoundsN", ".", "getLowe...
Gets the estimate of the lower bound of the true distinct population represented by the count of entries in a group. @param numStdDev <a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a> @param numSubsetEntries number of entries for a chosen subset of the sketch. @return the es...
[ "Gets", "the", "estimate", "of", "the", "lower", "bound", "of", "the", "true", "distinct", "population", "represented", "by", "the", "count", "of", "entries", "in", "a", "group", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L135-L138
54,952
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/FdtSketch.java
FdtSketch.getUpperBound
public double getUpperBound(final int numStdDev, final int numSubsetEntries) { if (!isEstimationMode()) { return numSubsetEntries; } return BinomialBoundsN.getUpperBound(numSubsetEntries, getTheta(), numStdDev, isEmpty()); }
java
public double getUpperBound(final int numStdDev, final int numSubsetEntries) { if (!isEstimationMode()) { return numSubsetEntries; } return BinomialBoundsN.getUpperBound(numSubsetEntries, getTheta(), numStdDev, isEmpty()); }
[ "public", "double", "getUpperBound", "(", "final", "int", "numStdDev", ",", "final", "int", "numSubsetEntries", ")", "{", "if", "(", "!", "isEstimationMode", "(", ")", ")", "{", "return", "numSubsetEntries", ";", "}", "return", "BinomialBoundsN", ".", "getUppe...
Gets the estimate of the upper bound of the true distinct population represented by the count of entries in a group. @param numStdDev <a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a> @param numSubsetEntries number of entries for a chosen subset of the sketch. @return the es...
[ "Gets", "the", "estimate", "of", "the", "upper", "bound", "of", "the", "true", "distinct", "population", "represented", "by", "the", "count", "of", "entries", "in", "a", "group", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L149-L152
54,953
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/FdtSketch.java
FdtSketch.computeLgK
static int computeLgK(final double threshold, final double rse) { final double v = Math.ceil(1.0 / (threshold * rse * rse)); final int lgK = (int) Math.ceil(Math.log(v) / Math.log(2)); if (lgK > MAX_LG_NOM_LONGS) { throw new SketchesArgumentException("Requested Sketch (LgK = " + lgK + " &gt; 2^26), " ...
java
static int computeLgK(final double threshold, final double rse) { final double v = Math.ceil(1.0 / (threshold * rse * rse)); final int lgK = (int) Math.ceil(Math.log(v) / Math.log(2)); if (lgK > MAX_LG_NOM_LONGS) { throw new SketchesArgumentException("Requested Sketch (LgK = " + lgK + " &gt; 2^26), " ...
[ "static", "int", "computeLgK", "(", "final", "double", "threshold", ",", "final", "double", "rse", ")", "{", "final", "double", "v", "=", "Math", ".", "ceil", "(", "1.0", "/", "(", "threshold", "*", "rse", "*", "rse", ")", ")", ";", "final", "int", ...
Computes LgK given the threshold and RSE. @param threshold the fraction, between zero and 1.0, of the total stream length that defines a "Frequent" (or heavy) tuple. @param rse the maximum Relative Standard Error for the estimate of the distinct population of a reported tuple (selected with a primary key) at the thresh...
[ "Computes", "LgK", "given", "the", "threshold", "and", "RSE", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L164-L172
54,954
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java
ItemsAuxiliary.getQuantile
T getQuantile(final double fRank) { checkFractionalRankBounds(fRank); if (auxN_ <= 0) { return null; } final long pos = QuantilesHelper.posOfPhi(fRank, auxN_); return approximatelyAnswerPositionalQuery(pos); }
java
T getQuantile(final double fRank) { checkFractionalRankBounds(fRank); if (auxN_ <= 0) { return null; } final long pos = QuantilesHelper.posOfPhi(fRank, auxN_); return approximatelyAnswerPositionalQuery(pos); }
[ "T", "getQuantile", "(", "final", "double", "fRank", ")", "{", "checkFractionalRankBounds", "(", "fRank", ")", ";", "if", "(", "auxN_", "<=", "0", ")", "{", "return", "null", ";", "}", "final", "long", "pos", "=", "QuantilesHelper", ".", "posOfPhi", "(",...
Get the estimated quantile given a fractional rank. @param fRank the fractional rank where: 0 &le; fRank &le; 1.0. @return the estimated quantile
[ "Get", "the", "estimated", "quantile", "given", "a", "fractional", "rank", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java#L71-L76
54,955
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java
ItemsAuxiliary.approximatelyAnswerPositionalQuery
@SuppressWarnings("unchecked") private T approximatelyAnswerPositionalQuery(final long pos) { assert 0 <= pos; assert pos < auxN_; final int index = QuantilesHelper.chunkContainingPos(auxCumWtsArr_, pos); return (T) this.auxSamplesArr_[index]; }
java
@SuppressWarnings("unchecked") private T approximatelyAnswerPositionalQuery(final long pos) { assert 0 <= pos; assert pos < auxN_; final int index = QuantilesHelper.chunkContainingPos(auxCumWtsArr_, pos); return (T) this.auxSamplesArr_[index]; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "T", "approximatelyAnswerPositionalQuery", "(", "final", "long", "pos", ")", "{", "assert", "0", "<=", "pos", ";", "assert", "pos", "<", "auxN_", ";", "final", "int", "index", "=", "QuantilesHelper...
Assuming that there are n items in the true stream, this asks what item would appear in position 0 &le; pos &lt; n of a hypothetical sorted version of that stream. <p>Note that since that since the true stream is unavailable, we don't actually answer the question for that stream, but rather for a <i>different</i> stre...
[ "Assuming", "that", "there", "are", "n", "items", "in", "the", "true", "stream", "this", "asks", "what", "item", "would", "appear", "in", "position", "0", "&le", ";", "pos", "&lt", ";", "n", "of", "a", "hypothetical", "sorted", "version", "of", "that", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java#L90-L96
54,956
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java
ItemsAuxiliary.populateFromItemsSketch
private final static <T> void populateFromItemsSketch( final int k, final long n, final long bitPattern, final T[] combinedBuffer, final int baseBufferCount, final int numSamples, final T[] itemsArr, final long[] cumWtsArr, final Comparator<? super T> comparator) { long weight = 1; int nxt = 0...
java
private final static <T> void populateFromItemsSketch( final int k, final long n, final long bitPattern, final T[] combinedBuffer, final int baseBufferCount, final int numSamples, final T[] itemsArr, final long[] cumWtsArr, final Comparator<? super T> comparator) { long weight = 1; int nxt = 0...
[ "private", "final", "static", "<", "T", ">", "void", "populateFromItemsSketch", "(", "final", "int", "k", ",", "final", "long", "n", ",", "final", "long", "bitPattern", ",", "final", "T", "[", "]", "combinedBuffer", ",", "final", "int", "baseBufferCount", ...
Populate the arrays and registers from an ItemsSketch @param <T> the data type @param k K value of sketch @param n The current size of the stream @param bitPattern the bit pattern for valid log levels @param combinedBuffer the combined buffer reference @param baseBufferCount the count of the base buffer @param numSampl...
[ "Populate", "the", "arrays", "and", "registers", "from", "an", "ItemsSketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsAuxiliary.java#L111-L146
54,957
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java
DirectCompactUnorderedSketch.wrapInstance
static DirectCompactUnorderedSketch wrapInstance(final Memory srcMem, final long seed) { final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT); final short computedSeedHash = computeSeedHash(seed); checkSeedHashes(memSeedHash, computedSeedHash); return new DirectCompactUnorderedSketch(srcMem); }
java
static DirectCompactUnorderedSketch wrapInstance(final Memory srcMem, final long seed) { final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT); final short computedSeedHash = computeSeedHash(seed); checkSeedHashes(memSeedHash, computedSeedHash); return new DirectCompactUnorderedSketch(srcMem); }
[ "static", "DirectCompactUnorderedSketch", "wrapInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "short", "memSeedHash", "=", "srcMem", ".", "getShort", "(", "SEED_HASH_SHORT", ")", ";", "final", "short", "computedSeedHa...
Wraps the given Memory, which must be a SerVer 3, unordered, Compact Sketch image. Must check the validity of the Memory before calling. @param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>. @return this ...
[ "Wraps", "the", "given", "Memory", "which", "must", "be", "a", "SerVer", "3", "unordered", "Compact", "Sketch", "image", ".", "Must", "check", "the", "validity", "of", "the", "Memory", "before", "calling", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java#L41-L46
54,958
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java
DirectCompactUnorderedSketch.compact
static DirectCompactUnorderedSketch compact(final UpdateSketch sketch, final WritableMemory dstMem) { final int curCount = sketch.getRetainedEntries(true); long thetaLong = sketch.getThetaLong(); boolean empty = sketch.isEmpty(); thetaLong = thetaOnCompact(empty, curCount, thetaLong); empty = ...
java
static DirectCompactUnorderedSketch compact(final UpdateSketch sketch, final WritableMemory dstMem) { final int curCount = sketch.getRetainedEntries(true); long thetaLong = sketch.getThetaLong(); boolean empty = sketch.isEmpty(); thetaLong = thetaOnCompact(empty, curCount, thetaLong); empty = ...
[ "static", "DirectCompactUnorderedSketch", "compact", "(", "final", "UpdateSketch", "sketch", ",", "final", "WritableMemory", "dstMem", ")", "{", "final", "int", "curCount", "=", "sketch", ".", "getRetainedEntries", "(", "true", ")", ";", "long", "thetaLong", "=", ...
Constructs given an UpdateSketch. @param sketch the given UpdateSketch @param dstMem the given destination Memory. This clears it before use. @return a DirectCompactUnorderedSketch
[ "Constructs", "given", "an", "UpdateSketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java#L54-L70
54,959
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java
DirectCompactUnorderedSketch.compact
static DirectCompactUnorderedSketch compact(final long[] cache, final boolean empty, final short seedHash, final int curCount, final long thetaLong, final WritableMemory dstMem) { final int preLongs = computeCompactPreLongs(thetaLong, empty, curCount); final int requiredFlags = READ_ONLY_FLAG_MASK | COMPA...
java
static DirectCompactUnorderedSketch compact(final long[] cache, final boolean empty, final short seedHash, final int curCount, final long thetaLong, final WritableMemory dstMem) { final int preLongs = computeCompactPreLongs(thetaLong, empty, curCount); final int requiredFlags = READ_ONLY_FLAG_MASK | COMPA...
[ "static", "DirectCompactUnorderedSketch", "compact", "(", "final", "long", "[", "]", "cache", ",", "final", "boolean", "empty", ",", "final", "short", "seedHash", ",", "final", "int", "curCount", ",", "final", "long", "thetaLong", ",", "final", "WritableMemory",...
Constructs this sketch from correct, valid components. @param cache in compact, ordered form @param empty The correct <a href="{@docRoot}/resources/dictionary.html#empty">Empty</a>. @param seedHash The correct <a href="{@docRoot}/resources/dictionary.html#seedHash">Seed Hash</a>. @param curCount correct value @param th...
[ "Constructs", "this", "sketch", "from", "correct", "valid", "components", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java#L84-L91
54,960
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java
ReservoirLongsSketch.getSamples
public long[] getSamples() { if (itemsSeen_ == 0) { return null; } final int numSamples = (int) Math.min(reservoirSize_, itemsSeen_); return java.util.Arrays.copyOf(data_, numSamples); }
java
public long[] getSamples() { if (itemsSeen_ == 0) { return null; } final int numSamples = (int) Math.min(reservoirSize_, itemsSeen_); return java.util.Arrays.copyOf(data_, numSamples); }
[ "public", "long", "[", "]", "getSamples", "(", ")", "{", "if", "(", "itemsSeen_", "==", "0", ")", "{", "return", "null", ";", "}", "final", "int", "numSamples", "=", "(", "int", ")", "Math", ".", "min", "(", "reservoirSize_", ",", "itemsSeen_", ")", ...
Returns a copy of the items in the reservoir. The returned array length may be smaller than the reservoir capacity. @return A copy of the reservoir array
[ "Returns", "a", "copy", "of", "the", "items", "in", "the", "reservoir", ".", "The", "returned", "array", "length", "may", "be", "smaller", "than", "the", "reservoir", "capacity", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java#L281-L287
54,961
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/adouble/DoubleSummary.java
DoubleSummary.fromMemory
public static DeserializeResult<DoubleSummary> fromMemory(final Memory mem) { return new DeserializeResult<>(new DoubleSummary(mem.getDouble(VALUE_DOUBLE), Mode.values()[mem.getByte(MODE_BYTE)]), SERIALIZED_SIZE_BYTES); }
java
public static DeserializeResult<DoubleSummary> fromMemory(final Memory mem) { return new DeserializeResult<>(new DoubleSummary(mem.getDouble(VALUE_DOUBLE), Mode.values()[mem.getByte(MODE_BYTE)]), SERIALIZED_SIZE_BYTES); }
[ "public", "static", "DeserializeResult", "<", "DoubleSummary", ">", "fromMemory", "(", "final", "Memory", "mem", ")", "{", "return", "new", "DeserializeResult", "<>", "(", "new", "DoubleSummary", "(", "mem", ".", "getDouble", "(", "VALUE_DOUBLE", ")", ",", "Mo...
Creates an instance of the DoubleSummary given a serialized representation @param mem Memory object with serialized DoubleSummary @return DeserializedResult object, which contains a DoubleSummary object and number of bytes read from the Memory
[ "Creates", "an", "instance", "of", "the", "DoubleSummary", "given", "a", "serialized", "representation" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/adouble/DoubleSummary.java#L125-L128
54,962
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirLongsUnion.java
ReservoirLongsUnion.update
public void update(final long datum) { if (gadget_ == null) { gadget_ = ReservoirLongsSketch.newInstance(maxK_); } gadget_.update(datum); }
java
public void update(final long datum) { if (gadget_ == null) { gadget_ = ReservoirLongsSketch.newInstance(maxK_); } gadget_.update(datum); }
[ "public", "void", "update", "(", "final", "long", "datum", ")", "{", "if", "(", "gadget_", "==", "null", ")", "{", "gadget_", "=", "ReservoirLongsSketch", ".", "newInstance", "(", "maxK_", ")", ";", "}", "gadget_", ".", "update", "(", "datum", ")", ";"...
Present this union with a long. @param datum The given long datum.
[ "Present", "this", "union", "with", "a", "long", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirLongsUnion.java#L176-L181
54,963
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/PreambleUtil.java
PreambleUtil.preambleToString
static String preambleToString(final byte[] byteArr) { final Memory mem = Memory.wrap(byteArr); return preambleToString(mem); }
java
static String preambleToString(final byte[] byteArr) { final Memory mem = Memory.wrap(byteArr); return preambleToString(mem); }
[ "static", "String", "preambleToString", "(", "final", "byte", "[", "]", "byteArr", ")", "{", "final", "Memory", "mem", "=", "Memory", ".", "wrap", "(", "byteArr", ")", ";", "return", "preambleToString", "(", "mem", ")", ";", "}" ]
Returns a human readable string summary of the preamble state of the given byte array. Used primarily in testing. @param byteArr the given byte array. @return the summary preamble string.
[ "Returns", "a", "human", "readable", "string", "summary", "of", "the", "preamble", "state", "of", "the", "given", "byte", "array", ".", "Used", "primarily", "in", "testing", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/PreambleUtil.java#L196-L199
54,964
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesAuxiliary.java
DoublesAuxiliary.populateFromDoublesSketch
private final static void populateFromDoublesSketch( final int k, final long n, final long bitPattern, final DoublesSketchAccessor sketchAccessor, final double[] itemsArr, final long[] cumWtsArr) { long weight = 1; int nxt = 0; long bits = bitPattern; assert bits == (n / (2...
java
private final static void populateFromDoublesSketch( final int k, final long n, final long bitPattern, final DoublesSketchAccessor sketchAccessor, final double[] itemsArr, final long[] cumWtsArr) { long weight = 1; int nxt = 0; long bits = bitPattern; assert bits == (n / (2...
[ "private", "final", "static", "void", "populateFromDoublesSketch", "(", "final", "int", "k", ",", "final", "long", "n", ",", "final", "long", "bitPattern", ",", "final", "DoublesSketchAccessor", "sketchAccessor", ",", "final", "double", "[", "]", "itemsArr", ","...
Populate the arrays and registers from a DoublesSketch @param k K value of sketch @param n The current size of the stream @param bitPattern the bit pattern for valid log levels @param sketchAccessor A DoublesSketchAccessor around the sketch @param itemsArr the consolidated array of all items from the sketch populated h...
[ "Populate", "the", "arrays", "and", "registers", "from", "a", "DoublesSketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesAuxiliary.java#L96-L133
54,965
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesAuxiliary.java
DoublesAuxiliary.blockyTandemMergeSort
static void blockyTandemMergeSort(final double[] keyArr, final long[] valArr, final int arrLen, final int blkSize) { assert blkSize >= 1; if (arrLen <= blkSize) { return; } int numblks = arrLen / blkSize; if ((numblks * blkSize) < arrLen) { numblks += 1; } assert ((numblks * blkSize) >= arrLen...
java
static void blockyTandemMergeSort(final double[] keyArr, final long[] valArr, final int arrLen, final int blkSize) { assert blkSize >= 1; if (arrLen <= blkSize) { return; } int numblks = arrLen / blkSize; if ((numblks * blkSize) < arrLen) { numblks += 1; } assert ((numblks * blkSize) >= arrLen...
[ "static", "void", "blockyTandemMergeSort", "(", "final", "double", "[", "]", "keyArr", ",", "final", "long", "[", "]", "valArr", ",", "final", "int", "arrLen", ",", "final", "int", "blkSize", ")", "{", "assert", "blkSize", ">=", "1", ";", "if", "(", "a...
used by DoublesAuxiliary and UtilTest
[ "used", "by", "DoublesAuxiliary", "and", "UtilTest" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesAuxiliary.java#L147-L163
54,966
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesAuxiliary.java
DoublesAuxiliary.tandemMerge
private static void tandemMerge(final double[] keySrc, final long[] valSrc, final int arrStart1, final int arrLen1, final int arrStart2, final int arrLen2, final double[] keyDst, final long[] valDst, ...
java
private static void tandemMerge(final double[] keySrc, final long[] valSrc, final int arrStart1, final int arrLen1, final int arrStart2, final int arrLen2, final double[] keyDst, final long[] valDst, ...
[ "private", "static", "void", "tandemMerge", "(", "final", "double", "[", "]", "keySrc", ",", "final", "long", "[", "]", "valSrc", ",", "final", "int", "arrStart1", ",", "final", "int", "arrLen1", ",", "final", "int", "arrStart2", ",", "final", "int", "ar...
Performs two merges in tandem. One of them provides the sort keys while the other one passively undergoes the same data motion. @param keySrc key source @param valSrc value source @param arrStart1 Array 1 start offset @param arrLen1 Array 1 length @param arrStart2 Array 2 start offset @param arrLen2 Array 2 length @par...
[ "Performs", "two", "merges", "in", "tandem", ".", "One", "of", "them", "provides", "the", "sort", "keys", "while", "the", "other", "one", "passively", "undergoes", "the", "same", "data", "motion", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesAuxiliary.java#L235-L267
54,967
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java
MurmurHash3v2.hash
public static long[] hash(final long[] in, final long seed) { if ((in == null) || (in.length == 0)) { return emptyOrNull(seed, new long[2]); } return hash(Memory.wrap(in), 0L, in.length << 3, seed, new long[2]); }
java
public static long[] hash(final long[] in, final long seed) { if ((in == null) || (in.length == 0)) { return emptyOrNull(seed, new long[2]); } return hash(Memory.wrap(in), 0L, in.length << 3, seed, new long[2]); }
[ "public", "static", "long", "[", "]", "hash", "(", "final", "long", "[", "]", "in", ",", "final", "long", "seed", ")", "{", "if", "(", "(", "in", "==", "null", ")", "||", "(", "in", ".", "length", "==", "0", ")", ")", "{", "return", "emptyOrNul...
Returns a 128-bit hash of the input. Provided for compatibility with older version of MurmurHash3, but empty or null input now returns a hash. @param in long array @param seed A long valued seed. @return the hash
[ "Returns", "a", "128", "-", "bit", "hash", "of", "the", "input", ".", "Provided", "for", "compatibility", "with", "older", "version", "of", "MurmurHash3", "but", "empty", "or", "null", "input", "now", "returns", "a", "hash", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java#L46-L51
54,968
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java
MurmurHash3v2.hash
public static long[] hash(final String in, final long seed, final long[] hashOut) { if ((in == null) || (in.length() == 0)) { return emptyOrNull(seed, hashOut); } final byte[] byteArr = in.getBytes(UTF_8); return hash(Memory.wrap(byteArr), 0L, byteArr.length, seed, hashOut); }
java
public static long[] hash(final String in, final long seed, final long[] hashOut) { if ((in == null) || (in.length() == 0)) { return emptyOrNull(seed, hashOut); } final byte[] byteArr = in.getBytes(UTF_8); return hash(Memory.wrap(byteArr), 0L, byteArr.length, seed, hashOut); }
[ "public", "static", "long", "[", "]", "hash", "(", "final", "String", "in", ",", "final", "long", "seed", ",", "final", "long", "[", "]", "hashOut", ")", "{", "if", "(", "(", "in", "==", "null", ")", "||", "(", "in", ".", "length", "(", ")", "=...
Returns a 128-bit hash of the input. @param in a String @param seed A long valued seed. @param hashOut A long array of size 2 @return the hash
[ "Returns", "a", "128", "-", "bit", "hash", "of", "the", "input", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java#L137-L143
54,969
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java
MurmurHash3v2.mixK1
private static long mixK1(long k1) { k1 *= C1; k1 = Long.rotateLeft(k1, 31); k1 *= C2; return k1; }
java
private static long mixK1(long k1) { k1 *= C1; k1 = Long.rotateLeft(k1, 31); k1 *= C2; return k1; }
[ "private", "static", "long", "mixK1", "(", "long", "k1", ")", "{", "k1", "*=", "C1", ";", "k1", "=", "Long", ".", "rotateLeft", "(", "k1", ",", "31", ")", ";", "k1", "*=", "C2", ";", "return", "k1", ";", "}" ]
Self mix of k1 @param k1 input argument @return mix
[ "Self", "mix", "of", "k1" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java#L282-L287
54,970
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java
MurmurHash3v2.mixK2
private static long mixK2(long k2) { k2 *= C2; k2 = Long.rotateLeft(k2, 33); k2 *= C1; return k2; }
java
private static long mixK2(long k2) { k2 *= C2; k2 = Long.rotateLeft(k2, 33); k2 *= C1; return k2; }
[ "private", "static", "long", "mixK2", "(", "long", "k2", ")", "{", "k2", "*=", "C2", ";", "k2", "=", "Long", ".", "rotateLeft", "(", "k2", ",", "33", ")", ";", "k2", "*=", "C1", ";", "return", "k2", ";", "}" ]
Self mix of k2 @param k2 input argument @return mix
[ "Self", "mix", "of", "k2" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3v2.java#L295-L300
54,971
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsByteArrayImpl.java
ItemsByteArrayImpl.combinedBufferToItemsArray
@SuppressWarnings("unchecked") private static <T> T[] combinedBufferToItemsArray(final ItemsSketch<T> sketch, final boolean ordered) { final int extra = 2; // extra space for min and max values final int outArrCap = sketch.getRetainedItems(); final T minValue = sketch.getMinValue(); final T[] ou...
java
@SuppressWarnings("unchecked") private static <T> T[] combinedBufferToItemsArray(final ItemsSketch<T> sketch, final boolean ordered) { final int extra = 2; // extra space for min and max values final int outArrCap = sketch.getRetainedItems(); final T minValue = sketch.getMinValue(); final T[] ou...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "<", "T", ">", "T", "[", "]", "combinedBufferToItemsArray", "(", "final", "ItemsSketch", "<", "T", ">", "sketch", ",", "final", "boolean", "ordered", ")", "{", "final", "int", "extra", ...
Returns an array of items in compact form, including min and max extracted from the Combined Buffer. @param <T> the data type @param sketch a type of ItemsSketch @param ordered true if the desired form of the resulting array has the base buffer sorted. @return an array of items, including min and max extracted from the...
[ "Returns", "an", "array", "of", "items", "in", "compact", "form", "including", "min", "and", "max", "extracted", "from", "the", "Combined", "Buffer", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsByteArrayImpl.java#L77-L110
54,972
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/JaccardSimilarity.java
JaccardSimilarity.exactlyEqual
public static boolean exactlyEqual(final Sketch sketchA, final Sketch sketchB) { //Corner case checks if ((sketchA == null) || (sketchB == null)) { return false; } if (sketchA == sketchB) { return true; } if (sketchA.isEmpty() && sketchB.isEmpty()) { return true; } if (sketchA.isEmpty() || sketchB.i...
java
public static boolean exactlyEqual(final Sketch sketchA, final Sketch sketchB) { //Corner case checks if ((sketchA == null) || (sketchB == null)) { return false; } if (sketchA == sketchB) { return true; } if (sketchA.isEmpty() && sketchB.isEmpty()) { return true; } if (sketchA.isEmpty() || sketchB.i...
[ "public", "static", "boolean", "exactlyEqual", "(", "final", "Sketch", "sketchA", ",", "final", "Sketch", "sketchB", ")", "{", "//Corner case checks", "if", "(", "(", "sketchA", "==", "null", ")", "||", "(", "sketchB", "==", "null", ")", ")", "{", "return"...
Returns true if the two given sketches have exactly the same hash values and the same theta values. Thus, they are equivalent. @param sketchA the given sketch A @param sketchB the given sketch B @return true if the two given sketches have exactly the same hash values and the same theta values.
[ "Returns", "true", "if", "the", "two", "given", "sketches", "have", "exactly", "the", "same", "hash", "values", "and", "the", "same", "theta", "values", ".", "Thus", "they", "are", "equivalent", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/JaccardSimilarity.java#L92-L119
54,973
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/Union.java
Union.update
public void update(final Sketch<S> sketchIn) { if (sketchIn == null || sketchIn.isEmpty()) { return; } if (sketchIn.theta_ < theta_) { theta_ = sketchIn.theta_; } final SketchIterator<S> it = sketchIn.iterator(); while (it.next()) { sketch_.merge(it.getKey(), it.getSummary(), summarySetOps_); ...
java
public void update(final Sketch<S> sketchIn) { if (sketchIn == null || sketchIn.isEmpty()) { return; } if (sketchIn.theta_ < theta_) { theta_ = sketchIn.theta_; } final SketchIterator<S> it = sketchIn.iterator(); while (it.next()) { sketch_.merge(it.getKey(), it.getSummary(), summarySetOps_); ...
[ "public", "void", "update", "(", "final", "Sketch", "<", "S", ">", "sketchIn", ")", "{", "if", "(", "sketchIn", "==", "null", "||", "sketchIn", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "if", "(", "sketchIn", ".", "theta_", "<", "thet...
Updates the internal set by adding entries from the given sketch @param sketchIn input sketch to add to the internal set
[ "Updates", "the", "internal", "set", "by", "adding", "entries", "from", "the", "given", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/Union.java#L48-L55
54,974
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/PostProcessor.java
PostProcessor.getGroupList
public List<Group> getGroupList(final int[] priKeyIndices, final int numStdDev, final int limit) { //allows subsequent queries with different priKeyIndices without rebuilding the map if (!mapValid) { populateMap(priKeyIndices); } return populateList(numStdDev, limit); }
java
public List<Group> getGroupList(final int[] priKeyIndices, final int numStdDev, final int limit) { //allows subsequent queries with different priKeyIndices without rebuilding the map if (!mapValid) { populateMap(priKeyIndices); } return populateList(numStdDev, limit); }
[ "public", "List", "<", "Group", ">", "getGroupList", "(", "final", "int", "[", "]", "priKeyIndices", ",", "final", "int", "numStdDev", ",", "final", "int", "limit", ")", "{", "//allows subsequent queries with different priKeyIndices without rebuilding the map", "if", ...
Return the most frequent Groups associated with Primary Keys based on the size of the groups. @param priKeyIndices the indices of the primary dimensions @param numStdDev the number of standard deviations for the error bounds, this value is an integer and must be one of 1, 2, or 3. <a href="{@docRoot}/resources/dictiona...
[ "Return", "the", "most", "frequent", "Groups", "associated", "with", "Primary", "Keys", "based", "on", "the", "size", "of", "the", "groups", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/PostProcessor.java#L73-L78
54,975
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/PostProcessor.java
PostProcessor.populateMap
private void populateMap(final int[] priKeyIndices) { final SketchIterator<ArrayOfStringsSummary> it = sketch.iterator(); Arrays.fill(hashArr, 0L); Arrays.fill(priKeyArr, null); Arrays.fill(counterArr, 0); groupCount = 0; final int lgMapArrSize = Integer.numberOfTrailingZeros(mapArrSize); w...
java
private void populateMap(final int[] priKeyIndices) { final SketchIterator<ArrayOfStringsSummary> it = sketch.iterator(); Arrays.fill(hashArr, 0L); Arrays.fill(priKeyArr, null); Arrays.fill(counterArr, 0); groupCount = 0; final int lgMapArrSize = Integer.numberOfTrailingZeros(mapArrSize); w...
[ "private", "void", "populateMap", "(", "final", "int", "[", "]", "priKeyIndices", ")", "{", "final", "SketchIterator", "<", "ArrayOfStringsSummary", ">", "it", "=", "sketch", ".", "iterator", "(", ")", ";", "Arrays", ".", "fill", "(", "hashArr", ",", "0L",...
Scan each entry in the sketch. Count the number of duplicate occurrences of each primary key in a hash map. @param priKeyIndices identifies the primary key indices
[ "Scan", "each", "entry", "in", "the", "sketch", ".", "Count", "the", "number", "of", "duplicate", "occurrences", "of", "each", "primary", "key", "in", "a", "hash", "map", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/PostProcessor.java#L85-L108
54,976
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/PostProcessor.java
PostProcessor.populateList
private List<Group> populateList(final int numStdDev, final int limit) { final List<Group> list = new ArrayList<>(); for (int i = 0; i < mapArrSize; i++) { if (hashArr[i] != 0) { final String priKey = priKeyArr[i]; final int count = counterArr[i]; final double est = sketch.getEstim...
java
private List<Group> populateList(final int numStdDev, final int limit) { final List<Group> list = new ArrayList<>(); for (int i = 0; i < mapArrSize; i++) { if (hashArr[i] != 0) { final String priKey = priKeyArr[i]; final int count = counterArr[i]; final double est = sketch.getEstim...
[ "private", "List", "<", "Group", ">", "populateList", "(", "final", "int", "numStdDev", ",", "final", "int", "limit", ")", "{", "final", "List", "<", "Group", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "...
Create the list of groups along with the error statistics @param numStdDev number of standard deviations @param limit the maximum size of the list to return @return the list of groups along with the error statistics
[ "Create", "the", "list", "of", "groups", "along", "with", "the", "error", "statistics" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/PostProcessor.java#L116-L142
54,977
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/PostProcessor.java
PostProcessor.getPrimaryKey
private static String getPrimaryKey(final String[] tuple, final int[] priKeyIndices, final char sep) { assert priKeyIndices.length < tuple.length; final StringBuilder sb = new StringBuilder(); final int keys = priKeyIndices.length; for (int i = 0; i < keys; i++) { final int idx = priKeyIndic...
java
private static String getPrimaryKey(final String[] tuple, final int[] priKeyIndices, final char sep) { assert priKeyIndices.length < tuple.length; final StringBuilder sb = new StringBuilder(); final int keys = priKeyIndices.length; for (int i = 0; i < keys; i++) { final int idx = priKeyIndic...
[ "private", "static", "String", "getPrimaryKey", "(", "final", "String", "[", "]", "tuple", ",", "final", "int", "[", "]", "priKeyIndices", ",", "final", "char", "sep", ")", "{", "assert", "priKeyIndices", ".", "length", "<", "tuple", ".", "length", ";", ...
also used by test
[ "also", "used", "by", "test" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/PostProcessor.java#L153-L164
54,978
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/ToByteArrayImpl.java
ToByteArrayImpl.toHllByteArray
static final byte[] toHllByteArray(final AbstractHllArray impl, final boolean compact) { int auxBytes = 0; if (impl.tgtHllType == TgtHllType.HLL_4) { final AuxHashMap auxHashMap = impl.getAuxHashMap(); if (auxHashMap != null) { auxBytes = (compact) ? auxHashMap.getCompactSizeByte...
java
static final byte[] toHllByteArray(final AbstractHllArray impl, final boolean compact) { int auxBytes = 0; if (impl.tgtHllType == TgtHllType.HLL_4) { final AuxHashMap auxHashMap = impl.getAuxHashMap(); if (auxHashMap != null) { auxBytes = (compact) ? auxHashMap.getCompactSizeByte...
[ "static", "final", "byte", "[", "]", "toHllByteArray", "(", "final", "AbstractHllArray", "impl", ",", "final", "boolean", "compact", ")", "{", "int", "auxBytes", "=", "0", ";", "if", "(", "impl", ".", "tgtHllType", "==", "TgtHllType", ".", "HLL_4", ")", ...
To byte array used by the heap HLL types.
[ "To", "byte", "array", "used", "by", "the", "heap", "HLL", "types", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/ToByteArrayImpl.java#L42-L59
54,979
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/PreambleUtil.java
PreambleUtil.getAndCheckPreLongs
static int getAndCheckPreLongs(final Memory mem) { final long cap = mem.getCapacity(); if (cap < 8) { throwNotBigEnough(cap, 8); } final int preLongs = mem.getByte(0) & 0x3F; final int required = Math.max(preLongs << 3, 8); if (cap < required) { throwNotBigEnough(cap, required); } return preLong...
java
static int getAndCheckPreLongs(final Memory mem) { final long cap = mem.getCapacity(); if (cap < 8) { throwNotBigEnough(cap, 8); } final int preLongs = mem.getByte(0) & 0x3F; final int required = Math.max(preLongs << 3, 8); if (cap < required) { throwNotBigEnough(cap, required); } return preLong...
[ "static", "int", "getAndCheckPreLongs", "(", "final", "Memory", "mem", ")", "{", "final", "long", "cap", "=", "mem", ".", "getCapacity", "(", ")", ";", "if", "(", "cap", "<", "8", ")", "{", "throwNotBigEnough", "(", "cap", ",", "8", ")", ";", "}", ...
Checks Memory for capacity to hold the preamble and returns the extracted preLongs. @param mem the given Memory @return the extracted prelongs value.
[ "Checks", "Memory", "for", "capacity", "to", "hold", "the", "preamble", "and", "returns", "the", "extracted", "preLongs", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/PreambleUtil.java#L430-L437
54,980
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesIntersection.java
ArrayOfDoublesIntersection.update
public void update(final ArrayOfDoublesSketch sketchIn, final ArrayOfDoublesCombiner combiner) { final boolean isFirstCall = isFirstCall_; isFirstCall_ = false; if (sketchIn == null) { isEmpty_ = true; sketch_ = null; return; } Util.checkSeedHashes(seedHash_, sketchIn.getSeedHash()...
java
public void update(final ArrayOfDoublesSketch sketchIn, final ArrayOfDoublesCombiner combiner) { final boolean isFirstCall = isFirstCall_; isFirstCall_ = false; if (sketchIn == null) { isEmpty_ = true; sketch_ = null; return; } Util.checkSeedHashes(seedHash_, sketchIn.getSeedHash()...
[ "public", "void", "update", "(", "final", "ArrayOfDoublesSketch", "sketchIn", ",", "final", "ArrayOfDoublesCombiner", "combiner", ")", "{", "final", "boolean", "isFirstCall", "=", "isFirstCall_", ";", "isFirstCall_", "=", "false", ";", "if", "(", "sketchIn", "==",...
Updates the internal set by intersecting it with the given sketch. @param sketchIn Input sketch to intersect with the internal set. @param combiner Method of combining two arrays of double values
[ "Updates", "the", "internal", "set", "by", "intersecting", "it", "with", "the", "given", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesIntersection.java#L43-L90
54,981
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesIntersection.java
ArrayOfDoublesIntersection.getResult
public ArrayOfDoublesCompactSketch getResult(final WritableMemory dstMem) { if (isFirstCall_) { throw new SketchesStateException( "getResult() with no intervening intersections is not a legal result."); } if (sketch_ == null) { return new HeapArrayOfDoublesCompactSketch( null...
java
public ArrayOfDoublesCompactSketch getResult(final WritableMemory dstMem) { if (isFirstCall_) { throw new SketchesStateException( "getResult() with no intervening intersections is not a legal result."); } if (sketch_ == null) { return new HeapArrayOfDoublesCompactSketch( null...
[ "public", "ArrayOfDoublesCompactSketch", "getResult", "(", "final", "WritableMemory", "dstMem", ")", "{", "if", "(", "isFirstCall_", ")", "{", "throw", "new", "SketchesStateException", "(", "\"getResult() with no intervening intersections is not a legal result.\"", ")", ";", ...
Gets the internal set as an off-heap compact sketch using the given memory. @param dstMem Memory for the compact sketch (can be null). @return Result of the intersections so far as a compact sketch.
[ "Gets", "the", "internal", "set", "as", "an", "off", "-", "heap", "compact", "sketch", "using", "the", "given", "memory", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesIntersection.java#L97-L107
54,982
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesIntersection.java
ArrayOfDoublesIntersection.reset
public void reset() { isEmpty_ = false; theta_ = Long.MAX_VALUE; sketch_ = null; isFirstCall_ = true; }
java
public void reset() { isEmpty_ = false; theta_ = Long.MAX_VALUE; sketch_ = null; isFirstCall_ = true; }
[ "public", "void", "reset", "(", ")", "{", "isEmpty_", "=", "false", ";", "theta_", "=", "Long", ".", "MAX_VALUE", ";", "sketch_", "=", "null", ";", "isFirstCall_", "=", "true", ";", "}" ]
Resets the internal set to the initial state, which represents the Universal Set
[ "Resets", "the", "internal", "set", "to", "the", "initial", "state", "which", "represents", "the", "Universal", "Set" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesIntersection.java#L120-L125
54,983
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesSketch.java
ArrayOfDoublesSketch.heapify
public static ArrayOfDoublesSketch heapify(final Memory mem, final long seed) { final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem); if (sketchType == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) { return new HeapArrayOfDoublesQuickSelectSke...
java
public static ArrayOfDoublesSketch heapify(final Memory mem, final long seed) { final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem); if (sketchType == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) { return new HeapArrayOfDoublesQuickSelectSke...
[ "public", "static", "ArrayOfDoublesSketch", "heapify", "(", "final", "Memory", "mem", ",", "final", "long", "seed", ")", "{", "final", "SerializerDeserializer", ".", "SketchType", "sketchType", "=", "SerializerDeserializer", ".", "getSketchType", "(", "mem", ")", ...
Heapify the given Memory and seed as a ArrayOfDoublesSketch @param mem the given Memory @param seed the given seed @return an ArrayOfDoublesSketch
[ "Heapify", "the", "given", "Memory", "and", "seed", "as", "a", "ArrayOfDoublesSketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesSketch.java#L72-L78
54,984
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesSketch.java
ArrayOfDoublesSketch.wrap
public static ArrayOfDoublesSketch wrap(final Memory mem, final long seed) { final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem); if (sketchType == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) { return new DirectArrayOfDoublesQuickSelectSket...
java
public static ArrayOfDoublesSketch wrap(final Memory mem, final long seed) { final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem); if (sketchType == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) { return new DirectArrayOfDoublesQuickSelectSket...
[ "public", "static", "ArrayOfDoublesSketch", "wrap", "(", "final", "Memory", "mem", ",", "final", "long", "seed", ")", "{", "final", "SerializerDeserializer", ".", "SketchType", "sketchType", "=", "SerializerDeserializer", ".", "getSketchType", "(", "mem", ")", ";"...
Wrap the given Memory and seed as a ArrayOfDoublesSketch @param mem the given Memory @param seed the given seed @return an ArrayOfDoublesSketch
[ "Wrap", "the", "given", "Memory", "and", "seed", "as", "a", "ArrayOfDoublesSketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesSketch.java#L95-L101
54,985
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/AnotB.java
AnotB.aNotB
public CompactSketch aNotB(final Sketch a, final Sketch b) { return aNotB(a, b, true, null); }
java
public CompactSketch aNotB(final Sketch a, final Sketch b) { return aNotB(a, b, true, null); }
[ "public", "CompactSketch", "aNotB", "(", "final", "Sketch", "a", ",", "final", "Sketch", "b", ")", "{", "return", "aNotB", "(", "a", ",", "b", ",", "true", ",", "null", ")", ";", "}" ]
Perform A-and-not-B set operation on the two given sketches and return the result as an ordered CompactSketch on the heap. @param a The incoming sketch for the first argument @param b The incoming sketch for the second argument @return an ordered CompactSketch on the heap
[ "Perform", "A", "-", "and", "-", "not", "-", "B", "set", "operation", "on", "the", "two", "given", "sketches", "and", "return", "the", "result", "as", "an", "ordered", "CompactSketch", "on", "the", "heap", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/AnotB.java#L69-L71
54,986
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/HllSketch.java
HllSketch.heapify
public static final HllSketch heapify(final Memory srcMem) { final CurMode curMode = checkPreamble(srcMem); final HllSketch heapSketch; if (curMode == CurMode.HLL) { final TgtHllType tgtHllType = extractTgtHllType(srcMem); if (tgtHllType == TgtHllType.HLL_4) { heapSketch = new HllSketch(...
java
public static final HllSketch heapify(final Memory srcMem) { final CurMode curMode = checkPreamble(srcMem); final HllSketch heapSketch; if (curMode == CurMode.HLL) { final TgtHllType tgtHllType = extractTgtHllType(srcMem); if (tgtHllType == TgtHllType.HLL_4) { heapSketch = new HllSketch(...
[ "public", "static", "final", "HllSketch", "heapify", "(", "final", "Memory", "srcMem", ")", "{", "final", "CurMode", "curMode", "=", "checkPreamble", "(", "srcMem", ")", ";", "final", "HllSketch", "heapSketch", ";", "if", "(", "curMode", "==", "CurMode", "."...
Heapify the given Memory, which must be a valid HllSketch image and may have data. @param srcMem the given Memory, which is read-only. @return an HllSketch on the java heap.
[ "Heapify", "the", "given", "Memory", "which", "must", "be", "a", "valid", "HllSketch", "image", "and", "may", "have", "data", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllSketch.java#L136-L154
54,987
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/HllSketch.java
HllSketch.writableWrap
public static final HllSketch writableWrap(final WritableMemory wmem) { final boolean compact = extractCompactFlag(wmem); if (compact) { throw new SketchesArgumentException( "Cannot perform a writableWrap of a writable sketch image that is in compact form."); } final int lgConfigK = extr...
java
public static final HllSketch writableWrap(final WritableMemory wmem) { final boolean compact = extractCompactFlag(wmem); if (compact) { throw new SketchesArgumentException( "Cannot perform a writableWrap of a writable sketch image that is in compact form."); } final int lgConfigK = extr...
[ "public", "static", "final", "HllSketch", "writableWrap", "(", "final", "WritableMemory", "wmem", ")", "{", "final", "boolean", "compact", "=", "extractCompactFlag", "(", "wmem", ")", ";", "if", "(", "compact", ")", "{", "throw", "new", "SketchesArgumentExceptio...
Wraps the given WritableMemory, which must be a image of a valid updatable sketch, and may have data. What remains on the java heap is a thin wrapper object that reads and writes to the given WritableMemory, which, depending on how the user configures the WritableMemory, may actually reside on the Java heap or off-heap...
[ "Wraps", "the", "given", "WritableMemory", "which", "must", "be", "a", "image", "of", "a", "valid", "updatable", "sketch", "and", "may", "have", "data", ".", "What", "remains", "on", "the", "java", "heap", "is", "a", "thin", "wrapper", "object", "that", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllSketch.java#L167-L197
54,988
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/HllSketch.java
HllSketch.getMaxUpdatableSerializationBytes
public static final int getMaxUpdatableSerializationBytes(final int lgConfigK, final TgtHllType tgtHllType) { final int arrBytes; if (tgtHllType == TgtHllType.HLL_4) { final int auxBytes = 4 << LG_AUX_ARR_INTS[lgConfigK]; arrBytes = AbstractHllArray.hll4ArrBytes(lgConfigK) + auxBytes; } ...
java
public static final int getMaxUpdatableSerializationBytes(final int lgConfigK, final TgtHllType tgtHllType) { final int arrBytes; if (tgtHllType == TgtHllType.HLL_4) { final int auxBytes = 4 << LG_AUX_ARR_INTS[lgConfigK]; arrBytes = AbstractHllArray.hll4ArrBytes(lgConfigK) + auxBytes; } ...
[ "public", "static", "final", "int", "getMaxUpdatableSerializationBytes", "(", "final", "int", "lgConfigK", ",", "final", "TgtHllType", "tgtHllType", ")", "{", "final", "int", "arrBytes", ";", "if", "(", "tgtHllType", "==", "TgtHllType", ".", "HLL_4", ")", "{", ...
Returns the maximum size in bytes that this sketch can grow to given lgConfigK. However, for the HLL_4 sketch type, this value can be exceeded in extremely rare cases. If exceeded, it will be larger by only a few percent. @param lgConfigK The Log2 of K for the target HLL sketch. This value must be between 4 and 21 inc...
[ "Returns", "the", "maximum", "size", "in", "bytes", "that", "this", "sketch", "can", "grow", "to", "given", "lgConfigK", ".", "However", "for", "the", "HLL_4", "sketch", "type", "this", "value", "can", "be", "exceeded", "in", "extremely", "rare", "cases", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllSketch.java#L283-L297
54,989
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesByteArrayImpl.java
DoublesByteArrayImpl.convertToByteArray
private static byte[] convertToByteArray(final DoublesSketch sketch, final int flags, final boolean ordered, final boolean compact) { final int preLongs = 2; final int extra = 2; // extra space for min and max values final int prePlusExtraBytes = (preLongs + extra)...
java
private static byte[] convertToByteArray(final DoublesSketch sketch, final int flags, final boolean ordered, final boolean compact) { final int preLongs = 2; final int extra = 2; // extra space for min and max values final int prePlusExtraBytes = (preLongs + extra)...
[ "private", "static", "byte", "[", "]", "convertToByteArray", "(", "final", "DoublesSketch", "sketch", ",", "final", "int", "flags", ",", "final", "boolean", "ordered", ",", "final", "boolean", "compact", ")", "{", "final", "int", "preLongs", "=", "2", ";", ...
Returns a byte array, including preamble, min, max and data extracted from the sketch. @param sketch the given DoublesSketch @param flags the Flags field @param ordered true if the desired form of the resulting array has the base buffer sorted. @param compact true if the desired form of the resulting array is in compac...
[ "Returns", "a", "byte", "array", "including", "preamble", "min", "max", "and", "data", "extracted", "from", "the", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesByteArrayImpl.java#L64-L114
54,990
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ItemsSketch.java
ItemsSketch.update
public void update(final T item, final long count) { if ((item == null) || (count == 0)) { return; } if (count < 0) { throw new SketchesArgumentException("Count may not be negative"); } this.streamWeight += count; hashMap.adjustOrPutValue(item, count); if (getNumActiveItems() > ...
java
public void update(final T item, final long count) { if ((item == null) || (count == 0)) { return; } if (count < 0) { throw new SketchesArgumentException("Count may not be negative"); } this.streamWeight += count; hashMap.adjustOrPutValue(item, count); if (getNumActiveItems() > ...
[ "public", "void", "update", "(", "final", "T", "item", ",", "final", "long", "count", ")", "{", "if", "(", "(", "item", "==", "null", ")", "||", "(", "count", "==", "0", ")", ")", "{", "return", ";", "}", "if", "(", "count", "<", "0", ")", "{...
Update this sketch with a item and a positive frequency count. @param item for which the frequency should be increased. The item can be any long value and is only used by the sketch to determine uniqueness. @param count the amount by which the frequency of the item should be increased. An count of zero is a no-op, and ...
[ "Update", "this", "sketch", "with", "a", "item", "and", "a", "positive", "frequency", "count", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ItemsSketch.java#L562-L583
54,991
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ReversePurgeItemHashMap.java
ReversePurgeItemHashMap.adjustOrPutValue
void adjustOrPutValue(final T key, final long adjustAmount) { final int arrayMask = keys.length - 1; int probe = (int) hash(key.hashCode()) & arrayMask; int drift = 1; while (states[probe] != 0 && !keys[probe].equals(key)) { probe = (probe + 1) & arrayMask; drift++; //only used for the...
java
void adjustOrPutValue(final T key, final long adjustAmount) { final int arrayMask = keys.length - 1; int probe = (int) hash(key.hashCode()) & arrayMask; int drift = 1; while (states[probe] != 0 && !keys[probe].equals(key)) { probe = (probe + 1) & arrayMask; drift++; //only used for the...
[ "void", "adjustOrPutValue", "(", "final", "T", "key", ",", "final", "long", "adjustAmount", ")", "{", "final", "int", "arrayMask", "=", "keys", ".", "length", "-", "1", ";", "int", "probe", "=", "(", "int", ")", "hash", "(", "key", ".", "hashCode", "...
Increments the value mapped to the key if the key is present in the map. Otherwise, the key is inserted with the putAmount. @param key the key of the value to increment @param adjustAmount the amount by which to increment the value
[ "Increments", "the", "value", "mapped", "to", "the", "key", "if", "the", "key", "is", "present", "in", "the", "map", ".", "Otherwise", "the", "key", "is", "inserted", "with", "the", "putAmount", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ReversePurgeItemHashMap.java#L86-L110
54,992
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ReversePurgeItemHashMap.java
ReversePurgeItemHashMap.resize
@SuppressWarnings("unchecked") void resize(final int newSize) { final Object[] oldKeys = keys; final long[] oldValues = values; final short[] oldStates = states; keys = new Object[newSize]; values = new long[newSize]; states = new short[newSize]; loadThreshold = (int) (newSize * LOAD_FACTO...
java
@SuppressWarnings("unchecked") void resize(final int newSize) { final Object[] oldKeys = keys; final long[] oldValues = values; final short[] oldStates = states; keys = new Object[newSize]; values = new long[newSize]; states = new short[newSize]; loadThreshold = (int) (newSize * LOAD_FACTO...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "resize", "(", "final", "int", "newSize", ")", "{", "final", "Object", "[", "]", "oldKeys", "=", "keys", ";", "final", "long", "[", "]", "oldValues", "=", "values", ";", "final", "short", "[", ...
assume newSize is power of 2
[ "assume", "newSize", "is", "power", "of", "2" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ReversePurgeItemHashMap.java#L189-L205
54,993
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ReversePurgeItemHashMap.java
ReversePurgeItemHashMap.purge
long purge(final int sampleSize) { final int limit = Math.min(sampleSize, getNumActive()); int numSamples = 0; int i = 0; final long[] samples = new long[limit]; while (numSamples < limit) { if (isActive(i)) { samples[numSamples] = values[i]; numSamples++; } i++; ...
java
long purge(final int sampleSize) { final int limit = Math.min(sampleSize, getNumActive()); int numSamples = 0; int i = 0; final long[] samples = new long[limit]; while (numSamples < limit) { if (isActive(i)) { samples[numSamples] = values[i]; numSamples++; } i++; ...
[ "long", "purge", "(", "final", "int", "sampleSize", ")", "{", "final", "int", "limit", "=", "Math", ".", "min", "(", "sampleSize", ",", "getNumActive", "(", ")", ")", ";", "int", "numSamples", "=", "0", ";", "int", "i", "=", "0", ";", "final", "lon...
This function is called when a key is processed that is not currently assigned a counter, and all the counters are in use. This function estimates the median of the counters in the sketch via sampling, decrements all counts by this estimate, throws out all counters that are no longer positive, and increments offset acc...
[ "This", "function", "is", "called", "when", "a", "key", "is", "processed", "that", "is", "not", "currently", "assigned", "a", "counter", "and", "all", "the", "counters", "are", "in", "use", ".", "This", "function", "estimates", "the", "median", "of", "the"...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ReversePurgeItemHashMap.java#L267-L286
54,994
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImplR.java
DoublesUnionImplR.wrapInstance
static DoublesUnionImplR wrapInstance(final Memory mem) { final DirectUpdateDoublesSketchR sketch = DirectUpdateDoublesSketchR.wrapInstance(mem); final int k = sketch.getK(); final DoublesUnionImplR union = new DoublesUnionImplR(k); union.maxK_ = k; union.gadget_ = sketch; return union; }
java
static DoublesUnionImplR wrapInstance(final Memory mem) { final DirectUpdateDoublesSketchR sketch = DirectUpdateDoublesSketchR.wrapInstance(mem); final int k = sketch.getK(); final DoublesUnionImplR union = new DoublesUnionImplR(k); union.maxK_ = k; union.gadget_ = sketch; return union; }
[ "static", "DoublesUnionImplR", "wrapInstance", "(", "final", "Memory", "mem", ")", "{", "final", "DirectUpdateDoublesSketchR", "sketch", "=", "DirectUpdateDoublesSketchR", ".", "wrapInstance", "(", "mem", ")", ";", "final", "int", "k", "=", "sketch", ".", "getK", ...
Returns a read-only Union object that wraps off-heap data structure of the given memory image of a non-compact DoublesSketch. The data structures of the Union remain off-heap. @param mem A memory image of a non-compact DoublesSketch to be used as the data structure for the union and will be modified. @return a Union o...
[ "Returns", "a", "read", "-", "only", "Union", "object", "that", "wraps", "off", "-", "heap", "data", "structure", "of", "the", "given", "memory", "image", "of", "a", "non", "-", "compact", "DoublesSketch", ".", "The", "data", "structures", "of", "the", "...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImplR.java#L37-L44
54,995
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/DirectHllArray.java
DirectHllArray.updateMemory
final void updateMemory(final WritableMemory newWmem) { wmem = newWmem; mem = newWmem; memObj = wmem.getArray(); memAdd = wmem.getCumulativeOffset(0L); }
java
final void updateMemory(final WritableMemory newWmem) { wmem = newWmem; mem = newWmem; memObj = wmem.getArray(); memAdd = wmem.getCumulativeOffset(0L); }
[ "final", "void", "updateMemory", "(", "final", "WritableMemory", "newWmem", ")", "{", "wmem", "=", "newWmem", ";", "mem", "=", "newWmem", ";", "memObj", "=", "wmem", ".", "getArray", "(", ")", ";", "memAdd", "=", "wmem", ".", "getCumulativeOffset", "(", ...
only called by DirectAuxHashMap
[ "only", "called", "by", "DirectAuxHashMap" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/DirectHllArray.java#L67-L72
54,996
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesUtil.java
DoublesUtil.copyToHeap
static HeapUpdateDoublesSketch copyToHeap(final DoublesSketch sketch) { final HeapUpdateDoublesSketch qsCopy; qsCopy = HeapUpdateDoublesSketch.newInstance(sketch.getK()); qsCopy.putN(sketch.getN()); qsCopy.putMinValue(sketch.getMinValue()); qsCopy.putMaxValue(sketch.getMaxValue()); qsCopy.putBas...
java
static HeapUpdateDoublesSketch copyToHeap(final DoublesSketch sketch) { final HeapUpdateDoublesSketch qsCopy; qsCopy = HeapUpdateDoublesSketch.newInstance(sketch.getK()); qsCopy.putN(sketch.getN()); qsCopy.putMinValue(sketch.getMinValue()); qsCopy.putMaxValue(sketch.getMaxValue()); qsCopy.putBas...
[ "static", "HeapUpdateDoublesSketch", "copyToHeap", "(", "final", "DoublesSketch", "sketch", ")", "{", "final", "HeapUpdateDoublesSketch", "qsCopy", ";", "qsCopy", "=", "HeapUpdateDoublesSketch", ".", "newInstance", "(", "sketch", ".", "getK", "(", ")", ")", ";", "...
Returns an on-heap copy of the given sketch @param sketch the given sketch @return a copy of the given sketch
[ "Returns", "an", "on", "-", "heap", "copy", "of", "the", "given", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUtil.java#L33-L66
54,997
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesUtil.java
DoublesUtil.checkDoublesSerVer
static void checkDoublesSerVer(final int serVer, final int minSupportedSerVer) { final int max = DoublesSketch.DOUBLES_SER_VER; if ((serVer > max) || (serVer < minSupportedSerVer)) { throw new SketchesArgumentException( "Possible corruption: Unsupported Serialization Version: " + serVer); } ...
java
static void checkDoublesSerVer(final int serVer, final int minSupportedSerVer) { final int max = DoublesSketch.DOUBLES_SER_VER; if ((serVer > max) || (serVer < minSupportedSerVer)) { throw new SketchesArgumentException( "Possible corruption: Unsupported Serialization Version: " + serVer); } ...
[ "static", "void", "checkDoublesSerVer", "(", "final", "int", "serVer", ",", "final", "int", "minSupportedSerVer", ")", "{", "final", "int", "max", "=", "DoublesSketch", ".", "DOUBLES_SER_VER", ";", "if", "(", "(", "serVer", ">", "max", ")", "||", "(", "ser...
Check the validity of the given serialization version @param serVer the given serialization version @param minSupportedSerVer the oldest serialization version supported
[ "Check", "the", "validity", "of", "the", "given", "serialization", "version" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUtil.java#L73-L79
54,998
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DirectCompactDoublesSketch.java
DirectCompactDoublesSketch.wrapInstance
static DirectCompactDoublesSketch wrapInstance(final Memory srcMem) { final long memCap = srcMem.getCapacity(); final int preLongs = extractPreLongs(srcMem); final int serVer = extractSerVer(srcMem); final int familyID = extractFamilyID(srcMem); final int flags = extractFlags(srcMem); final int...
java
static DirectCompactDoublesSketch wrapInstance(final Memory srcMem) { final long memCap = srcMem.getCapacity(); final int preLongs = extractPreLongs(srcMem); final int serVer = extractSerVer(srcMem); final int familyID = extractFamilyID(srcMem); final int flags = extractFlags(srcMem); final int...
[ "static", "DirectCompactDoublesSketch", "wrapInstance", "(", "final", "Memory", "srcMem", ")", "{", "final", "long", "memCap", "=", "srcMem", ".", "getCapacity", "(", ")", ";", "final", "int", "preLongs", "=", "extractPreLongs", "(", "srcMem", ")", ";", "final...
Wrap this sketch around the given compact Memory image of a DoublesSketch. @param srcMem the given compact Memory image of a DoublesSketch that may have data, @return a sketch that wraps the given srcMem
[ "Wrap", "this", "sketch", "around", "the", "given", "compact", "Memory", "image", "of", "a", "DoublesSketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectCompactDoublesSketch.java#L123-L147
54,999
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DirectCompactDoublesSketch.java
DirectCompactDoublesSketch.checkCompact
static void checkCompact(final int serVer, final int flags) { final int compactFlagMask = COMPACT_FLAG_MASK | ORDERED_FLAG_MASK; if ((serVer != 2) && ((flags & EMPTY_FLAG_MASK) == 0) && ((flags & compactFlagMask) != compactFlagMask)) { throw new SketchesArgumentException( ...
java
static void checkCompact(final int serVer, final int flags) { final int compactFlagMask = COMPACT_FLAG_MASK | ORDERED_FLAG_MASK; if ((serVer != 2) && ((flags & EMPTY_FLAG_MASK) == 0) && ((flags & compactFlagMask) != compactFlagMask)) { throw new SketchesArgumentException( ...
[ "static", "void", "checkCompact", "(", "final", "int", "serVer", ",", "final", "int", "flags", ")", "{", "final", "int", "compactFlagMask", "=", "COMPACT_FLAG_MASK", "|", "ORDERED_FLAG_MASK", ";", "if", "(", "(", "serVer", "!=", "2", ")", "&&", "(", "(", ...
Checks a sketch's serial version and flags to see if the sketch can be wrapped as a DirectCompactDoubleSketch. Throws an exception if the sketch is neither empty nor compact and ordered, unles the sketch uses serialization version 2. @param serVer the serialization version @param flags Flags from the sketch to evaluate
[ "Checks", "a", "sketch", "s", "serial", "version", "and", "flags", "to", "see", "if", "the", "sketch", "can", "be", "wrapped", "as", "a", "DirectCompactDoubleSketch", ".", "Throws", "an", "exception", "if", "the", "sketch", "is", "neither", "empty", "nor", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectCompactDoublesSketch.java#L234-L243