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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/SingleItemSketch.java | SingleItemSketch.create | public static SingleItemSketch create(final long datum, final long seed) {
final long[] data = { datum };
return new SingleItemSketch(hash(data, seed)[0] >>> 1);
} | java | public static SingleItemSketch create(final long datum, final long seed) {
final long[] data = { datum };
return new SingleItemSketch(hash(data, seed)[0] >>> 1);
} | [
"public",
"static",
"SingleItemSketch",
"create",
"(",
"final",
"long",
"datum",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"long",
"[",
"]",
"data",
"=",
"{",
"datum",
"}",
";",
"return",
"new",
"SingleItemSketch",
"(",
"hash",
"(",
"data",
",",
... | Create this sketch with a long and a seed.
@param datum The given long datum.
@param seed used to hash the given value.
@return a SingleItemSketch | [
"Create",
"this",
"sketch",
"with",
"a",
"long",
"and",
"a",
"seed",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/SingleItemSketch.java#L184-L187 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/SingleItemSketch.java | SingleItemSketch.create | public static SingleItemSketch create(final String datum, final long seed) {
if ((datum == null) || datum.isEmpty()) { return null; }
final byte[] data = datum.getBytes(UTF_8);
return new SingleItemSketch(hash(data, seed)[0] >>> 1, seed);
} | java | public static SingleItemSketch create(final String datum, final long seed) {
if ((datum == null) || datum.isEmpty()) { return null; }
final byte[] data = datum.getBytes(UTF_8);
return new SingleItemSketch(hash(data, seed)[0] >>> 1, seed);
} | [
"public",
"static",
"SingleItemSketch",
"create",
"(",
"final",
"String",
"datum",
",",
"final",
"long",
"seed",
")",
"{",
"if",
"(",
"(",
"datum",
"==",
"null",
")",
"||",
"datum",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"fin... | Create this sketch with the given String and a seed.
The string is converted to a byte array using UTF8 encoding.
If the string is null or empty no create attempt is made and the method returns null.
<p>Note: this will not produce the same output hash values as the {@link #create(char[])}
method and will generally be ... | [
"Create",
"this",
"sketch",
"with",
"the",
"given",
"String",
"and",
"a",
"seed",
".",
"The",
"string",
"is",
"converted",
"to",
"a",
"byte",
"array",
"using",
"UTF8",
"encoding",
".",
"If",
"the",
"string",
"is",
"null",
"or",
"empty",
"no",
"create",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/SingleItemSketch.java#L219-L223 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/SingleItemSketch.java | SingleItemSketch.create | public static SingleItemSketch create(final byte[] data, final long seed) {
if ((data == null) || (data.length == 0)) { return null; }
return new SingleItemSketch(hash(data, seed)[0] >>> 1, seed);
} | java | public static SingleItemSketch create(final byte[] data, final long seed) {
if ((data == null) || (data.length == 0)) { return null; }
return new SingleItemSketch(hash(data, seed)[0] >>> 1, seed);
} | [
"public",
"static",
"SingleItemSketch",
"create",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"long",
"seed",
")",
"{",
"if",
"(",
"(",
"data",
"==",
"null",
")",
"||",
"(",
"data",
".",
"length",
"==",
"0",
")",
")",
"{",
"return",
"null... | Create this sketch with the given byte array and a seed.
If the byte array is null or empty no create attempt is made and the method returns null.
@param data The given byte array.
@param seed used to hash the given value.
@return a SingleItemSketch or null | [
"Create",
"this",
"sketch",
"with",
"the",
"given",
"byte",
"array",
"and",
"a",
"seed",
".",
"If",
"the",
"byte",
"array",
"is",
"null",
"or",
"empty",
"no",
"create",
"attempt",
"is",
"made",
"and",
"the",
"method",
"returns",
"null",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/SingleItemSketch.java#L233-L236 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java | QuickSelectSketch.reset | public void reset() {
isEmpty_ = true;
count_ = 0;
theta_ = (long) (Long.MAX_VALUE * (double) samplingProbability_);
final int startingCapacity = Util.getStartingCapacity(nomEntries_, lgResizeFactor_);
lgCurrentCapacity_ = Integer.numberOfTrailingZeros(startingCapacity);
keys_ = new long[startin... | java | public void reset() {
isEmpty_ = true;
count_ = 0;
theta_ = (long) (Long.MAX_VALUE * (double) samplingProbability_);
final int startingCapacity = Util.getStartingCapacity(nomEntries_, lgResizeFactor_);
lgCurrentCapacity_ = Integer.numberOfTrailingZeros(startingCapacity);
keys_ = new long[startin... | [
"public",
"void",
"reset",
"(",
")",
"{",
"isEmpty_",
"=",
"true",
";",
"count_",
"=",
"0",
";",
"theta_",
"=",
"(",
"long",
")",
"(",
"Long",
".",
"MAX_VALUE",
"*",
"(",
"double",
")",
"samplingProbability_",
")",
";",
"final",
"int",
"startingCapacit... | Resets this sketch an empty state. | [
"Resets",
"this",
"sketch",
"an",
"empty",
"state",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java#L239-L248 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java | QuickSelectSketch.compact | @SuppressWarnings("unchecked")
public CompactSketch<S> compact() {
if (getRetainedEntries() == 0) {
return new CompactSketch<>(null, null, theta_, isEmpty_);
}
final long[] keys = new long[getRetainedEntries()];
final S[] summaries = (S[])
Array.newInstance(summaries_.getClass().getCompone... | java | @SuppressWarnings("unchecked")
public CompactSketch<S> compact() {
if (getRetainedEntries() == 0) {
return new CompactSketch<>(null, null, theta_, isEmpty_);
}
final long[] keys = new long[getRetainedEntries()];
final S[] summaries = (S[])
Array.newInstance(summaries_.getClass().getCompone... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"CompactSketch",
"<",
"S",
">",
"compact",
"(",
")",
"{",
"if",
"(",
"getRetainedEntries",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"CompactSketch",
"<>",
"(",
"null",
",",
"null",
",",... | Converts the current state of the sketch into a compact sketch
@return compact sketch | [
"Converts",
"the",
"current",
"state",
"of",
"the",
"sketch",
"into",
"a",
"compact",
"sketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java#L254-L271 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java | VarOptItemsUnion.getResult | public VarOptItemsSketch<T> getResult() {
// If no marked items in H, gadget is already valid mathematically. We can return what is
// basically just a copy of the gadget.
if (gadget_.getNumMarksInH() == 0) {
return simpleGadgetCoercer();
} else {
// At this point, we know that marked items ... | java | public VarOptItemsSketch<T> getResult() {
// If no marked items in H, gadget is already valid mathematically. We can return what is
// basically just a copy of the gadget.
if (gadget_.getNumMarksInH() == 0) {
return simpleGadgetCoercer();
} else {
// At this point, we know that marked items ... | [
"public",
"VarOptItemsSketch",
"<",
"T",
">",
"getResult",
"(",
")",
"{",
"// If no marked items in H, gadget is already valid mathematically. We can return what is",
"// basically just a copy of the gadget.",
"if",
"(",
"gadget_",
".",
"getNumMarksInH",
"(",
")",
"==",
"0",
... | Gets the varopt sketch resulting from the union of any input sketches.
@return A varopt sketch | [
"Gets",
"the",
"varopt",
"sketch",
"resulting",
"from",
"the",
"union",
"of",
"any",
"input",
"sketches",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java#L229-L247 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java | VarOptItemsUnion.markMovingGadgetCoercer | private VarOptItemsSketch<T> markMovingGadgetCoercer() {
final int resultK = gadget_.getHRegionCount() + gadget_.getRRegionCount();
int resultH = 0;
int resultR = 0;
int nextRPos = resultK; // = (resultK+1)-1, to fill R region from back to front
final ArrayList<T> data = new ArrayList<>(re... | java | private VarOptItemsSketch<T> markMovingGadgetCoercer() {
final int resultK = gadget_.getHRegionCount() + gadget_.getRRegionCount();
int resultH = 0;
int resultR = 0;
int nextRPos = resultK; // = (resultK+1)-1, to fill R region from back to front
final ArrayList<T> data = new ArrayList<>(re... | [
"private",
"VarOptItemsSketch",
"<",
"T",
">",
"markMovingGadgetCoercer",
"(",
")",
"{",
"final",
"int",
"resultK",
"=",
"gadget_",
".",
"getHRegionCount",
"(",
")",
"+",
"gadget_",
".",
"getRRegionCount",
"(",
")",
";",
"int",
"resultH",
"=",
"0",
";",
"i... | This coercer directly transfers marked items from the gadget's H into the result's R.
Deciding whether that is a valid thing to do is the responsibility of the caller. Currently,
this is only used for a subcase of pseudo-exact, but later it might be used by other
subcases as well.
@return A sketch derived from the gad... | [
"This",
"coercer",
"directly",
"transfers",
"marked",
"items",
"from",
"the",
"gadget",
"s",
"H",
"into",
"the",
"result",
"s",
"R",
".",
"Deciding",
"whether",
"that",
"is",
"a",
"valid",
"thing",
"to",
"do",
"is",
"the",
"responsibility",
"of",
"the",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java#L476-L538 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/CompactSketch.java | CompactSketch.compactCache | static final long[] compactCache(final long[] srcCache, final int curCount,
final long thetaLong, final boolean dstOrdered) {
if (curCount == 0) {
return new long[0];
}
final long[] cacheOut = new long[curCount];
final int len = srcCache.length;
int j = 0;
for (int i = 0; i < len; i+... | java | static final long[] compactCache(final long[] srcCache, final int curCount,
final long thetaLong, final boolean dstOrdered) {
if (curCount == 0) {
return new long[0];
}
final long[] cacheOut = new long[curCount];
final int len = srcCache.length;
int j = 0;
for (int i = 0; i < len; i+... | [
"static",
"final",
"long",
"[",
"]",
"compactCache",
"(",
"final",
"long",
"[",
"]",
"srcCache",
",",
"final",
"int",
"curCount",
",",
"final",
"long",
"thetaLong",
",",
"final",
"boolean",
"dstOrdered",
")",
"{",
"if",
"(",
"curCount",
"==",
"0",
")",
... | Compact the given array. The source cache can be a hash table with interstitial zeros or
"dirty" values.
@param srcCache anything
@param curCount must be correct
@param thetaLong The correct
<a href="{@docRoot}/resources/dictionary.html#thetaLong">thetaLong</a>.
@param dstOrdered true if output array must be sorted
@re... | [
"Compact",
"the",
"given",
"array",
".",
"The",
"source",
"cache",
"can",
"be",
"a",
"hash",
"table",
"with",
"interstitial",
"zeros",
"or",
"dirty",
"values",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/CompactSketch.java#L72-L90 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/CompactSketch.java | CompactSketch.compactCachePart | static final long[] compactCachePart(final long[] srcCache, final int lgArrLongs,
final int curCount, final long thetaLong, final boolean dstOrdered) {
if (curCount == 0) {
return new long[0];
}
final long[] cacheOut = new long[curCount];
final int len = 1 << lgArrLongs;
int j = 0;
f... | java | static final long[] compactCachePart(final long[] srcCache, final int lgArrLongs,
final int curCount, final long thetaLong, final boolean dstOrdered) {
if (curCount == 0) {
return new long[0];
}
final long[] cacheOut = new long[curCount];
final int len = 1 << lgArrLongs;
int j = 0;
f... | [
"static",
"final",
"long",
"[",
"]",
"compactCachePart",
"(",
"final",
"long",
"[",
"]",
"srcCache",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"int",
"curCount",
",",
"final",
"long",
"thetaLong",
",",
"final",
"boolean",
"dstOrdered",
")",
"{",
"if... | Compact first 2^lgArrLongs of given array
@param srcCache anything
@param lgArrLongs The correct
<a href="{@docRoot}/resources/dictionary.html#lgArrLongs">lgArrLongs</a>.
@param curCount must be correct
@param thetaLong The correct
<a href="{@docRoot}/resources/dictionary.html#thetaLong">thetaLong</a>.
@param dstOrdere... | [
"Compact",
"first",
"2^lgArrLongs",
"of",
"given",
"array"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/CompactSketch.java#L103-L121 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/CompactSketch.java | CompactSketch.loadCompactMemory | static final Memory loadCompactMemory(final long[] compactCache, final short seedHash,
final int curCount, final long thetaLong, final WritableMemory dstMem,
final byte flags, final int preLongs) {
assert (dstMem != null) && (compactCache != null);
final int outLongs = preLongs + curCount;
fina... | java | static final Memory loadCompactMemory(final long[] compactCache, final short seedHash,
final int curCount, final long thetaLong, final WritableMemory dstMem,
final byte flags, final int preLongs) {
assert (dstMem != null) && (compactCache != null);
final int outLongs = preLongs + curCount;
fina... | [
"static",
"final",
"Memory",
"loadCompactMemory",
"(",
"final",
"long",
"[",
"]",
"compactCache",
",",
"final",
"short",
"seedHash",
",",
"final",
"int",
"curCount",
",",
"final",
"long",
"thetaLong",
",",
"final",
"WritableMemory",
"dstMem",
",",
"final",
"by... | compactCache and dstMem must be valid | [
"compactCache",
"and",
"dstMem",
"must",
"be",
"valid"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/CompactSketch.java#L124-L160 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java | LongsSketch.getInstance | public static LongsSketch getInstance(final String string) {
final String[] tokens = string.split(",");
if (tokens.length < (STR_PREAMBLE_TOKENS + 2)) {
throw new SketchesArgumentException(
"String not long enough: " + tokens.length);
}
final int serVer = Integer.parseInt(tokens[0]);
... | java | public static LongsSketch getInstance(final String string) {
final String[] tokens = string.split(",");
if (tokens.length < (STR_PREAMBLE_TOKENS + 2)) {
throw new SketchesArgumentException(
"String not long enough: " + tokens.length);
}
final int serVer = Integer.parseInt(tokens[0]);
... | [
"public",
"static",
"LongsSketch",
"getInstance",
"(",
"final",
"String",
"string",
")",
"{",
"final",
"String",
"[",
"]",
"tokens",
"=",
"string",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"tokens",
".",
"length",
"<",
"(",
"STR_PREAMBLE_TOKENS",
... | Returns a sketch instance of this class from the given String,
which must be a String representation of this sketch class.
@param string a String representation of a sketch of this class.
@return a sketch instance of this class. | [
"Returns",
"a",
"sketch",
"instance",
"of",
"this",
"class",
"from",
"the",
"given",
"String",
"which",
"must",
"be",
"a",
"String",
"representation",
"of",
"this",
"sketch",
"class",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java#L275-L313 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java | LongsSketch.serializeToString | public String serializeToString() {
final StringBuilder sb = new StringBuilder();
//start the string with parameters of the sketch
final int serVer = SER_VER; //0
final int famID = Family.FREQUENCY.getID(); //1
final int lgMaxMapSz = lgMaxMapSize; //2
final int flags = (ha... | java | public String serializeToString() {
final StringBuilder sb = new StringBuilder();
//start the string with parameters of the sketch
final int serVer = SER_VER; //0
final int famID = Family.FREQUENCY.getID(); //1
final int lgMaxMapSz = lgMaxMapSize; //2
final int flags = (ha... | [
"public",
"String",
"serializeToString",
"(",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"//start the string with parameters of the sketch",
"final",
"int",
"serVer",
"=",
"SER_VER",
";",
"//0",
"final",
"int",
"famID",
"... | Returns a String representation of this sketch
@return a String representation of this sketch | [
"Returns",
"a",
"String",
"representation",
"of",
"this",
"sketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java#L522-L537 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java | LongsSketch.deserializeFromStringArray | static ReversePurgeLongHashMap deserializeFromStringArray(final String[] tokens) {
final int ignore = STR_PREAMBLE_TOKENS;
final int numActive = Integer.parseInt(tokens[ignore]);
final int length = Integer.parseInt(tokens[ignore + 1]);
final ReversePurgeLongHashMap hashMap = new ReversePurgeLongHashMap(... | java | static ReversePurgeLongHashMap deserializeFromStringArray(final String[] tokens) {
final int ignore = STR_PREAMBLE_TOKENS;
final int numActive = Integer.parseInt(tokens[ignore]);
final int length = Integer.parseInt(tokens[ignore + 1]);
final ReversePurgeLongHashMap hashMap = new ReversePurgeLongHashMap(... | [
"static",
"ReversePurgeLongHashMap",
"deserializeFromStringArray",
"(",
"final",
"String",
"[",
"]",
"tokens",
")",
"{",
"final",
"int",
"ignore",
"=",
"STR_PREAMBLE_TOKENS",
";",
"final",
"int",
"numActive",
"=",
"Integer",
".",
"parseInt",
"(",
"tokens",
"[",
... | Deserializes an array of String tokens into a hash map object of this class.
@param tokens the given array of Strings tokens.
@return a hash map object of this class | [
"Deserializes",
"an",
"array",
"of",
"String",
"tokens",
"into",
"a",
"hash",
"map",
"object",
"of",
"this",
"class",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java#L793-L805 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/HllMap.java | HllMap.findKey | @Override
final int findKey(final byte[] key) {
final int keyLen = key.length;
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries_);
final int stride = getStride(hash[1], tableEntries_);
final int loopIndex = entryIndex;
do {
if (isBitClear... | java | @Override
final int findKey(final byte[] key) {
final int keyLen = key.length;
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries_);
final int stride = getStride(hash[1], tableEntries_);
final int loopIndex = entryIndex;
do {
if (isBitClear... | [
"@",
"Override",
"final",
"int",
"findKey",
"(",
"final",
"byte",
"[",
"]",
"key",
")",
"{",
"final",
"int",
"keyLen",
"=",
"key",
".",
"length",
";",
"final",
"long",
"[",
"]",
"hash",
"=",
"MurmurHash3",
".",
"hash",
"(",
"key",
",",
"SEED",
")",... | Returns the entry index for the given key given the array of keys, if found.
Otherwise, returns the one's complement of first empty entry found;
@param key the key to search for
@return the entry index of the given key, or the one's complement of the index if not found. | [
"Returns",
"the",
"entry",
"index",
"for",
"the",
"given",
"key",
"given",
"the",
"array",
"of",
"keys",
"if",
"found",
".",
"Otherwise",
"returns",
"the",
"one",
"s",
"complement",
"of",
"first",
"empty",
"entry",
"found",
";"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/HllMap.java#L127-L145 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/HllMap.java | HllMap.findEmpty | private static final int findEmpty(final byte[] key, final int tableEntries, final byte[] stateArr) {
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries);
final int stride = getStride(hash[1], tableEntries);
final int loopIndex = entryIndex;
do {
... | java | private static final int findEmpty(final byte[] key, final int tableEntries, final byte[] stateArr) {
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries);
final int stride = getStride(hash[1], tableEntries);
final int loopIndex = entryIndex;
do {
... | [
"private",
"static",
"final",
"int",
"findEmpty",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"int",
"tableEntries",
",",
"final",
"byte",
"[",
"]",
"stateArr",
")",
"{",
"final",
"long",
"[",
"]",
"hash",
"=",
"MurmurHash3",
".",
"hash",
"(",... | Find the first empty slot for the given key.
Only used by resize, where it is known that the key does not exist in the table.
Throws an exception if no empty slots.
@param key the given key
@param tableEntries prime size of table
@param stateArr the valid bit array
@return the first empty slot for the given key | [
"Find",
"the",
"first",
"empty",
"slot",
"for",
"the",
"given",
"key",
".",
"Only",
"used",
"by",
"resize",
"where",
"it",
"is",
"known",
"that",
"the",
"key",
"does",
"not",
"exist",
"in",
"the",
"table",
".",
"Throws",
"an",
"exception",
"if",
"no",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/HllMap.java#L236-L249 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/HllMap.java | HllMap.updateHll | private final boolean updateHll(final int entryIndex, final int coupon) {
final int newValue = coupon16Value(coupon);
final int hllIdx = coupon & (k_ - 1); //lower lgK bits
final int longIdx = hllIdx / 10;
final int shift = ((hllIdx % 10) * 6) & SIX_BIT_MASK;
long hllLong = arrOfHllArr_[(entryInde... | java | private final boolean updateHll(final int entryIndex, final int coupon) {
final int newValue = coupon16Value(coupon);
final int hllIdx = coupon & (k_ - 1); //lower lgK bits
final int longIdx = hllIdx / 10;
final int shift = ((hllIdx % 10) * 6) & SIX_BIT_MASK;
long hllLong = arrOfHllArr_[(entryInde... | [
"private",
"final",
"boolean",
"updateHll",
"(",
"final",
"int",
"entryIndex",
",",
"final",
"int",
"coupon",
")",
"{",
"final",
"int",
"newValue",
"=",
"coupon16Value",
"(",
"coupon",
")",
";",
"final",
"int",
"hllIdx",
"=",
"coupon",
"&",
"(",
"k_",
"-... | This method is specifically tied to the HLL array layout | [
"This",
"method",
"is",
"specifically",
"tied",
"to",
"the",
"HLL",
"array",
"layout"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/HllMap.java#L252-L280 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CompressionData.java | CompressionData.makeDecodingTable | private static short[] makeDecodingTable(final short[] encodingTable, final int numByteValues) {
final short[] decodingTable = new short[4096];
for (int byteValue = 0; byteValue < numByteValues; byteValue++) {
final int encodingEntry = encodingTable[byteValue] & 0xFFFF;
final int codeValue = encodi... | java | private static short[] makeDecodingTable(final short[] encodingTable, final int numByteValues) {
final short[] decodingTable = new short[4096];
for (int byteValue = 0; byteValue < numByteValues; byteValue++) {
final int encodingEntry = encodingTable[byteValue] & 0xFFFF;
final int codeValue = encodi... | [
"private",
"static",
"short",
"[",
"]",
"makeDecodingTable",
"(",
"final",
"short",
"[",
"]",
"encodingTable",
",",
"final",
"int",
"numByteValues",
")",
"{",
"final",
"short",
"[",
"]",
"decodingTable",
"=",
"new",
"short",
"[",
"4096",
"]",
";",
"for",
... | Given an encoding table that maps unsigned bytes to codewords
of length at most 12, this builds a size-4096 decoding table.
<p>The second argument is typically 256, but can be other values such as 65.
@param encodingTable unsigned
@param numByteValues size of encoding table
@return one segment of the decoding table | [
"Given",
"an",
"encoding",
"table",
"that",
"maps",
"unsigned",
"bytes",
"to",
"codewords",
"of",
"length",
"at",
"most",
"12",
"this",
"builds",
"a",
"size",
"-",
"4096",
"decoding",
"table",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CompressionData.java#L50-L67 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CompressionData.java | CompressionData.validateDecodingTable | static void validateDecodingTable(final short[] decodingTable, final short[] encodingTable) {
for (int decodeThis = 0; decodeThis < 4096; decodeThis++) {
final int tmpD = decodingTable[decodeThis] & 0xFFFF;
final int decodedByte = tmpD & 0xff;
final int decodedLength = tmpD >> 8;
final in... | java | static void validateDecodingTable(final short[] decodingTable, final short[] encodingTable) {
for (int decodeThis = 0; decodeThis < 4096; decodeThis++) {
final int tmpD = decodingTable[decodeThis] & 0xFFFF;
final int decodedByte = tmpD & 0xff;
final int decodedLength = tmpD >> 8;
final in... | [
"static",
"void",
"validateDecodingTable",
"(",
"final",
"short",
"[",
"]",
"decodingTable",
",",
"final",
"short",
"[",
"]",
"encodingTable",
")",
"{",
"for",
"(",
"int",
"decodeThis",
"=",
"0",
";",
"decodeThis",
"<",
"4096",
";",
"decodeThis",
"++",
")"... | These short arrays are being treated as unsigned
@param decodingTable unsigned
@param encodingTable unsigned | [
"These",
"short",
"arrays",
"are",
"being",
"treated",
"as",
"unsigned"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CompressionData.java#L74-L91 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java | DoublesUnionImpl.directInstance | static DoublesUnionImpl directInstance(final int maxK, final WritableMemory dstMem) {
final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.newInstance(maxK, dstMem);
final DoublesUnionImpl union = new DoublesUnionImpl(maxK);
union.maxK_ = maxK;
union.gadget_ = sketch;
return union;
} | java | static DoublesUnionImpl directInstance(final int maxK, final WritableMemory dstMem) {
final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.newInstance(maxK, dstMem);
final DoublesUnionImpl union = new DoublesUnionImpl(maxK);
union.maxK_ = maxK;
union.gadget_ = sketch;
return union;
} | [
"static",
"DoublesUnionImpl",
"directInstance",
"(",
"final",
"int",
"maxK",
",",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"final",
"DirectUpdateDoublesSketch",
"sketch",
"=",
"DirectUpdateDoublesSketch",
".",
"newInstance",
"(",
"maxK",
",",
"dstMem",
")",
";... | Returns a empty DoublesUnion object that refers to the given direct, off-heap Memory,
which will be initialized to the empty state.
@param maxK determines the accuracy and size of the union and is a maximum value.
The effective <i>k</i> can be smaller due to unions with smaller <i>k</i> sketches.
It is recommended tha... | [
"Returns",
"a",
"empty",
"DoublesUnion",
"object",
"that",
"refers",
"to",
"the",
"given",
"direct",
"off",
"-",
"heap",
"Memory",
"which",
"will",
"be",
"initialized",
"to",
"the",
"empty",
"state",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java#L48-L54 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java | DoublesUnionImpl.heapifyInstance | static DoublesUnionImpl heapifyInstance(final DoublesSketch sketch) {
final int k = sketch.getK();
final DoublesUnionImpl union = new DoublesUnionImpl(k);
union.maxK_ = k;
union.gadget_ = copyToHeap(sketch);
return union;
} | java | static DoublesUnionImpl heapifyInstance(final DoublesSketch sketch) {
final int k = sketch.getK();
final DoublesUnionImpl union = new DoublesUnionImpl(k);
union.maxK_ = k;
union.gadget_ = copyToHeap(sketch);
return union;
} | [
"static",
"DoublesUnionImpl",
"heapifyInstance",
"(",
"final",
"DoublesSketch",
"sketch",
")",
"{",
"final",
"int",
"k",
"=",
"sketch",
".",
"getK",
"(",
")",
";",
"final",
"DoublesUnionImpl",
"union",
"=",
"new",
"DoublesUnionImpl",
"(",
"k",
")",
";",
"uni... | Returns a Heap DoublesUnion object that has been initialized with the data from the given
sketch.
@param sketch A DoublesSketch to be used as a source of data only and will not be modified.
@return a DoublesUnion object | [
"Returns",
"a",
"Heap",
"DoublesUnion",
"object",
"that",
"has",
"been",
"initialized",
"with",
"the",
"data",
"from",
"the",
"given",
"sketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java#L63-L69 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java | DoublesUnionImpl.wrapInstance | static DoublesUnionImpl wrapInstance(final WritableMemory mem) {
final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.wrapInstance(mem);
final DoublesUnionImpl union = new DoublesUnionImpl(sketch.getK());
union.gadget_ = sketch;
return union;
} | java | static DoublesUnionImpl wrapInstance(final WritableMemory mem) {
final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.wrapInstance(mem);
final DoublesUnionImpl union = new DoublesUnionImpl(sketch.getK());
union.gadget_ = sketch;
return union;
} | [
"static",
"DoublesUnionImpl",
"wrapInstance",
"(",
"final",
"WritableMemory",
"mem",
")",
"{",
"final",
"DirectUpdateDoublesSketch",
"sketch",
"=",
"DirectUpdateDoublesSketch",
".",
"wrapInstance",
"(",
"mem",
")",
";",
"final",
"DoublesUnionImpl",
"union",
"=",
"new"... | Returns an updatable 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 ... | [
"Returns",
"an",
"updatable",
"Union",
"object",
"that",
"wraps",
"off",
"-",
"heap",
"data",
"structure",
"of",
"the",
"given",
"memory",
"image",
"of",
"a",
"non",
"-",
"compact",
"DoublesSketch",
".",
"The",
"data",
"structures",
"of",
"the",
"Union",
"... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java#L95-L100 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/Sketch.java | Sketch.heapify | public static Sketch heapify(final Memory srcMem, final long seed) {
final int serVer = srcMem.getByte(SER_VER_BYTE);
if (serVer == 3) {
final byte famID = srcMem.getByte(FAMILY_BYTE);
final boolean ordered = (srcMem.getByte(FLAGS_BYTE) & ORDERED_FLAG_MASK) != 0;
return constructHeapSketch(fam... | java | public static Sketch heapify(final Memory srcMem, final long seed) {
final int serVer = srcMem.getByte(SER_VER_BYTE);
if (serVer == 3) {
final byte famID = srcMem.getByte(FAMILY_BYTE);
final boolean ordered = (srcMem.getByte(FLAGS_BYTE) & ORDERED_FLAG_MASK) != 0;
return constructHeapSketch(fam... | [
"public",
"static",
"Sketch",
"heapify",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"int",
"serVer",
"=",
"srcMem",
".",
"getByte",
"(",
"SER_VER_BYTE",
")",
";",
"if",
"(",
"serVer",
"==",
"3",
")",
"{",
"final"... | Heapify takes the sketch image in Memory and instantiates an on-heap
Sketch using the given seed.
The resulting sketch will not retain any link to the source Memory.
@param srcMem an image of a Sketch where the image seed hash matches the given seed hash.
<a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a... | [
"Heapify",
"takes",
"the",
"sketch",
"image",
"in",
"Memory",
"and",
"instantiates",
"an",
"on",
"-",
"heap",
"Sketch",
"using",
"the",
"given",
"seed",
".",
"The",
"resulting",
"sketch",
"will",
"not",
"retain",
"any",
"link",
"to",
"the",
"source",
"Memo... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketch.java#L66-L80 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/Sketch.java | Sketch.isValidSketchID | static final boolean isValidSketchID(final int id) {
return (id == Family.ALPHA.getID())
|| (id == Family.QUICKSELECT.getID())
|| (id == Family.COMPACT.getID());
} | java | static final boolean isValidSketchID(final int id) {
return (id == Family.ALPHA.getID())
|| (id == Family.QUICKSELECT.getID())
|| (id == Family.COMPACT.getID());
} | [
"static",
"final",
"boolean",
"isValidSketchID",
"(",
"final",
"int",
"id",
")",
"{",
"return",
"(",
"id",
"==",
"Family",
".",
"ALPHA",
".",
"getID",
"(",
")",
")",
"||",
"(",
"id",
"==",
"Family",
".",
"QUICKSELECT",
".",
"getID",
"(",
")",
")",
... | Returns true if given Family id is one of the theta sketches
@param id the given Family id
@return true if given Family id is one of the theta sketches | [
"Returns",
"true",
"if",
"given",
"Family",
"id",
"is",
"one",
"of",
"the",
"theta",
"sketches"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketch.java#L536-L540 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/Sketch.java | Sketch.checkSketchAndMemoryFlags | static final void checkSketchAndMemoryFlags(final Sketch sketch) {
final Memory mem = sketch.getMemory();
if (mem == null) { return; }
final int flags = PreambleUtil.extractFlags(mem);
if (((flags & COMPACT_FLAG_MASK) > 0) ^ sketch.isCompact()) {
throw new SketchesArgumentException("Possible corru... | java | static final void checkSketchAndMemoryFlags(final Sketch sketch) {
final Memory mem = sketch.getMemory();
if (mem == null) { return; }
final int flags = PreambleUtil.extractFlags(mem);
if (((flags & COMPACT_FLAG_MASK) > 0) ^ sketch.isCompact()) {
throw new SketchesArgumentException("Possible corru... | [
"static",
"final",
"void",
"checkSketchAndMemoryFlags",
"(",
"final",
"Sketch",
"sketch",
")",
"{",
"final",
"Memory",
"mem",
"=",
"sketch",
".",
"getMemory",
"(",
")",
";",
"if",
"(",
"mem",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"int",
... | Checks Ordered and Compact flags for integrity between sketch and Memory
@param sketch the given sketch | [
"Checks",
"Ordered",
"and",
"Compact",
"flags",
"for",
"integrity",
"between",
"sketch",
"and",
"Memory"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketch.java#L546-L558 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/Sketch.java | Sketch.constructHeapSketch | private static final Sketch constructHeapSketch(final byte famID, final boolean ordered,
final Memory srcMem, final long seed) {
final boolean compact = (srcMem.getByte(FLAGS_BYTE) & COMPACT_FLAG_MASK) != 0;
final Family family = idToFamily(famID);
switch (family) {
case ALPHA: {
if (com... | java | private static final Sketch constructHeapSketch(final byte famID, final boolean ordered,
final Memory srcMem, final long seed) {
final boolean compact = (srcMem.getByte(FLAGS_BYTE) & COMPACT_FLAG_MASK) != 0;
final Family family = idToFamily(famID);
switch (family) {
case ALPHA: {
if (com... | [
"private",
"static",
"final",
"Sketch",
"constructHeapSketch",
"(",
"final",
"byte",
"famID",
",",
"final",
"boolean",
"ordered",
",",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"boolean",
"compact",
"=",
"(",
"srcMem",
"."... | Instantiates a Heap Sketch from Memory.
@param famID the Family ID
@param ordered true if the sketch is of the Compact family and ordered
@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>.
The seed req... | [
"Instantiates",
"a",
"Heap",
"Sketch",
"from",
"Memory",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketch.java#L619-L647 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.getInstance | public static <T> ItemsUnion<T> getInstance(final Comparator<? super T> comparator) {
return new ItemsUnion<T>(PreambleUtil.DEFAULT_K, comparator, null);
} | java | public static <T> ItemsUnion<T> getInstance(final Comparator<? super T> comparator) {
return new ItemsUnion<T>(PreambleUtil.DEFAULT_K, comparator, null);
} | [
"public",
"static",
"<",
"T",
">",
"ItemsUnion",
"<",
"T",
">",
"getInstance",
"(",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"new",
"ItemsUnion",
"<",
"T",
">",
"(",
"PreambleUtil",
".",
"DEFAULT_K",
",",
"c... | Create an instance of ItemsUnion with the default k
@param <T> type of item
@param comparator to compare items
@return an instance of ItemsUnion | [
"Create",
"an",
"instance",
"of",
"ItemsUnion",
"with",
"the",
"default",
"k"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L42-L44 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.getInstance | public static <T> ItemsUnion<T> getInstance(final int maxK, final Comparator<? super T> comparator) {
return new ItemsUnion<>(maxK, comparator, null);
} | java | public static <T> ItemsUnion<T> getInstance(final int maxK, final Comparator<? super T> comparator) {
return new ItemsUnion<>(maxK, comparator, null);
} | [
"public",
"static",
"<",
"T",
">",
"ItemsUnion",
"<",
"T",
">",
"getInstance",
"(",
"final",
"int",
"maxK",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"new",
"ItemsUnion",
"<>",
"(",
"maxK",
",",
"compara... | Create an instance of ItemsUnion
@param <T> type of item
@param maxK determines the accuracy and size of the union and is a maximum value.
The effective <i>k</i> can be smaller due to unions with smaller <i>k</i> sketches.
It is recommended that <i>maxK</i> be a power of 2 to enable unioning of sketches with
different ... | [
"Create",
"an",
"instance",
"of",
"ItemsUnion"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L56-L58 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.getInstance | public static <T> ItemsUnion<T> getInstance(final Memory srcMem,
final Comparator<? super T> comparator, final ArrayOfItemsSerDe<T> serDe) {
final ItemsSketch<T> gadget = ItemsSketch.getInstance(srcMem, comparator, serDe);
return new ItemsUnion<>(gadget.getK(), gadget.getComparator(), gadget);
} | java | public static <T> ItemsUnion<T> getInstance(final Memory srcMem,
final Comparator<? super T> comparator, final ArrayOfItemsSerDe<T> serDe) {
final ItemsSketch<T> gadget = ItemsSketch.getInstance(srcMem, comparator, serDe);
return new ItemsUnion<>(gadget.getK(), gadget.getComparator(), gadget);
} | [
"public",
"static",
"<",
"T",
">",
"ItemsUnion",
"<",
"T",
">",
"getInstance",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
",",
"final",
"ArrayOfItemsSerDe",
"<",
"T",
">",
"serDe",
")",
"{",
... | Heapify the given srcMem into a Union object.
@param <T> type of item
@param srcMem the given srcMem.
A reference to srcMem will not be maintained internally.
@param comparator to compare items
@param serDe an instance of ArrayOfItemsSerDe
@return an instance of ItemsUnion | [
"Heapify",
"the",
"given",
"srcMem",
"into",
"a",
"Union",
"object",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L69-L73 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.getInstance | public static <T> ItemsUnion<T> getInstance(final ItemsSketch<T> sketch) {
return new ItemsUnion<>(sketch.getK(), sketch.getComparator(), ItemsSketch.copy(sketch));
} | java | public static <T> ItemsUnion<T> getInstance(final ItemsSketch<T> sketch) {
return new ItemsUnion<>(sketch.getK(), sketch.getComparator(), ItemsSketch.copy(sketch));
} | [
"public",
"static",
"<",
"T",
">",
"ItemsUnion",
"<",
"T",
">",
"getInstance",
"(",
"final",
"ItemsSketch",
"<",
"T",
">",
"sketch",
")",
"{",
"return",
"new",
"ItemsUnion",
"<>",
"(",
"sketch",
".",
"getK",
"(",
")",
",",
"sketch",
".",
"getComparator... | Create an instance of ItemsUnion based on ItemsSketch
@param <T> type of item
@param sketch the basis of the union
@return an instance of ItemsUnion | [
"Create",
"an",
"instance",
"of",
"ItemsUnion",
"based",
"on",
"ItemsSketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L81-L83 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.update | public void update(final ItemsSketch<T> sketchIn) {
gadget_ = updateLogic(maxK_, comparator_, gadget_, sketchIn);
} | java | public void update(final ItemsSketch<T> sketchIn) {
gadget_ = updateLogic(maxK_, comparator_, gadget_, sketchIn);
} | [
"public",
"void",
"update",
"(",
"final",
"ItemsSketch",
"<",
"T",
">",
"sketchIn",
")",
"{",
"gadget_",
"=",
"updateLogic",
"(",
"maxK_",
",",
"comparator_",
",",
"gadget_",
",",
"sketchIn",
")",
";",
"}"
] | Iterative union operation, which means this method can be repeatedly called.
Merges the given sketch into this union object.
The given sketch is not modified.
It is required that the ratio of the two K values be a power of 2.
This is easily satisfied if each of the K values is already a power of 2.
If the given sketch ... | [
"Iterative",
"union",
"operation",
"which",
"means",
"this",
"method",
"can",
"be",
"repeatedly",
"called",
".",
"Merges",
"the",
"given",
"sketch",
"into",
"this",
"union",
"object",
".",
"The",
"given",
"sketch",
"is",
"not",
"modified",
".",
"It",
"is",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L98-L100 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.update | public void update(final Memory srcMem, final ArrayOfItemsSerDe<T> serDe) {
final ItemsSketch<T> that = ItemsSketch.getInstance(srcMem, comparator_, serDe);
gadget_ = updateLogic(maxK_, comparator_, gadget_, that);
} | java | public void update(final Memory srcMem, final ArrayOfItemsSerDe<T> serDe) {
final ItemsSketch<T> that = ItemsSketch.getInstance(srcMem, comparator_, serDe);
gadget_ = updateLogic(maxK_, comparator_, gadget_, that);
} | [
"public",
"void",
"update",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"ArrayOfItemsSerDe",
"<",
"T",
">",
"serDe",
")",
"{",
"final",
"ItemsSketch",
"<",
"T",
">",
"that",
"=",
"ItemsSketch",
".",
"getInstance",
"(",
"srcMem",
",",
"comparator_",
","... | Iterative union operation, which means this method can be repeatedly called.
Merges the given Memory image of a ItemsSketch into this union object.
The given Memory object is not modified and a link to it is not retained.
It is required that the ratio of the two K values be a power of 2.
This is easily satisfied if eac... | [
"Iterative",
"union",
"operation",
"which",
"means",
"this",
"method",
"can",
"be",
"repeatedly",
"called",
".",
"Merges",
"the",
"given",
"Memory",
"image",
"of",
"a",
"ItemsSketch",
"into",
"this",
"union",
"object",
".",
"The",
"given",
"Memory",
"object",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L115-L118 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java | ItemsUnion.getResult | public ItemsSketch<T> getResult() {
if (gadget_ == null) {
return ItemsSketch.getInstance(maxK_, comparator_);
}
return ItemsSketch.copy(gadget_); //can't have any externally owned handles.
} | java | public ItemsSketch<T> getResult() {
if (gadget_ == null) {
return ItemsSketch.getInstance(maxK_, comparator_);
}
return ItemsSketch.copy(gadget_); //can't have any externally owned handles.
} | [
"public",
"ItemsSketch",
"<",
"T",
">",
"getResult",
"(",
")",
"{",
"if",
"(",
"gadget_",
"==",
"null",
")",
"{",
"return",
"ItemsSketch",
".",
"getInstance",
"(",
"maxK_",
",",
"comparator_",
")",
";",
"}",
"return",
"ItemsSketch",
".",
"copy",
"(",
"... | Gets the result of this Union operation as a copy of the internal state.
This enables further union update operations on this state.
@return the result of this Union operation | [
"Gets",
"the",
"result",
"of",
"this",
"Union",
"operation",
"as",
"a",
"copy",
"of",
"the",
"internal",
"state",
".",
"This",
"enables",
"further",
"union",
"update",
"operations",
"on",
"this",
"state",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L138-L143 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/frequencies/PreambleUtil.java | PreambleUtil.checkPreambleSize | static long checkPreambleSize(final Memory mem) {
final long cap = mem.getCapacity();
if (cap < 8) { throwNotBigEnough(cap, 8); }
final long pre0 = mem.getLong(0);
final int preLongs = (int) (pre0 & 0X3FL); //lower 6 bits
final int required = Math.max(preLongs << 3, 8);
if (cap < required) { thr... | java | static long checkPreambleSize(final Memory mem) {
final long cap = mem.getCapacity();
if (cap < 8) { throwNotBigEnough(cap, 8); }
final long pre0 = mem.getLong(0);
final int preLongs = (int) (pre0 & 0X3FL); //lower 6 bits
final int required = Math.max(preLongs << 3, 8);
if (cap < required) { thr... | [
"static",
"long",
"checkPreambleSize",
"(",
"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 first 8 bytes.
@param mem the given Memory
@return the first 8 bytes of preamble as a long. | [
"Checks",
"Memory",
"for",
"capacity",
"to",
"hold",
"the",
"preamble",
"and",
"returns",
"the",
"first",
"8",
"bytes",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/PreambleUtil.java#L244-L252 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.initNewHeapInstance | static UnionImpl initNewHeapInstance(final int lgNomLongs, final long seed, final float p,
final ResizeFactor rf) {
final UpdateSketch gadget = new HeapQuickSelectSketch(
lgNomLongs, seed, p, rf, true); //create with UNION family
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionIm... | java | static UnionImpl initNewHeapInstance(final int lgNomLongs, final long seed, final float p,
final ResizeFactor rf) {
final UpdateSketch gadget = new HeapQuickSelectSketch(
lgNomLongs, seed, p, rf, true); //create with UNION family
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionIm... | [
"static",
"UnionImpl",
"initNewHeapInstance",
"(",
"final",
"int",
"lgNomLongs",
",",
"final",
"long",
"seed",
",",
"final",
"float",
"p",
",",
"final",
"ResizeFactor",
"rf",
")",
"{",
"final",
"UpdateSketch",
"gadget",
"=",
"new",
"HeapQuickSelectSketch",
"(",
... | Construct a new Union SetOperation on the java heap.
Called by SetOperationBuilder.
@param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLogs">See lgNomLongs</a>
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
@param p <a href="{@docRoot}/resources/dictionary.html#p">See Sa... | [
"Construct",
"a",
"new",
"Union",
"SetOperation",
"on",
"the",
"java",
"heap",
".",
"Called",
"by",
"SetOperationBuilder",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L74-L82 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.initNewDirectInstance | static UnionImpl initNewDirectInstance(
final int lgNomLongs,
final long seed,
final float p,
final ResizeFactor rf,
final MemoryRequestServer memReqSvr,
final WritableMemory dstMem) {
final UpdateSketch gadget = new DirectQuickSelectSketch(
lgNomLongs, seed, p, rf, memRe... | java | static UnionImpl initNewDirectInstance(
final int lgNomLongs,
final long seed,
final float p,
final ResizeFactor rf,
final MemoryRequestServer memReqSvr,
final WritableMemory dstMem) {
final UpdateSketch gadget = new DirectQuickSelectSketch(
lgNomLongs, seed, p, rf, memRe... | [
"static",
"UnionImpl",
"initNewDirectInstance",
"(",
"final",
"int",
"lgNomLongs",
",",
"final",
"long",
"seed",
",",
"final",
"float",
"p",
",",
"final",
"ResizeFactor",
"rf",
",",
"final",
"MemoryRequestServer",
"memReqSvr",
",",
"final",
"WritableMemory",
"dstM... | Construct a new Direct Union in the off-heap destination Memory.
Called by SetOperationBuilder.
@param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLogs">See lgNomLongs</a>.
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
@param p <a href="{@docRoot}/resources/dictionary.h... | [
"Construct",
"a",
"new",
"Direct",
"Union",
"in",
"the",
"off",
"-",
"heap",
"destination",
"Memory",
".",
"Called",
"by",
"SetOperationBuilder",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L96-L109 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.heapifyInstance | static UnionImpl heapifyInstance(final Memory srcMem, final long seed) {
Family.UNION.checkFamilyID(extractFamilyID(srcMem));
final UpdateSketch gadget = HeapQuickSelectSketch.heapifyInstance(srcMem, seed);
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionImpl.unionThetaLong_ = extractUnion... | java | static UnionImpl heapifyInstance(final Memory srcMem, final long seed) {
Family.UNION.checkFamilyID(extractFamilyID(srcMem));
final UpdateSketch gadget = HeapQuickSelectSketch.heapifyInstance(srcMem, seed);
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionImpl.unionThetaLong_ = extractUnion... | [
"static",
"UnionImpl",
"heapifyInstance",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"Family",
".",
"UNION",
".",
"checkFamilyID",
"(",
"extractFamilyID",
"(",
"srcMem",
")",
")",
";",
"final",
"UpdateSketch",
"gadget",
"=",
"H... | Heapify a Union from a Memory Union object containing data.
Called by SetOperation.
@param srcMem The source Memory Union object.
<a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
@return this class | [
"Heapify",
"a",
"Union",
"from",
"a",
"Memory",
"Union",
"object",
"containing",
"data",
".",
"Called",
"by",
"SetOperation",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L119-L126 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.fastWrap | static UnionImpl fastWrap(final WritableMemory srcMem, final long seed) {
Family.UNION.checkFamilyID(extractFamilyID(srcMem));
final UpdateSketch gadget = DirectQuickSelectSketch.fastWritableWrap(srcMem, seed);
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionImpl.unionThetaLong_ = extractU... | java | static UnionImpl fastWrap(final WritableMemory srcMem, final long seed) {
Family.UNION.checkFamilyID(extractFamilyID(srcMem));
final UpdateSketch gadget = DirectQuickSelectSketch.fastWritableWrap(srcMem, seed);
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionImpl.unionThetaLong_ = extractU... | [
"static",
"UnionImpl",
"fastWrap",
"(",
"final",
"WritableMemory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"Family",
".",
"UNION",
".",
"checkFamilyID",
"(",
"extractFamilyID",
"(",
"srcMem",
")",
")",
";",
"final",
"UpdateSketch",
"gadget",
"=",
"... | Fast-wrap a Union object around a Union Memory object containing data.
This does NO validity checking of the given Memory.
@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 this c... | [
"Fast",
"-",
"wrap",
"a",
"Union",
"object",
"around",
"a",
"Union",
"Memory",
"object",
"containing",
"data",
".",
"This",
"does",
"NO",
"validity",
"checking",
"of",
"the",
"given",
"Memory",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L153-L160 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.wrapInstance | static UnionImpl wrapInstance(final Memory srcMem, final long seed) {
Family.UNION.checkFamilyID(extractFamilyID(srcMem));
final UpdateSketch gadget = DirectQuickSelectSketchR.readOnlyWrap(srcMem, seed);
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionImpl.unionThetaLong_ = extractUnionThe... | java | static UnionImpl wrapInstance(final Memory srcMem, final long seed) {
Family.UNION.checkFamilyID(extractFamilyID(srcMem));
final UpdateSketch gadget = DirectQuickSelectSketchR.readOnlyWrap(srcMem, seed);
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
unionImpl.unionThetaLong_ = extractUnionThe... | [
"static",
"UnionImpl",
"wrapInstance",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"Family",
".",
"UNION",
".",
"checkFamilyID",
"(",
"extractFamilyID",
"(",
"srcMem",
")",
")",
";",
"final",
"UpdateSketch",
"gadget",
"=",
"Dire... | Wrap a Union object around a Union Memory object containing data.
Called by SetOperation.
@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 this class | [
"Wrap",
"a",
"Union",
"object",
"around",
"a",
"Union",
"Memory",
"object",
"containing",
"data",
".",
"Called",
"by",
"SetOperation",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L170-L177 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.processVer1 | private void processVer1(final Memory skMem) {
final long thetaLongIn = skMem.getLong(THETA_LONG);
unionThetaLong_ = min(unionThetaLong_, thetaLongIn); //Theta rule
final int curCount = skMem.getInt(RETAINED_ENTRIES_INT);
final int preLongs = 3;
for (int i = 0; i < curCount; i++ ) {
final int ... | java | private void processVer1(final Memory skMem) {
final long thetaLongIn = skMem.getLong(THETA_LONG);
unionThetaLong_ = min(unionThetaLong_, thetaLongIn); //Theta rule
final int curCount = skMem.getInt(RETAINED_ENTRIES_INT);
final int preLongs = 3;
for (int i = 0; i < curCount; i++ ) {
final int ... | [
"private",
"void",
"processVer1",
"(",
"final",
"Memory",
"skMem",
")",
"{",
"final",
"long",
"thetaLongIn",
"=",
"skMem",
".",
"getLong",
"(",
"THETA_LONG",
")",
";",
"unionThetaLong_",
"=",
"min",
"(",
"unionThetaLong_",
",",
"thetaLongIn",
")",
";",
"//Th... | can only be compact, ordered, size > 24 | [
"can",
"only",
"be",
"compact",
"ordered",
"size",
">",
"24"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L406-L419 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.processVer2 | private void processVer2(final Memory skMem) {
Util.checkSeedHashes(seedHash_, skMem.getShort(SEED_HASH_SHORT));
final int preLongs = skMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int curCount = skMem.getInt(RETAINED_ENTRIES_INT);
final long thetaLongIn;
if (preLongs == 1) { //does not change any... | java | private void processVer2(final Memory skMem) {
Util.checkSeedHashes(seedHash_, skMem.getShort(SEED_HASH_SHORT));
final int preLongs = skMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int curCount = skMem.getInt(RETAINED_ENTRIES_INT);
final long thetaLongIn;
if (preLongs == 1) { //does not change any... | [
"private",
"void",
"processVer2",
"(",
"final",
"Memory",
"skMem",
")",
"{",
"Util",
".",
"checkSeedHashes",
"(",
"seedHash_",
",",
"skMem",
".",
"getShort",
"(",
"SEED_HASH_SHORT",
")",
")",
";",
"final",
"int",
"preLongs",
"=",
"skMem",
".",
"getByte",
"... | can only be compact, ordered, size >= 8 | [
"can",
"only",
"be",
"compact",
"ordered",
"size",
">",
"=",
"8"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L423-L446 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UnionImpl.java | UnionImpl.processVer3 | private void processVer3(final Memory skMem) {
Util.checkSeedHashes(seedHash_, skMem.getShort(SEED_HASH_SHORT));
final int preLongs = skMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int curCount;
final long thetaLongIn;
if (preLongs == 1) { //SingleItemSketch if not empty, Read-Only, Compact and Or... | java | private void processVer3(final Memory skMem) {
Util.checkSeedHashes(seedHash_, skMem.getShort(SEED_HASH_SHORT));
final int preLongs = skMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int curCount;
final long thetaLongIn;
if (preLongs == 1) { //SingleItemSketch if not empty, Read-Only, Compact and Or... | [
"private",
"void",
"processVer3",
"(",
"final",
"Memory",
"skMem",
")",
"{",
"Util",
".",
"checkSeedHashes",
"(",
"seedHash_",
",",
"skMem",
".",
"getShort",
"(",
"SEED_HASH_SHORT",
")",
")",
";",
"final",
"int",
"preLongs",
"=",
"skMem",
".",
"getByte",
"... | could be unordered, ordered, compact, or not, size >= 8 | [
"could",
"be",
"unordered",
"ordered",
"compact",
"or",
"not",
"size",
">",
"=",
"8"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L450-L496 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hll/CubicInterpolation.java | CubicInterpolation.usingXArrAndYStride | static double usingXArrAndYStride(
final double[] xArr, final double yStride, final double x) {
final int xArrLen = xArr.length;
final int xArrLenM1 = xArrLen - 1;
final int offset;
assert ((xArrLen >= 4) && (x >= xArr[0]) && (x <= xArr[xArrLenM1]));
if (x == xArr[xArrLenM1]) { /* corner ca... | java | static double usingXArrAndYStride(
final double[] xArr, final double yStride, final double x) {
final int xArrLen = xArr.length;
final int xArrLenM1 = xArrLen - 1;
final int offset;
assert ((xArrLen >= 4) && (x >= xArr[0]) && (x <= xArr[xArrLenM1]));
if (x == xArr[xArrLenM1]) { /* corner ca... | [
"static",
"double",
"usingXArrAndYStride",
"(",
"final",
"double",
"[",
"]",
"xArr",
",",
"final",
"double",
"yStride",
",",
"final",
"double",
"x",
")",
"{",
"final",
"int",
"xArrLen",
"=",
"xArr",
".",
"length",
";",
"final",
"int",
"xArrLenM1",
"=",
"... | Used by HllEstimators | [
"Used",
"by",
"HllEstimators"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/CubicInterpolation.java#L60-L84 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hll/Union.java | Union.heapify | public static final Union heapify(final Memory mem) {
final int lgK = HllUtil.checkLgK(mem.getByte(PreambleUtil.LG_K_BYTE));
final HllSketch sk = HllSketch.heapify(mem);
final Union union = new Union(lgK);
union.update(sk);
return union;
} | java | public static final Union heapify(final Memory mem) {
final int lgK = HllUtil.checkLgK(mem.getByte(PreambleUtil.LG_K_BYTE));
final HllSketch sk = HllSketch.heapify(mem);
final Union union = new Union(lgK);
union.update(sk);
return union;
} | [
"public",
"static",
"final",
"Union",
"heapify",
"(",
"final",
"Memory",
"mem",
")",
"{",
"final",
"int",
"lgK",
"=",
"HllUtil",
".",
"checkLgK",
"(",
"mem",
".",
"getByte",
"(",
"PreambleUtil",
".",
"LG_K_BYTE",
")",
")",
";",
"final",
"HllSketch",
"sk"... | Construct a union operator populated with the given Memory image of an HllSketch.
@param mem the given Memory
@return a union operator populated with the given Memory image of an HllSketch. | [
"Construct",
"a",
"union",
"operator",
"populated",
"with",
"the",
"given",
"Memory",
"image",
"of",
"an",
"HllSketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/Union.java#L103-L109 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hll/Union.java | Union.update | public void update(final HllSketch sketch) {
gadget.hllSketchImpl = unionImpl(sketch.hllSketchImpl, gadget.hllSketchImpl, lgMaxK);
} | java | public void update(final HllSketch sketch) {
gadget.hllSketchImpl = unionImpl(sketch.hllSketchImpl, gadget.hllSketchImpl, lgMaxK);
} | [
"public",
"void",
"update",
"(",
"final",
"HllSketch",
"sketch",
")",
"{",
"gadget",
".",
"hllSketchImpl",
"=",
"unionImpl",
"(",
"sketch",
".",
"hllSketchImpl",
",",
"gadget",
".",
"hllSketchImpl",
",",
"lgMaxK",
")",
";",
"}"
] | Update this union operator with the given sketch.
@param sketch the given sketch. | [
"Update",
"this",
"union",
"operator",
"with",
"the",
"given",
"sketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/Union.java#L270-L272 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hll/Union.java | Union.copyOrDownsampleHll | private static final HllSketchImpl copyOrDownsampleHll(
final HllSketchImpl srcImpl, final int tgtLgK) {
assert srcImpl.getCurMode() == HLL;
final AbstractHllArray src = (AbstractHllArray) srcImpl;
final int srcLgK = src.getLgConfigK();
if ((srcLgK <= tgtLgK) && (src.getTgtHllType() == TgtHllType.... | java | private static final HllSketchImpl copyOrDownsampleHll(
final HllSketchImpl srcImpl, final int tgtLgK) {
assert srcImpl.getCurMode() == HLL;
final AbstractHllArray src = (AbstractHllArray) srcImpl;
final int srcLgK = src.getLgConfigK();
if ((srcLgK <= tgtLgK) && (src.getTgtHllType() == TgtHllType.... | [
"private",
"static",
"final",
"HllSketchImpl",
"copyOrDownsampleHll",
"(",
"final",
"HllSketchImpl",
"srcImpl",
",",
"final",
"int",
"tgtLgK",
")",
"{",
"assert",
"srcImpl",
".",
"getCurMode",
"(",
")",
"==",
"HLL",
";",
"final",
"AbstractHllArray",
"src",
"=",
... | Caller must ultimately manage oooFlag, as caller has more info | [
"Caller",
"must",
"ultimately",
"manage",
"oooFlag",
"as",
"caller",
"has",
"more",
"info"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/Union.java#L438-L456 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/fdt/Group.java | Group.init | public Group init(final String priKey, final int count, final double estimate, final double ub,
final double lb, final double fraction, final double rse) {
this.count = count;
est = estimate;
this.ub = ub;
this.lb = lb;
this.fraction = fraction;
this.rse = rse;
this.priKey = priKey;
... | java | public Group init(final String priKey, final int count, final double estimate, final double ub,
final double lb, final double fraction, final double rse) {
this.count = count;
est = estimate;
this.ub = ub;
this.lb = lb;
this.fraction = fraction;
this.rse = rse;
this.priKey = priKey;
... | [
"public",
"Group",
"init",
"(",
"final",
"String",
"priKey",
",",
"final",
"int",
"count",
",",
"final",
"double",
"estimate",
",",
"final",
"double",
"ub",
",",
"final",
"double",
"lb",
",",
"final",
"double",
"fraction",
",",
"final",
"double",
"rse",
... | Specifies the parameters to be listed as columns
@param priKey the primary key of the FDT sketch
@param count the number of retained rows associated with this group
@param estimate the estimate of the original population associated with this group
@param ub the upper bound of the estimate
@param lb the lower bound of t... | [
"Specifies",
"the",
"parameters",
"to",
"be",
"listed",
"as",
"columns"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/Group.java#L47-L57 | train |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/Sketches.java | Sketches.getEstimate | public static double getEstimate(final Memory srcMem) {
checkIfValidThetaSketch(srcMem);
return Sketch.estimate(getThetaLong(srcMem), getRetainedEntries(srcMem), getEmpty(srcMem));
} | java | public static double getEstimate(final Memory srcMem) {
checkIfValidThetaSketch(srcMem);
return Sketch.estimate(getThetaLong(srcMem), getRetainedEntries(srcMem), getEmpty(srcMem));
} | [
"public",
"static",
"double",
"getEstimate",
"(",
"final",
"Memory",
"srcMem",
")",
"{",
"checkIfValidThetaSketch",
"(",
"srcMem",
")",
";",
"return",
"Sketch",
".",
"estimate",
"(",
"getThetaLong",
"(",
"srcMem",
")",
",",
"getRetainedEntries",
"(",
"srcMem",
... | Gets the unique count estimate from a valid memory image of a Sketch
@param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@return the sketch's best estimate of the cardinality of the input stream. | [
"Gets",
"the",
"unique",
"count",
"estimate",
"from",
"a",
"valid",
"memory",
"image",
"of",
"a",
"Sketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketches.java#L280-L283 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 > 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 > 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 | train |
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 | train |
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 ≤ 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 | train |
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 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.