id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
55,000 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.countPart | public static int countPart(final long[] srcArr, final int lgArrLongs, final long thetaLong) {
int cnt = 0;
final int len = 1 << lgArrLongs;
for (int i = len; i-- > 0;) {
final long hash = srcArr[i];
if (continueCondition(thetaLong, hash) ) {
continue;
}
cnt++ ;
}
ret... | java | public static int countPart(final long[] srcArr, final int lgArrLongs, final long thetaLong) {
int cnt = 0;
final int len = 1 << lgArrLongs;
for (int i = len; i-- > 0;) {
final long hash = srcArr[i];
if (continueCondition(thetaLong, hash) ) {
continue;
}
cnt++ ;
}
ret... | [
"public",
"static",
"int",
"countPart",
"(",
"final",
"long",
"[",
"]",
"srcArr",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"thetaLong",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"final",
"int",
"len",
"=",
"1",
"<<",
"lgArrLongs",
";",
"... | Counts the cardinality of the first Log2 values of the given source array.
@param srcArr the given source array
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>
@param thetaLong <a href="{@docRoot}/resources/dictionary.html#thetaLong">See Theta Long</a>
@return the cardinal... | [
"Counts",
"the",
"cardinality",
"of",
"the",
"first",
"Log2",
"values",
"of",
"the",
"given",
"source",
"array",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L36-L47 |
55,001 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.count | public static int count(final long[] srcArr, final long thetaLong) {
int cnt = 0;
final int len = srcArr.length;
for (int i = len; i-- > 0;) {
final long hash = srcArr[i];
if (continueCondition(thetaLong, hash) ) {
continue;
}
cnt++ ;
}
return cnt;
} | java | public static int count(final long[] srcArr, final long thetaLong) {
int cnt = 0;
final int len = srcArr.length;
for (int i = len; i-- > 0;) {
final long hash = srcArr[i];
if (continueCondition(thetaLong, hash) ) {
continue;
}
cnt++ ;
}
return cnt;
} | [
"public",
"static",
"int",
"count",
"(",
"final",
"long",
"[",
"]",
"srcArr",
",",
"final",
"long",
"thetaLong",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"final",
"int",
"len",
"=",
"srcArr",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"len",
... | Counts the cardinality of the given source array.
@param srcArr the given source array
@param thetaLong <a href="{@docRoot}/resources/dictionary.html#thetaLong">See Theta Long</a>
@return the cardinality | [
"Counts",
"the",
"cardinality",
"of",
"the",
"given",
"source",
"array",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L55-L66 |
55,002 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.hashSearch | public static int hashSearch(final long[] hashTable, final int lgArrLongs, final long hash) {
if (hash == 0) {
throw new SketchesArgumentException("Given hash cannot be zero: " + hash);
}
final int arrayMask = (1 << lgArrLongs) - 1; // current Size -1
final int stride = getStride(hash, lgArrLongs)... | java | public static int hashSearch(final long[] hashTable, final int lgArrLongs, final long hash) {
if (hash == 0) {
throw new SketchesArgumentException("Given hash cannot be zero: " + hash);
}
final int arrayMask = (1 << lgArrLongs) - 1; // current Size -1
final int stride = getStride(hash, lgArrLongs)... | [
"public",
"static",
"int",
"hashSearch",
"(",
"final",
"long",
"[",
"]",
"hashTable",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"hash",
")",
"{",
"if",
"(",
"hash",
"==",
"0",
")",
"{",
"throw",
"new",
"SketchesArgumentException",
"(",
"\"... | This is a classical Knuth-style Open Addressing, Double Hash search scheme for on-heap.
Returns the index if found, -1 if not found.
@param hashTable The hash table to search. Must be a power of 2 in size.
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>.
lgArrLongs ≤ l... | [
"This",
"is",
"a",
"classical",
"Knuth",
"-",
"style",
"Open",
"Addressing",
"Double",
"Hash",
"search",
"scheme",
"for",
"on",
"-",
"heap",
".",
"Returns",
"the",
"index",
"if",
"found",
"-",
"1",
"if",
"not",
"found",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L86-L106 |
55,003 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.hashArrayInsert | public static int hashArrayInsert(final long[] srcArr, final long[] hashTable,
final int lgArrLongs, final long thetaLong) {
int count = 0;
final int arrLen = srcArr.length;
checkThetaCorruption(thetaLong);
for (int i = 0; i < arrLen; i++ ) { // scan source array, build target array
final lo... | java | public static int hashArrayInsert(final long[] srcArr, final long[] hashTable,
final int lgArrLongs, final long thetaLong) {
int count = 0;
final int arrLen = srcArr.length;
checkThetaCorruption(thetaLong);
for (int i = 0; i < arrLen; i++ ) { // scan source array, build target array
final lo... | [
"public",
"static",
"int",
"hashArrayInsert",
"(",
"final",
"long",
"[",
"]",
"srcArr",
",",
"final",
"long",
"[",
"]",
"hashTable",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"thetaLong",
")",
"{",
"int",
"count",
"=",
"0",
";",
"final",
... | Inserts the given long array into the given hash table array of the target size,
removes any negative input values, ignores duplicates and counts the values inserted.
The given hash table may have values, but they must have been inserted by this method or one
of the other OADH insert methods in this class and they may ... | [
"Inserts",
"the",
"given",
"long",
"array",
"into",
"the",
"given",
"hash",
"table",
"array",
"of",
"the",
"target",
"size",
"removes",
"any",
"negative",
"input",
"values",
"ignores",
"duplicates",
"and",
"counts",
"the",
"values",
"inserted",
".",
"The",
"... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L188-L204 |
55,004 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.hashSearch | public static int hashSearch(final Memory mem, final int lgArrLongs, final long hash,
final int memOffsetBytes) {
final int arrayMask = (1 << lgArrLongs) - 1;
final int stride = getStride(hash, lgArrLongs);
int curProbe = (int) (hash & arrayMask);
final int loopIndex = curProbe;
do {
fin... | java | public static int hashSearch(final Memory mem, final int lgArrLongs, final long hash,
final int memOffsetBytes) {
final int arrayMask = (1 << lgArrLongs) - 1;
final int stride = getStride(hash, lgArrLongs);
int curProbe = (int) (hash & arrayMask);
final int loopIndex = curProbe;
do {
fin... | [
"public",
"static",
"int",
"hashSearch",
"(",
"final",
"Memory",
"mem",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"hash",
",",
"final",
"int",
"memOffsetBytes",
")",
"{",
"final",
"int",
"arrayMask",
"=",
"(",
"1",
"<<",
"lgArrLongs",
")",
... | This is a classical Knuth-style Open Addressing, Double Hash search scheme for off-heap.
Returns the index if found, -1 if not found.
@param mem The Memory hash table to search.
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>.
lgArrLongs ≤ log2(hashTable.length).
@para... | [
"This",
"is",
"a",
"classical",
"Knuth",
"-",
"style",
"Open",
"Addressing",
"Double",
"Hash",
"search",
"scheme",
"for",
"off",
"-",
"heap",
".",
"Returns",
"the",
"index",
"if",
"found",
"-",
"1",
"if",
"not",
"found",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L219-L233 |
55,005 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.fastHashInsertOnly | public static int fastHashInsertOnly(final WritableMemory wmem, final int lgArrLongs,
final long hash, final int memOffsetBytes) {
final int arrayMask = (1 << lgArrLongs) - 1; // current Size -1
final int stride = getStride(hash, lgArrLongs);
int curProbe = (int) (hash & arrayMask);
// search for ... | java | public static int fastHashInsertOnly(final WritableMemory wmem, final int lgArrLongs,
final long hash, final int memOffsetBytes) {
final int arrayMask = (1 << lgArrLongs) - 1; // current Size -1
final int stride = getStride(hash, lgArrLongs);
int curProbe = (int) (hash & arrayMask);
// search for ... | [
"public",
"static",
"int",
"fastHashInsertOnly",
"(",
"final",
"WritableMemory",
"wmem",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"hash",
",",
"final",
"int",
"memOffsetBytes",
")",
"{",
"final",
"int",
"arrayMask",
"=",
"(",
"1",
"<<",
"lgAr... | This is a classical Knuth-style Open Addressing, Double Hash insert scheme, but inserts
values directly into a Memory.
This method assumes that the input hash is not a duplicate.
Useful for rebuilding tables to avoid unnecessary comparisons.
Returns the index of insertion, which is always positive or zero.
Throws an ex... | [
"This",
"is",
"a",
"classical",
"Knuth",
"-",
"style",
"Open",
"Addressing",
"Double",
"Hash",
"insert",
"scheme",
"but",
"inserts",
"values",
"directly",
"into",
"a",
"Memory",
".",
"This",
"method",
"assumes",
"that",
"the",
"input",
"hash",
"is",
"not",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L250-L267 |
55,006 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/ConcurrentHeapQuickSelectSketch.java | ConcurrentHeapQuickSelectSketch.advanceEpoch | @SuppressFBWarnings(value = "VO_VOLATILE_INCREMENT",
justification = "False Positive")
private void advanceEpoch() {
awaitBgPropagationTermination();
startEagerPropagation();
ConcurrentPropagationService.resetExecutorService(Thread.currentThread().getId());
//noinspection NonAtomicOperationOnVol... | java | @SuppressFBWarnings(value = "VO_VOLATILE_INCREMENT",
justification = "False Positive")
private void advanceEpoch() {
awaitBgPropagationTermination();
startEagerPropagation();
ConcurrentPropagationService.resetExecutorService(Thread.currentThread().getId());
//noinspection NonAtomicOperationOnVol... | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"VO_VOLATILE_INCREMENT\"",
",",
"justification",
"=",
"\"False Positive\"",
")",
"private",
"void",
"advanceEpoch",
"(",
")",
"{",
"awaitBgPropagationTermination",
"(",
")",
";",
"startEagerPropagation",
"(",
")",
";",
... | Advances the epoch while there is no background propagation
This ensures a propagation invoked before the reset cannot affect the sketch after the reset
is completed. | [
"Advances",
"the",
"epoch",
"while",
"there",
"is",
"no",
"background",
"propagation",
"This",
"ensures",
"a",
"propagation",
"invoked",
"before",
"the",
"reset",
"cannot",
"affect",
"the",
"sketch",
"after",
"the",
"reset",
"is",
"completed",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/ConcurrentHeapQuickSelectSketch.java#L236-L249 |
55,007 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/HeapUpdateDoublesSketch.java | HeapUpdateDoublesSketch.newInstance | static HeapUpdateDoublesSketch newInstance(final int k) {
final HeapUpdateDoublesSketch hqs = new HeapUpdateDoublesSketch(k);
final int baseBufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important
hqs.n_ = 0;
hqs.combinedBuffer_ = new double[baseBufAlloc];
hqs.baseBufferCount_ = 0;
... | java | static HeapUpdateDoublesSketch newInstance(final int k) {
final HeapUpdateDoublesSketch hqs = new HeapUpdateDoublesSketch(k);
final int baseBufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important
hqs.n_ = 0;
hqs.combinedBuffer_ = new double[baseBufAlloc];
hqs.baseBufferCount_ = 0;
... | [
"static",
"HeapUpdateDoublesSketch",
"newInstance",
"(",
"final",
"int",
"k",
")",
"{",
"final",
"HeapUpdateDoublesSketch",
"hqs",
"=",
"new",
"HeapUpdateDoublesSketch",
"(",
"k",
")",
";",
"final",
"int",
"baseBufAlloc",
"=",
"2",
"*",
"Math",
".",
"min",
"("... | Obtains a new on-heap instance of a DoublesSketch.
@param k Parameter that controls space usage of sketch and accuracy of estimates.
Must be greater than 1 and less than 65536 and a power of 2.
@return a HeapUpdateDoublesSketch | [
"Obtains",
"a",
"new",
"on",
"-",
"heap",
"instance",
"of",
"a",
"DoublesSketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/HeapUpdateDoublesSketch.java#L92-L102 |
55,008 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/HeapUpdateDoublesSketch.java | HeapUpdateDoublesSketch.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, min and max from the given source Memory.
The resulting Combined Buffer is always in non-compact form and must be pre-allocated.
@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
@... | [
"Loads",
"the",
"Combined",
"Buffer",
"min",
"and",
"max",
"from",
"the",
"given",
"source",
"Memory",
".",
"The",
"resulting",
"Combined",
"Buffer",
"is",
"always",
"in",
"non",
"-",
"compact",
"form",
"and",
"must",
"be",
"pre",
"-",
"allocated",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/HeapUpdateDoublesSketch.java#L252-L290 |
55,009 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/HeapUpdateDoublesSketch.java | HeapUpdateDoublesSketch.checkHeapMemCapacity | static void checkHeapMemCapacity(final int k, final long n, final boolean compact,
final int serVer, final long memCapBytes) {
final int metaPre = Family.QUANTILES.getMaxPreLongs() + ((serVer == 1) ? 3 : 2);
final int retainedItems = computeRetainedItems(k, n);
final int r... | java | static void checkHeapMemCapacity(final int k, final long n, final boolean compact,
final int serVer, final long memCapBytes) {
final int metaPre = Family.QUANTILES.getMaxPreLongs() + ((serVer == 1) ? 3 : 2);
final int retainedItems = computeRetainedItems(k, n);
final int r... | [
"static",
"void",
"checkHeapMemCapacity",
"(",
"final",
"int",
"k",
",",
"final",
"long",
"n",
",",
"final",
"boolean",
"compact",
",",
"final",
"int",
"serVer",
",",
"final",
"long",
"memCapBytes",
")",
"{",
"final",
"int",
"metaPre",
"=",
"Family",
".",
... | Checks the validity of the heap memory capacity assuming n, k and the compact state.
@param k the given value of k
@param n the given value of n
@param compact true if memory is in compact form
@param serVer serialization version of the source
@param memCapBytes the current memory capacity in bytes | [
"Checks",
"the",
"validity",
"of",
"the",
"heap",
"memory",
"capacity",
"assuming",
"n",
"k",
"and",
"the",
"compact",
"state",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/HeapUpdateDoublesSketch.java#L409-L426 |
55,010 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java | PreambleUtil.getNumCoupons | static int getNumCoupons(final Memory mem) {
final Format format = getFormat(mem);
final HiField hiField = HiField.NUM_COUPONS;
final long offset = getHiFieldOffset(format, hiField);
return mem.getInt(offset);
} | java | static int getNumCoupons(final Memory mem) {
final Format format = getFormat(mem);
final HiField hiField = HiField.NUM_COUPONS;
final long offset = getHiFieldOffset(format, hiField);
return mem.getInt(offset);
} | [
"static",
"int",
"getNumCoupons",
"(",
"final",
"Memory",
"mem",
")",
"{",
"final",
"Format",
"format",
"=",
"getFormat",
"(",
"mem",
")",
";",
"final",
"HiField",
"hiField",
"=",
"HiField",
".",
"NUM_COUPONS",
";",
"final",
"long",
"offset",
"=",
"getHiFi... | PREAMBLE HI_FIELD GETS | [
"PREAMBLE",
"HI_FIELD",
"GETS"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java#L288-L293 |
55,011 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java | PreambleUtil.putEmptyMerged | static void putEmptyMerged(final WritableMemory wmem,
final int lgK,
final short seedHash) {
final Format format = Format.EMPTY_MERGED;
final byte preInts = getDefinedPreInts(format);
final byte fiCol = (byte) 0;
final byte flags = (byte) ((format.ordinal() << 2) | COMPRESSED_FLAG_MASK);
... | java | static void putEmptyMerged(final WritableMemory wmem,
final int lgK,
final short seedHash) {
final Format format = Format.EMPTY_MERGED;
final byte preInts = getDefinedPreInts(format);
final byte fiCol = (byte) 0;
final byte flags = (byte) ((format.ordinal() << 2) | COMPRESSED_FLAG_MASK);
... | [
"static",
"void",
"putEmptyMerged",
"(",
"final",
"WritableMemory",
"wmem",
",",
"final",
"int",
"lgK",
",",
"final",
"short",
"seedHash",
")",
"{",
"final",
"Format",
"format",
"=",
"Format",
".",
"EMPTY_MERGED",
";",
"final",
"byte",
"preInts",
"=",
"getDe... | PUT INTO MEMORY | [
"PUT",
"INTO",
"MEMORY"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java#L380-L389 |
55,012 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java | PreambleUtil.checkLoPreamble | static void checkLoPreamble(final Memory mem) {
rtAssertEquals(getSerVer(mem), SER_VER & 0XFF);
final Format fmt = getFormat(mem);
final int preIntsDef = getDefinedPreInts(fmt) & 0XFF;
rtAssertEquals(getPreInts(mem), preIntsDef);
final Family fam = getFamily(mem);
rtAssert(fam == Family.CPC);
... | java | static void checkLoPreamble(final Memory mem) {
rtAssertEquals(getSerVer(mem), SER_VER & 0XFF);
final Format fmt = getFormat(mem);
final int preIntsDef = getDefinedPreInts(fmt) & 0XFF;
rtAssertEquals(getPreInts(mem), preIntsDef);
final Family fam = getFamily(mem);
rtAssert(fam == Family.CPC);
... | [
"static",
"void",
"checkLoPreamble",
"(",
"final",
"Memory",
"mem",
")",
"{",
"rtAssertEquals",
"(",
"getSerVer",
"(",
"mem",
")",
",",
"SER_VER",
"&",
"0XFF",
")",
";",
"final",
"Format",
"fmt",
"=",
"getFormat",
"(",
"mem",
")",
";",
"final",
"int",
... | basic checks of SerVer, Format, preInts, Family, fiCol, lgK. | [
"basic",
"checks",
"of",
"SerVer",
"Format",
"preInts",
"Family",
"fiCol",
"lgK",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java#L795-L806 |
55,013 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllHelper.java | KllHelper.validateValues | static final void validateValues(final float[] values) {
for (int i = 0; i < values.length ; i++) {
if (Float.isNaN(values[i])) {
throw new SketchesArgumentException("Values must not be NaN");
}
if ((i < (values.length - 1)) && (values[i] >= values[i + 1])) {
throw new SketchesArgu... | java | static final void validateValues(final float[] values) {
for (int i = 0; i < values.length ; i++) {
if (Float.isNaN(values[i])) {
throw new SketchesArgumentException("Values must not be NaN");
}
if ((i < (values.length - 1)) && (values[i] >= values[i + 1])) {
throw new SketchesArgu... | [
"static",
"final",
"void",
"validateValues",
"(",
"final",
"float",
"[",
"]",
"values",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Float",
".",
"isNaN",
"(",
"values",... | Checks the sequential validity of the given array of float values.
They must be unique, monotonically increasing and not NaN.
@param values the given array of values | [
"Checks",
"the",
"sequential",
"validity",
"of",
"the",
"given",
"array",
"of",
"float",
"values",
".",
"They",
"must",
"be",
"unique",
"monotonically",
"increasing",
"and",
"not",
"NaN",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllHelper.java#L45-L55 |
55,014 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/HeapCompactUnorderedSketch.java | HeapCompactUnorderedSketch.compact | static CompactSketch compact(final long[] cache, final boolean empty,
final short seedHash, final int curCount, final long thetaLong) {
if ((curCount == 1) && (thetaLong == Long.MAX_VALUE)) {
return new SingleItemSketch(cache[0], seedHash);
}
return new HeapCompactUnorderedSketch(cache, empty, s... | java | static CompactSketch compact(final long[] cache, final boolean empty,
final short seedHash, final int curCount, final long thetaLong) {
if ((curCount == 1) && (thetaLong == Long.MAX_VALUE)) {
return new SingleItemSketch(cache[0], seedHash);
}
return new HeapCompactUnorderedSketch(cache, empty, s... | [
"static",
"CompactSketch",
"compact",
"(",
"final",
"long",
"[",
"]",
"cache",
",",
"final",
"boolean",
"empty",
",",
"final",
"short",
"seedHash",
",",
"final",
"int",
"curCount",
",",
"final",
"long",
"thetaLong",
")",
"{",
"if",
"(",
"(",
"curCount",
... | Constructs this sketch from correct, valid arguments.
@param cache in compact form
@param empty The correct <a href="{@docRoot}/resources/dictionary.html#empty">Empty</a>.
@param seedHash The correct
<a href="{@docRoot}/resources/dictionary.html#seedHash">Seed Hash</a>.
@param curCount correct value
@param thetaLong Th... | [
"Constructs",
"this",
"sketch",
"from",
"correct",
"valid",
"arguments",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapCompactUnorderedSketch.java#L106-L112 |
55,015 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketch.java | DirectUpdateDoublesSketch.newInstance | static DirectUpdateDoublesSketch newInstance(final int k, final WritableMemory dstMem) {
// must be able to hold at least an empty sketch
final long memCap = dstMem.getCapacity();
checkDirectMemCapacity(k, 0, memCap);
//initialize dstMem
dstMem.putLong(0, 0L); //clear pre0
insertPreLongs(dstMem... | java | static DirectUpdateDoublesSketch newInstance(final int k, final WritableMemory dstMem) {
// must be able to hold at least an empty sketch
final long memCap = dstMem.getCapacity();
checkDirectMemCapacity(k, 0, memCap);
//initialize dstMem
dstMem.putLong(0, 0L); //clear pre0
insertPreLongs(dstMem... | [
"static",
"DirectUpdateDoublesSketch",
"newInstance",
"(",
"final",
"int",
"k",
",",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"// must be able to hold at least an empty sketch",
"final",
"long",
"memCap",
"=",
"dstMem",
".",
"getCapacity",
"(",
")",
";",
"checkD... | Obtains a new Direct instance of a DoublesSketch, which may be off-heap.
@param k Parameter that controls space usage of sketch and accuracy of estimates.
Must be greater than 1 and less than 65536 and a power of 2.
@param dstMem the destination Memory that will be initialized to hold the data for this sketch.
It must... | [
"Obtains",
"a",
"new",
"Direct",
"instance",
"of",
"a",
"DoublesSketch",
"which",
"may",
"be",
"off",
"-",
"heap",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketch.java#L59-L81 |
55,016 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketch.java | DirectUpdateDoublesSketch.growCombinedMemBuffer | private WritableMemory growCombinedMemBuffer(final int itemSpaceNeeded) {
final long memBytes = mem_.getCapacity();
final int needBytes = (itemSpaceNeeded << 3) + COMBINED_BUFFER; //+ preamble + min & max
assert needBytes > memBytes;
memReqSvr = (memReqSvr == null) ? mem_.getMemoryRequestServer() : mem... | java | private WritableMemory growCombinedMemBuffer(final int itemSpaceNeeded) {
final long memBytes = mem_.getCapacity();
final int needBytes = (itemSpaceNeeded << 3) + COMBINED_BUFFER; //+ preamble + min & max
assert needBytes > memBytes;
memReqSvr = (memReqSvr == null) ? mem_.getMemoryRequestServer() : mem... | [
"private",
"WritableMemory",
"growCombinedMemBuffer",
"(",
"final",
"int",
"itemSpaceNeeded",
")",
"{",
"final",
"long",
"memBytes",
"=",
"mem_",
".",
"getCapacity",
"(",
")",
";",
"final",
"int",
"needBytes",
"=",
"(",
"itemSpaceNeeded",
"<<",
"3",
")",
"+",
... | Direct supporting methods | [
"Direct",
"supporting",
"methods"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketch.java#L233-L247 |
55,017 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java | VarOptItemsSketch.newInstance | public static <T> VarOptItemsSketch<T> newInstance(final int k, final ResizeFactor rf) {
return new VarOptItemsSketch<>(k, rf);
} | java | public static <T> VarOptItemsSketch<T> newInstance(final int k, final ResizeFactor rf) {
return new VarOptItemsSketch<>(k, rf);
} | [
"public",
"static",
"<",
"T",
">",
"VarOptItemsSketch",
"<",
"T",
">",
"newInstance",
"(",
"final",
"int",
"k",
",",
"final",
"ResizeFactor",
"rf",
")",
"{",
"return",
"new",
"VarOptItemsSketch",
"<>",
"(",
"k",
",",
"rf",
")",
";",
"}"
] | Construct a varopt sampling sketch with up to k samples using the specified resize factor.
@param k Maximum size of sampling. Allocated size may be smaller until sketch fills.
Unlike many sketches in this package, this value does <em>not</em> need to be a
power of 2.
@param rf <a href="{@docRoot}/resources/dictiona... | [
"Construct",
"a",
"varopt",
"sampling",
"sketch",
"with",
"up",
"to",
"k",
"samples",
"using",
"the",
"specified",
"resize",
"factor",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L192-L194 |
55,018 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java | VarOptItemsSketch.newInstanceAsGadget | static <T> VarOptItemsSketch<T> newInstanceAsGadget(final int k) {
final VarOptItemsSketch<T> sketch = new VarOptItemsSketch<>(k, DEFAULT_RESIZE_FACTOR);
sketch.marks_ = new ArrayList<>(sketch.currItemsAlloc_);
return sketch;
} | java | static <T> VarOptItemsSketch<T> newInstanceAsGadget(final int k) {
final VarOptItemsSketch<T> sketch = new VarOptItemsSketch<>(k, DEFAULT_RESIZE_FACTOR);
sketch.marks_ = new ArrayList<>(sketch.currItemsAlloc_);
return sketch;
} | [
"static",
"<",
"T",
">",
"VarOptItemsSketch",
"<",
"T",
">",
"newInstanceAsGadget",
"(",
"final",
"int",
"k",
")",
"{",
"final",
"VarOptItemsSketch",
"<",
"T",
">",
"sketch",
"=",
"new",
"VarOptItemsSketch",
"<>",
"(",
"k",
",",
"DEFAULT_RESIZE_FACTOR",
")",... | Construct a varopt sketch for use as a unioning gadget, meaning the array of marked elements
is also initialized.
@param k Maximum size of sampling. Allocated size may be smaller until sketch fills.
Unlike many sketches in this package, this value does <em>not</em> need to be a
power of 2.
@param <T> The type of obj... | [
"Construct",
"a",
"varopt",
"sketch",
"for",
"use",
"as",
"a",
"unioning",
"gadget",
"meaning",
"the",
"array",
"of",
"marked",
"elements",
"is",
"also",
"initialized",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L206-L210 |
55,019 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java | VarOptItemsSketch.copyAndSetN | VarOptItemsSketch<T> copyAndSetN(final boolean asSketch, final long adjustedN) {
final VarOptItemsSketch<T> sketch;
sketch = new VarOptItemsSketch<>(data_, weights_, k_,n_,
currItemsAlloc_, rf_, h_, r_, totalWtR_);
if (!asSketch) {
sketch.marks_ = this.marks_;
sketch.numMarksInH_ = ... | java | VarOptItemsSketch<T> copyAndSetN(final boolean asSketch, final long adjustedN) {
final VarOptItemsSketch<T> sketch;
sketch = new VarOptItemsSketch<>(data_, weights_, k_,n_,
currItemsAlloc_, rf_, h_, r_, totalWtR_);
if (!asSketch) {
sketch.marks_ = this.marks_;
sketch.numMarksInH_ = ... | [
"VarOptItemsSketch",
"<",
"T",
">",
"copyAndSetN",
"(",
"final",
"boolean",
"asSketch",
",",
"final",
"long",
"adjustedN",
")",
"{",
"final",
"VarOptItemsSketch",
"<",
"T",
">",
"sketch",
";",
"sketch",
"=",
"new",
"VarOptItemsSketch",
"<>",
"(",
"data_",
",... | Creates a copy of the sketch, optionally discarding any information about marks that would
indicate the class's use as a union gadget as opposed to a valid sketch.
@param asSketch If true, copies as a sketch; if false, copies as a union gadget
@param adjustedN Target value of n for the resulting sketch. Ignored if neg... | [
"Creates",
"a",
"copy",
"of",
"the",
"sketch",
"optionally",
"discarding",
"any",
"information",
"about",
"marks",
"that",
"would",
"indicate",
"the",
"class",
"s",
"use",
"as",
"a",
"union",
"gadget",
"as",
"opposed",
"to",
"a",
"valid",
"sketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L682-L697 |
55,020 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java | VarOptItemsSketch.decreaseKBy1 | void decreaseKBy1() {
if (k_ <= 1) {
throw new SketchesStateException("Cannot decrease k below 1 in union");
}
if ((h_ == 0) && (r_ == 0)) {
// exact mode, but no data yet; this reduction is somewhat gratuitous
--k_;
} else if ((h_ > 0) && (r_ == 0)) {
// exact mode, but we have... | java | void decreaseKBy1() {
if (k_ <= 1) {
throw new SketchesStateException("Cannot decrease k below 1 in union");
}
if ((h_ == 0) && (r_ == 0)) {
// exact mode, but no data yet; this reduction is somewhat gratuitous
--k_;
} else if ((h_ > 0) && (r_ == 0)) {
// exact mode, but we have... | [
"void",
"decreaseKBy1",
"(",
")",
"{",
"if",
"(",
"k_",
"<=",
"1",
")",
"{",
"throw",
"new",
"SketchesStateException",
"(",
"\"Cannot decrease k below 1 in union\"",
")",
";",
"}",
"if",
"(",
"(",
"h_",
"==",
"0",
")",
"&&",
"(",
"r_",
"==",
"0",
")",
... | Decreases sketch's value of k by 1, updating stored values as needed.
<p>Subject to certain pre-conditions, decreasing k causes tau to increase. This fact is used by
the unioning algorithm to force "marked" items out of H and into the reservoir region.</p> | [
"Decreases",
"sketch",
"s",
"value",
"of",
"k",
"by",
"1",
"updating",
"stored",
"values",
"as",
"needed",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L841-L896 |
55,021 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUpdatableSketchBuilder.java | ArrayOfDoublesUpdatableSketchBuilder.build | public ArrayOfDoublesUpdatableSketch build(final WritableMemory dstMem) {
return new DirectArrayOfDoublesQuickSelectSketch(nomEntries_, resizeFactor_.lg(),
samplingProbability_, numValues_, seed_, dstMem);
} | java | public ArrayOfDoublesUpdatableSketch build(final WritableMemory dstMem) {
return new DirectArrayOfDoublesQuickSelectSketch(nomEntries_, resizeFactor_.lg(),
samplingProbability_, numValues_, seed_, dstMem);
} | [
"public",
"ArrayOfDoublesUpdatableSketch",
"build",
"(",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"return",
"new",
"DirectArrayOfDoublesQuickSelectSketch",
"(",
"nomEntries_",
",",
"resizeFactor_",
".",
"lg",
"(",
")",
",",
"samplingProbability_",
",",
"numValues_... | Returns an ArrayOfDoublesUpdatableSketch with the current configuration of this Builder.
@param dstMem instance of Memory to be used by the sketch
@return an ArrayOfDoublesUpdatableSketch | [
"Returns",
"an",
"ArrayOfDoublesUpdatableSketch",
"with",
"the",
"current",
"configuration",
"of",
"this",
"Builder",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUpdatableSketchBuilder.java#L113-L116 |
55,022 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.bytesToInt | public static int bytesToInt(final byte[] arr) {
int v = 0;
for (int i = 0; i < 4; i++) {
v |= (arr[i] & 0XFF) << (i * 8);
}
return v;
} | java | public static int bytesToInt(final byte[] arr) {
int v = 0;
for (int i = 0; i < 4; i++) {
v |= (arr[i] & 0XFF) << (i * 8);
}
return v;
} | [
"public",
"static",
"int",
"bytesToInt",
"(",
"final",
"byte",
"[",
"]",
"arr",
")",
"{",
"int",
"v",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"v",
"|=",
"(",
"arr",
"[",
"i",
"]",
"&"... | Returns an int extracted from a Little-Endian byte array.
@param arr the given byte array
@return an int extracted from a Little-Endian byte array. | [
"Returns",
"an",
"int",
"extracted",
"from",
"a",
"Little",
"-",
"Endian",
"byte",
"array",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L113-L119 |
55,023 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.bytesToLong | public static long bytesToLong(final byte[] arr) {
long v = 0;
for (int i = 0; i < 8; i++) {
v |= (arr[i] & 0XFFL) << (i * 8);
}
return v;
} | java | public static long bytesToLong(final byte[] arr) {
long v = 0;
for (int i = 0; i < 8; i++) {
v |= (arr[i] & 0XFFL) << (i * 8);
}
return v;
} | [
"public",
"static",
"long",
"bytesToLong",
"(",
"final",
"byte",
"[",
"]",
"arr",
")",
"{",
"long",
"v",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"v",
"|=",
"(",
"arr",
"[",
"i",
"]",
... | Returns a long extracted from a Little-Endian byte array.
@param arr the given byte array
@return a long extracted from a Little-Endian byte array. | [
"Returns",
"a",
"long",
"extracted",
"from",
"a",
"Little",
"-",
"Endian",
"byte",
"array",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L126-L132 |
55,024 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.intToBytes | public static byte[] intToBytes(int v, final byte[] arr) {
for (int i = 0; i < 4; i++) {
arr[i] = (byte) (v & 0XFF);
v >>>= 8;
}
return arr;
} | java | public static byte[] intToBytes(int v, final byte[] arr) {
for (int i = 0; i < 4; i++) {
arr[i] = (byte) (v & 0XFF);
v >>>= 8;
}
return arr;
} | [
"public",
"static",
"byte",
"[",
"]",
"intToBytes",
"(",
"int",
"v",
",",
"final",
"byte",
"[",
"]",
"arr",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"arr",
"[",
"i",
"]",
"=",
"(",
"byte",
... | Returns a Little-Endian byte array extracted from the given int.
@param v the given int
@param arr a given array of 4 bytes that will be returned with the data
@return a Little-Endian byte array extracted from the given int. | [
"Returns",
"a",
"Little",
"-",
"Endian",
"byte",
"array",
"extracted",
"from",
"the",
"given",
"int",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L140-L146 |
55,025 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.longToBytes | public static byte[] longToBytes(long v, final byte[] arr) {
for (int i = 0; i < 8; i++) {
arr[i] = (byte) (v & 0XFFL);
v >>>= 8;
}
return arr;
} | java | public static byte[] longToBytes(long v, final byte[] arr) {
for (int i = 0; i < 8; i++) {
arr[i] = (byte) (v & 0XFFL);
v >>>= 8;
}
return arr;
} | [
"public",
"static",
"byte",
"[",
"]",
"longToBytes",
"(",
"long",
"v",
",",
"final",
"byte",
"[",
"]",
"arr",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"arr",
"[",
"i",
"]",
"=",
"(",
"byte",
... | Returns a Little-Endian byte array extracted from the given long.
@param v the given long
@param arr a given array of 8 bytes that will be returned with the data
@return a Little-Endian byte array extracted from the given long. | [
"Returns",
"a",
"Little",
"-",
"Endian",
"byte",
"array",
"extracted",
"from",
"the",
"given",
"long",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L154-L160 |
55,026 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.longToHexBytes | public static String longToHexBytes(final long v) {
final long mask = 0XFFL;
final StringBuilder sb = new StringBuilder();
for (int i = 8; i-- > 0; ) {
final String s = Long.toHexString((v >>> (i * 8)) & mask);
sb.append(zeroPad(s, 2)).append(" ");
}
return sb.toString();
} | java | public static String longToHexBytes(final long v) {
final long mask = 0XFFL;
final StringBuilder sb = new StringBuilder();
for (int i = 8; i-- > 0; ) {
final String s = Long.toHexString((v >>> (i * 8)) & mask);
sb.append(zeroPad(s, 2)).append(" ");
}
return sb.toString();
} | [
"public",
"static",
"String",
"longToHexBytes",
"(",
"final",
"long",
"v",
")",
"{",
"final",
"long",
"mask",
"=",
"0XFF",
"L",
";",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"8",
";",
"i... | Returns a string of spaced hex bytes in Big-Endian order.
@param v the given long
@return string of spaced hex bytes in Big-Endian order. | [
"Returns",
"a",
"string",
"of",
"spaced",
"hex",
"bytes",
"in",
"Big",
"-",
"Endian",
"order",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L169-L177 |
55,027 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.bytesToString | public static String bytesToString(
final byte[] arr, final boolean signed, final boolean littleEndian, final String sep) {
final StringBuilder sb = new StringBuilder();
final int mask = (signed) ? 0XFFFFFFFF : 0XFF;
final int arrLen = arr.length;
if (littleEndian) {
for (int i = 0; i < (arr... | java | public static String bytesToString(
final byte[] arr, final boolean signed, final boolean littleEndian, final String sep) {
final StringBuilder sb = new StringBuilder();
final int mask = (signed) ? 0XFFFFFFFF : 0XFF;
final int arrLen = arr.length;
if (littleEndian) {
for (int i = 0; i < (arr... | [
"public",
"static",
"String",
"bytesToString",
"(",
"final",
"byte",
"[",
"]",
"arr",
",",
"final",
"boolean",
"signed",
",",
"final",
"boolean",
"littleEndian",
",",
"final",
"String",
"sep",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuil... | Returns a string view of a byte array
@param arr the given byte array
@param signed set true if you want the byte values signed.
@param littleEndian set true if you want Little-Endian order
@param sep the separator string between bytes
@return a string view of a byte array | [
"Returns",
"a",
"string",
"view",
"of",
"a",
"byte",
"array"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L187-L204 |
55,028 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.nanoSecToString | public static String nanoSecToString(final long nS) {
final long rem_nS = (long)(nS % 1000.0);
final long rem_uS = (long)((nS / 1000.0) % 1000.0);
final long rem_mS = (long)((nS / 1000000.0) % 1000.0);
final long sec = (long)(nS / 1000000000.0);
final String nSstr = zeroPad(Long.toString(rem_nS),... | java | public static String nanoSecToString(final long nS) {
final long rem_nS = (long)(nS % 1000.0);
final long rem_uS = (long)((nS / 1000.0) % 1000.0);
final long rem_mS = (long)((nS / 1000000.0) % 1000.0);
final long sec = (long)(nS / 1000000000.0);
final String nSstr = zeroPad(Long.toString(rem_nS),... | [
"public",
"static",
"String",
"nanoSecToString",
"(",
"final",
"long",
"nS",
")",
"{",
"final",
"long",
"rem_nS",
"=",
"(",
"long",
")",
"(",
"nS",
"%",
"1000.0",
")",
";",
"final",
"long",
"rem_uS",
"=",
"(",
"long",
")",
"(",
"(",
"nS",
"/",
"100... | Returns the given time in nanoseconds formatted as Sec.mSec uSec nSec
@param nS the given nanoseconds
@return the given time in nanoseconds formatted as Sec.mSec uSec nSec | [
"Returns",
"the",
"given",
"time",
"in",
"nanoseconds",
"formatted",
"as",
"Sec",
".",
"mSec",
"uSec",
"nSec"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L211-L220 |
55,029 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.characterPad | public static final String characterPad(final String s, final int fieldLength, final char padChar,
final boolean postpend) {
final char[] chArr = s.toCharArray();
final int sLen = chArr.length;
if (sLen < fieldLength) {
final char[] out = new char[fieldLength];
final int blanks = fieldLeng... | java | public static final String characterPad(final String s, final int fieldLength, final char padChar,
final boolean postpend) {
final char[] chArr = s.toCharArray();
final int sLen = chArr.length;
if (sLen < fieldLength) {
final char[] out = new char[fieldLength];
final int blanks = fieldLeng... | [
"public",
"static",
"final",
"String",
"characterPad",
"(",
"final",
"String",
"s",
",",
"final",
"int",
"fieldLength",
",",
"final",
"char",
"padChar",
",",
"final",
"boolean",
"postpend",
")",
"{",
"final",
"char",
"[",
"]",
"chArr",
"=",
"s",
".",
"to... | Prepend or postpend the given string with the given character to fill the given field length.
If the given string is equal or greater than the given field length, it will be returned
without modification.
@param s the given string
@param fieldLength the desired field length
@param padChar the desired pad character
@par... | [
"Prepend",
"or",
"postpend",
"the",
"given",
"string",
"with",
"the",
"given",
"character",
"to",
"fill",
"the",
"given",
"field",
"length",
".",
"If",
"the",
"given",
"string",
"is",
"equal",
"or",
"greater",
"than",
"the",
"given",
"field",
"length",
"it... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L260-L287 |
55,030 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.computeSeedHash | public static short computeSeedHash(final long seed) {
final long[] seedArr = {seed};
final short seedHash = (short)((hash(seedArr, 0L)[0]) & 0xFFFFL);
if (seedHash == 0) {
throw new SketchesArgumentException(
"The given seed: " + seed + " produced a seedHash of zero. "
+ "You ... | java | public static short computeSeedHash(final long seed) {
final long[] seedArr = {seed};
final short seedHash = (short)((hash(seedArr, 0L)[0]) & 0xFFFFL);
if (seedHash == 0) {
throw new SketchesArgumentException(
"The given seed: " + seed + " produced a seedHash of zero. "
+ "You ... | [
"public",
"static",
"short",
"computeSeedHash",
"(",
"final",
"long",
"seed",
")",
"{",
"final",
"long",
"[",
"]",
"seedArr",
"=",
"{",
"seed",
"}",
";",
"final",
"short",
"seedHash",
"=",
"(",
"short",
")",
"(",
"(",
"hash",
"(",
"seedArr",
",",
"0L... | Computes and checks the 16-bit seed hash from the given long seed.
The seed hash may not be zero in order to maintain compatibility with older serialized
versions that did not have this concept.
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>
@return the seed hash. | [
"Computes",
"and",
"checks",
"the",
"16",
"-",
"bit",
"seed",
"hash",
"from",
"the",
"given",
"long",
"seed",
".",
"The",
"seed",
"hash",
"may",
"not",
"be",
"zero",
"in",
"order",
"to",
"maintain",
"compatibility",
"with",
"older",
"serialized",
"versions... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L312-L321 |
55,031 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.checkIfMultipleOf8AndGT0 | public static void checkIfMultipleOf8AndGT0(final long v, final String argName) {
if (((v & 0X7L) == 0L) && (v > 0L)) {
return;
}
throw new SketchesArgumentException("The value of the parameter \"" + argName
+ "\" must be a positive multiple of 8 and greater than zero: " + v);
} | java | public static void checkIfMultipleOf8AndGT0(final long v, final String argName) {
if (((v & 0X7L) == 0L) && (v > 0L)) {
return;
}
throw new SketchesArgumentException("The value of the parameter \"" + argName
+ "\" must be a positive multiple of 8 and greater than zero: " + v);
} | [
"public",
"static",
"void",
"checkIfMultipleOf8AndGT0",
"(",
"final",
"long",
"v",
",",
"final",
"String",
"argName",
")",
"{",
"if",
"(",
"(",
"(",
"v",
"&",
"0X7",
"L",
")",
"==",
"0L",
")",
"&&",
"(",
"v",
">",
"0L",
")",
")",
"{",
"return",
"... | Checks if parameter v is a multiple of 8 and greater than zero.
@param v The parameter to check
@param argName This name will be part of the error message if the check fails. | [
"Checks",
"if",
"parameter",
"v",
"is",
"a",
"multiple",
"of",
"8",
"and",
"greater",
"than",
"zero",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L330-L336 |
55,032 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.checkIfPowerOf2 | public static void checkIfPowerOf2(final int v, final String argName) {
if ((v > 0) && ((v & (v - 1)) == 0)) {
return;
}
throw new SketchesArgumentException("The value of the parameter \"" + argName
+ "\" must be a positive integer-power of 2" + " and greater than 0: " + v);
} | java | public static void checkIfPowerOf2(final int v, final String argName) {
if ((v > 0) && ((v & (v - 1)) == 0)) {
return;
}
throw new SketchesArgumentException("The value of the parameter \"" + argName
+ "\" must be a positive integer-power of 2" + " and greater than 0: " + v);
} | [
"public",
"static",
"void",
"checkIfPowerOf2",
"(",
"final",
"int",
"v",
",",
"final",
"String",
"argName",
")",
"{",
"if",
"(",
"(",
"v",
">",
"0",
")",
"&&",
"(",
"(",
"v",
"&",
"(",
"v",
"-",
"1",
")",
")",
"==",
"0",
")",
")",
"{",
"retur... | Checks the given parameter to make sure it is positive, an integer-power of 2 and greater than
zero.
@param v The input argument.
@param argName Used in the thrown exception. | [
"Checks",
"the",
"given",
"parameter",
"to",
"make",
"sure",
"it",
"is",
"positive",
"an",
"integer",
"-",
"power",
"of",
"2",
"and",
"greater",
"than",
"zero",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L366-L372 |
55,033 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.toLog2 | public static int toLog2(final int value, final String argName) {
checkIfPowerOf2(value, argName);
return Integer.numberOfTrailingZeros(value);
} | java | public static int toLog2(final int value, final String argName) {
checkIfPowerOf2(value, argName);
return Integer.numberOfTrailingZeros(value);
} | [
"public",
"static",
"int",
"toLog2",
"(",
"final",
"int",
"value",
",",
"final",
"String",
"argName",
")",
"{",
"checkIfPowerOf2",
"(",
"value",
",",
"argName",
")",
";",
"return",
"Integer",
".",
"numberOfTrailingZeros",
"(",
"value",
")",
";",
"}"
] | Checks the given value if it is a power of 2. If not, it throws an exception.
Otherwise, returns the log-base2 of the given value.
@param value must be a power of 2 and greater than zero.
@param argName the argument name used in the exception if thrown.
@return the log-base2 of the given value | [
"Checks",
"the",
"given",
"value",
"if",
"it",
"is",
"a",
"power",
"of",
"2",
".",
"If",
"not",
"it",
"throws",
"an",
"exception",
".",
"Otherwise",
"returns",
"the",
"log",
"-",
"base2",
"of",
"the",
"given",
"value",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L381-L384 |
55,034 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.evenlyLgSpaced | public static int[] evenlyLgSpaced(final int lgStart, final int lgEnd, final int points) {
if (points <= 0) {
throw new SketchesArgumentException("points must be > 0");
}
if ((lgEnd < 0) || (lgStart < 0)) {
throw new SketchesArgumentException("lgStart and lgEnd must be >= 0.");
}
final i... | java | public static int[] evenlyLgSpaced(final int lgStart, final int lgEnd, final int points) {
if (points <= 0) {
throw new SketchesArgumentException("points must be > 0");
}
if ((lgEnd < 0) || (lgStart < 0)) {
throw new SketchesArgumentException("lgStart and lgEnd must be >= 0.");
}
final i... | [
"public",
"static",
"int",
"[",
"]",
"evenlyLgSpaced",
"(",
"final",
"int",
"lgStart",
",",
"final",
"int",
"lgEnd",
",",
"final",
"int",
"points",
")",
"{",
"if",
"(",
"points",
"<=",
"0",
")",
"{",
"throw",
"new",
"SketchesArgumentException",
"(",
"\"p... | Returns an int array of points that will be evenly spaced on a log axis.
This is designed for Log_base2 numbers.
@param lgStart the Log_base2 of the starting value. E.g., for 1 lgStart = 0.
@param lgEnd the Log_base2 of the ending value. E.g. for 1024 lgEnd = 10.
@param points the total number of points including the s... | [
"Returns",
"an",
"int",
"array",
"of",
"points",
"that",
"will",
"be",
"evenly",
"spaced",
"on",
"a",
"log",
"axis",
".",
"This",
"is",
"designed",
"for",
"Log_base2",
"numbers",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L447-L463 |
55,035 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.simpleIntLog2 | public static int simpleIntLog2(final int x) {
final int exp = Integer.numberOfTrailingZeros(x);
if (x != (1 << exp)) {
throw new SketchesArgumentException("Argument x cannot be negative or zero.");
}
return exp;
} | java | public static int simpleIntLog2(final int x) {
final int exp = Integer.numberOfTrailingZeros(x);
if (x != (1 << exp)) {
throw new SketchesArgumentException("Argument x cannot be negative or zero.");
}
return exp;
} | [
"public",
"static",
"int",
"simpleIntLog2",
"(",
"final",
"int",
"x",
")",
"{",
"final",
"int",
"exp",
"=",
"Integer",
".",
"numberOfTrailingZeros",
"(",
"x",
")",
";",
"if",
"(",
"x",
"!=",
"(",
"1",
"<<",
"exp",
")",
")",
"{",
"throw",
"new",
"Sk... | Gives the log2 of an integer that is known to be a power of 2.
@param x number that is greater than zero
@return the log2 of an integer that is known to be a power of 2. | [
"Gives",
"the",
"log2",
"of",
"an",
"integer",
"that",
"is",
"known",
"to",
"be",
"a",
"power",
"of",
"2",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L544-L550 |
55,036 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.startingSubMultiple | public static final int startingSubMultiple(final int lgTarget, final ResizeFactor rf,
final int lgMin) {
final int lgRF = rf.lg();
return (lgTarget <= lgMin) ? lgMin : (lgRF == 0) ? lgTarget : ((lgTarget - lgMin) % lgRF) + lgMin;
} | java | public static final int startingSubMultiple(final int lgTarget, final ResizeFactor rf,
final int lgMin) {
final int lgRF = rf.lg();
return (lgTarget <= lgMin) ? lgMin : (lgRF == 0) ? lgTarget : ((lgTarget - lgMin) % lgRF) + lgMin;
} | [
"public",
"static",
"final",
"int",
"startingSubMultiple",
"(",
"final",
"int",
"lgTarget",
",",
"final",
"ResizeFactor",
"rf",
",",
"final",
"int",
"lgMin",
")",
"{",
"final",
"int",
"lgRF",
"=",
"rf",
".",
"lg",
"(",
")",
";",
"return",
"(",
"lgTarget"... | Gets the smallest allowed exponent of 2 that it is a sub-multiple of the target by zero,
one or more resize factors.
@param lgTarget Log2 of the target size
@param rf <a href="{@docRoot}/resources/dictionary.html#resizeFactor">See Resize Factor</a>
@param lgMin Log2 of the minimum allowed starting size
@return The Log... | [
"Gets",
"the",
"smallest",
"allowed",
"exponent",
"of",
"2",
"that",
"it",
"is",
"a",
"sub",
"-",
"multiple",
"of",
"the",
"target",
"by",
"zero",
"one",
"or",
"more",
"resize",
"factors",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L561-L565 |
55,037 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UpdateSketch.java | UpdateSketch.heapify | public static UpdateSketch heapify(final Memory srcMem, final long seed) {
final Family family = Family.idToFamily(srcMem.getByte(FAMILY_BYTE));
if (family.equals(Family.ALPHA)) {
return HeapAlphaSketch.heapifyInstance(srcMem, seed);
}
return HeapQuickSelectSketch.heapifyInstance(srcMem, seed);
... | java | public static UpdateSketch heapify(final Memory srcMem, final long seed) {
final Family family = Family.idToFamily(srcMem.getByte(FAMILY_BYTE));
if (family.equals(Family.ALPHA)) {
return HeapAlphaSketch.heapifyInstance(srcMem, seed);
}
return HeapQuickSelectSketch.heapifyInstance(srcMem, seed);
... | [
"public",
"static",
"UpdateSketch",
"heapify",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"Family",
"family",
"=",
"Family",
".",
"idToFamily",
"(",
"srcMem",
".",
"getByte",
"(",
"FAMILY_BYTE",
")",
")",
";",
"if",
... | Instantiates an on-heap UpdateSketch from Memory.
@param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
@return an UpdateSketch | [
"Instantiates",
"an",
"on",
"-",
"heap",
"UpdateSketch",
"from",
"Memory",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UpdateSketch.java#L107-L113 |
55,038 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UpdateSketch.java | UpdateSketch.update | public UpdateReturnState update(final String datum) {
if ((datum == null) || datum.isEmpty()) {
return RejectedNullOrEmpty;
}
final byte[] data = datum.getBytes(UTF_8);
return hashUpdate(hash(data, getSeed())[0] >>> 1);
} | java | public UpdateReturnState update(final String datum) {
if ((datum == null) || datum.isEmpty()) {
return RejectedNullOrEmpty;
}
final byte[] data = datum.getBytes(UTF_8);
return hashUpdate(hash(data, getSeed())[0] >>> 1);
} | [
"public",
"UpdateReturnState",
"update",
"(",
"final",
"String",
"datum",
")",
"{",
"if",
"(",
"(",
"datum",
"==",
"null",
")",
"||",
"datum",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"RejectedNullOrEmpty",
";",
"}",
"final",
"byte",
"[",
"]",
"da... | Present this sketch with the given String.
The string is converted to a byte array using UTF8 encoding.
If the string is null or empty no update attempt is made and the method returns.
<p>Note: this will not produce the same output hash values as the {@link #update(char[])}
method and will generally be a little slower... | [
"Present",
"this",
"sketch",
"with",
"the",
"given",
"String",
".",
"The",
"string",
"is",
"converted",
"to",
"a",
"byte",
"array",
"using",
"UTF8",
"encoding",
".",
"If",
"the",
"string",
"is",
"null",
"or",
"empty",
"no",
"update",
"attempt",
"is",
"ma... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UpdateSketch.java#L229-L235 |
55,039 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/UpdateSketch.java | UpdateSketch.update | public UpdateReturnState update(final byte[] data) {
if ((data == null) || (data.length == 0)) {
return RejectedNullOrEmpty;
}
return hashUpdate(hash(data, getSeed())[0] >>> 1);
} | java | public UpdateReturnState update(final byte[] data) {
if ((data == null) || (data.length == 0)) {
return RejectedNullOrEmpty;
}
return hashUpdate(hash(data, getSeed())[0] >>> 1);
} | [
"public",
"UpdateReturnState",
"update",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"(",
"data",
"==",
"null",
")",
"||",
"(",
"data",
".",
"length",
"==",
"0",
")",
")",
"{",
"return",
"RejectedNullOrEmpty",
";",
"}",
"return",
"ha... | Present this sketch with the given byte array.
If the byte array is null or empty no update attempt is made and the method returns.
@param data The given byte array.
@return
<a href="{@docRoot}/resources/dictionary.html#updateReturnState">See Update Return State</a> | [
"Present",
"this",
"sketch",
"with",
"the",
"given",
"byte",
"array",
".",
"If",
"the",
"byte",
"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/theta/UpdateSketch.java#L245-L250 |
55,040 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.heapify | public static DoublesSketch heapify(final Memory srcMem) {
if (checkIsCompactMemory(srcMem)) {
return CompactDoublesSketch.heapify(srcMem);
}
return UpdateDoublesSketch.heapify(srcMem);
} | java | public static DoublesSketch heapify(final Memory srcMem) {
if (checkIsCompactMemory(srcMem)) {
return CompactDoublesSketch.heapify(srcMem);
}
return UpdateDoublesSketch.heapify(srcMem);
} | [
"public",
"static",
"DoublesSketch",
"heapify",
"(",
"final",
"Memory",
"srcMem",
")",
"{",
"if",
"(",
"checkIsCompactMemory",
"(",
"srcMem",
")",
")",
"{",
"return",
"CompactDoublesSketch",
".",
"heapify",
"(",
"srcMem",
")",
";",
"}",
"return",
"UpdateDouble... | Heapify takes the sketch image in Memory and instantiates an on-heap Sketch.
The resulting sketch will not retain any link to the source Memory.
@param srcMem a Memory image of a Sketch.
<a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@return a heap-based Sketch based on the given Memory | [
"Heapify",
"takes",
"the",
"sketch",
"image",
"in",
"Memory",
"and",
"instantiates",
"an",
"on",
"-",
"heap",
"Sketch",
".",
"The",
"resulting",
"sketch",
"will",
"not",
"retain",
"any",
"link",
"to",
"the",
"source",
"Memory",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L167-L172 |
55,041 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.wrap | public static DoublesSketch wrap(final Memory srcMem) {
if (checkIsCompactMemory(srcMem)) {
return DirectCompactDoublesSketch.wrapInstance(srcMem);
}
return DirectUpdateDoublesSketchR.wrapInstance(srcMem);
} | java | public static DoublesSketch wrap(final Memory srcMem) {
if (checkIsCompactMemory(srcMem)) {
return DirectCompactDoublesSketch.wrapInstance(srcMem);
}
return DirectUpdateDoublesSketchR.wrapInstance(srcMem);
} | [
"public",
"static",
"DoublesSketch",
"wrap",
"(",
"final",
"Memory",
"srcMem",
")",
"{",
"if",
"(",
"checkIsCompactMemory",
"(",
"srcMem",
")",
")",
"{",
"return",
"DirectCompactDoublesSketch",
".",
"wrapInstance",
"(",
"srcMem",
")",
";",
"}",
"return",
"Dire... | Wrap this sketch around the given Memory image of a DoublesSketch, compact or non-compact.
@param srcMem the given Memory image of a DoublesSketch that may have data,
@return a sketch that wraps the given srcMem | [
"Wrap",
"this",
"sketch",
"around",
"the",
"given",
"Memory",
"image",
"of",
"a",
"DoublesSketch",
"compact",
"or",
"non",
"-",
"compact",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L180-L185 |
55,042 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.downSample | public DoublesSketch downSample(final DoublesSketch srcSketch, final int smallerK,
final WritableMemory dstMem) {
return downSampleInternal(srcSketch, smallerK, dstMem);
} | java | public DoublesSketch downSample(final DoublesSketch srcSketch, final int smallerK,
final WritableMemory dstMem) {
return downSampleInternal(srcSketch, smallerK, dstMem);
} | [
"public",
"DoublesSketch",
"downSample",
"(",
"final",
"DoublesSketch",
"srcSketch",
",",
"final",
"int",
"smallerK",
",",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"return",
"downSampleInternal",
"(",
"srcSketch",
",",
"smallerK",
",",
"dstMem",
")",
";",
... | From an source sketch, create a new sketch that must have a smaller value of K.
The original sketch is not modified.
@param srcSketch the sourcing sketch
@param smallerK the new sketch's value of K that must be smaller than this value of K.
It is required that this.getK() = smallerK * 2^(nonnegative integer).
@param d... | [
"From",
"an",
"source",
"sketch",
"create",
"a",
"new",
"sketch",
"that",
"must",
"have",
"a",
"smaller",
"value",
"of",
"K",
".",
"The",
"original",
"sketch",
"is",
"not",
"modified",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L601-L604 |
55,043 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.putMemory | public void putMemory(final WritableMemory dstMem, final boolean compact) {
if (isDirect() && (isCompact() == compact)) {
final Memory srcMem = getMemory();
srcMem.copyTo(0, dstMem, 0, getStorageBytes());
} else {
final byte[] byteArr = toByteArray(compact);
final int arrLen = byteArr.le... | java | public void putMemory(final WritableMemory dstMem, final boolean compact) {
if (isDirect() && (isCompact() == compact)) {
final Memory srcMem = getMemory();
srcMem.copyTo(0, dstMem, 0, getStorageBytes());
} else {
final byte[] byteArr = toByteArray(compact);
final int arrLen = byteArr.le... | [
"public",
"void",
"putMemory",
"(",
"final",
"WritableMemory",
"dstMem",
",",
"final",
"boolean",
"compact",
")",
"{",
"if",
"(",
"isDirect",
"(",
")",
"&&",
"(",
"isCompact",
"(",
")",
"==",
"compact",
")",
")",
"{",
"final",
"Memory",
"srcMem",
"=",
... | Puts the current sketch into the given Memory if there is sufficient space, otherwise,
throws an error.
@param dstMem the given memory.
@param compact if true, compacts and sorts the base buffer, which optimizes merge
performance at the cost of slightly increased serialization time. | [
"Puts",
"the",
"current",
"sketch",
"into",
"the",
"given",
"Memory",
"if",
"there",
"is",
"sufficient",
"space",
"otherwise",
"throws",
"an",
"error",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L693-L707 |
55,044 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/QuantilesHelper.java | QuantilesHelper.convertToPrecedingCummulative | public static long convertToPrecedingCummulative(final long[] array) {
long subtotal = 0;
for (int i = 0; i < array.length; i++) {
final long newSubtotal = subtotal + array[i];
array[i] = subtotal;
subtotal = newSubtotal;
}
return subtotal;
} | java | public static long convertToPrecedingCummulative(final long[] array) {
long subtotal = 0;
for (int i = 0; i < array.length; i++) {
final long newSubtotal = subtotal + array[i];
array[i] = subtotal;
subtotal = newSubtotal;
}
return subtotal;
} | [
"public",
"static",
"long",
"convertToPrecedingCummulative",
"(",
"final",
"long",
"[",
"]",
"array",
")",
"{",
"long",
"subtotal",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"f... | Convert the weights into totals of the weights preceding each item
@param array of weights
@return total weight | [
"Convert",
"the",
"weights",
"into",
"totals",
"of",
"the",
"weights",
"preceding",
"each",
"item"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuantilesHelper.java#L18-L26 |
55,045 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/QuantilesHelper.java | QuantilesHelper.chunkContainingPos | public static int chunkContainingPos(final long[] arr, final long pos) {
final int nominalLength = arr.length - 1; /* remember, arr contains an "extra" position */
assert nominalLength > 0;
final long n = arr[nominalLength];
assert 0 <= pos;
assert pos < n;
final int l = 0;
final int r = nom... | java | public static int chunkContainingPos(final long[] arr, final long pos) {
final int nominalLength = arr.length - 1; /* remember, arr contains an "extra" position */
assert nominalLength > 0;
final long n = arr[nominalLength];
assert 0 <= pos;
assert pos < n;
final int l = 0;
final int r = nom... | [
"public",
"static",
"int",
"chunkContainingPos",
"(",
"final",
"long",
"[",
"]",
"arr",
",",
"final",
"long",
"pos",
")",
"{",
"final",
"int",
"nominalLength",
"=",
"arr",
".",
"length",
"-",
"1",
";",
"/* remember, arr contains an \"extra\" position */",
"asser... | This is written in terms of a plain array to facilitate testing.
@param arr the chunk containing the position
@param pos the position
@return the index of the chunk containing the position | [
"This",
"is",
"written",
"in",
"terms",
"of",
"a",
"plain",
"array",
"to",
"facilitate",
"testing",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuantilesHelper.java#L46-L60 |
55,046 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/AnotB.java | AnotB.getResult | public CompactSketch<S> getResult() {
if (count_ == 0) {
return new CompactSketch<S>(null, null, theta_, isEmpty_);
}
final CompactSketch<S> result =
new CompactSketch<S>(Arrays.copyOfRange(keys_, 0, count_),
Arrays.copyOfRange(summaries_, 0, count_), theta_, isEmpty_);
reset()... | java | public CompactSketch<S> getResult() {
if (count_ == 0) {
return new CompactSketch<S>(null, null, theta_, isEmpty_);
}
final CompactSketch<S> result =
new CompactSketch<S>(Arrays.copyOfRange(keys_, 0, count_),
Arrays.copyOfRange(summaries_, 0, count_), theta_, isEmpty_);
reset()... | [
"public",
"CompactSketch",
"<",
"S",
">",
"getResult",
"(",
")",
"{",
"if",
"(",
"count_",
"==",
"0",
")",
"{",
"return",
"new",
"CompactSketch",
"<",
"S",
">",
"(",
"null",
",",
"null",
",",
"theta_",
",",
"isEmpty_",
")",
";",
"}",
"final",
"Comp... | Gets the result of this operation
@return the result of this operation as a CompactSketch | [
"Gets",
"the",
"result",
"of",
"this",
"operation"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/AnotB.java#L74-L83 |
55,047 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsUtil.java | ItemsUtil.validateValues | static final <T> void validateValues(final T[] values, final Comparator<? super T> comparator) {
final int lenM1 = values.length - 1;
for (int j = 0; j < lenM1; j++) {
if ((values[j] != null) && (values[j + 1] != null)
&& (comparator.compare(values[j], values[j + 1]) < 0)) {
continue;
... | java | static final <T> void validateValues(final T[] values, final Comparator<? super T> comparator) {
final int lenM1 = values.length - 1;
for (int j = 0; j < lenM1; j++) {
if ((values[j] != null) && (values[j + 1] != null)
&& (comparator.compare(values[j], values[j + 1]) < 0)) {
continue;
... | [
"static",
"final",
"<",
"T",
">",
"void",
"validateValues",
"(",
"final",
"T",
"[",
"]",
"values",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"final",
"int",
"lenM1",
"=",
"values",
".",
"length",
"-",
"1",
";",
... | Checks the sequential validity of the given array of values.
They must be unique, monotonically increasing and not null.
@param <T> the data type
@param values given array of values
@param comparator the comparator for data type T | [
"Checks",
"the",
"sequential",
"validity",
"of",
"the",
"given",
"array",
"of",
"values",
".",
"They",
"must",
"be",
"unique",
"monotonically",
"increasing",
"and",
"not",
"null",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUtil.java#L49-L59 |
55,048 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PairTable.java | PairTable.rebuild | PairTable rebuild(final int newLgSizeInts) {
checkLgSizeInts(newLgSizeInts);
final int newSize = 1 << newLgSizeInts;
final int oldSize = 1 << lgSizeInts;
rtAssert(newSize > numPairs);
final int[] oldSlotsArr = slotsArr;
slotsArr = new int[newSize];
Arrays.fill(slotsArr, -1);
lgSizeInts =... | java | PairTable rebuild(final int newLgSizeInts) {
checkLgSizeInts(newLgSizeInts);
final int newSize = 1 << newLgSizeInts;
final int oldSize = 1 << lgSizeInts;
rtAssert(newSize > numPairs);
final int[] oldSlotsArr = slotsArr;
slotsArr = new int[newSize];
Arrays.fill(slotsArr, -1);
lgSizeInts =... | [
"PairTable",
"rebuild",
"(",
"final",
"int",
"newLgSizeInts",
")",
"{",
"checkLgSizeInts",
"(",
"newLgSizeInts",
")",
";",
"final",
"int",
"newSize",
"=",
"1",
"<<",
"newLgSizeInts",
";",
"final",
"int",
"oldSize",
"=",
"1",
"<<",
"lgSizeInts",
";",
"rtAsser... | Rebuilds to a larger size. NumItems and validBits remain unchanged.
@param newLgSizeInts the new size
@return a larger PairTable | [
"Rebuilds",
"to",
"a",
"larger",
"size",
".",
"NumItems",
"and",
"validBits",
"remain",
"unchanged",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PairTable.java#L99-L113 |
55,049 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PairTable.java | PairTable.unwrappingGetItems | static int[] unwrappingGetItems(final PairTable table, final int numPairs) {
if (numPairs < 1) { return null; }
final int[] slotsArr = table.slotsArr;
final int tableSize = 1 << table.lgSizeInts;
final int[] result = new int[numPairs];
int i = 0;
int l = 0;
int r = numPairs - 1;
// Spec... | java | static int[] unwrappingGetItems(final PairTable table, final int numPairs) {
if (numPairs < 1) { return null; }
final int[] slotsArr = table.slotsArr;
final int tableSize = 1 << table.lgSizeInts;
final int[] result = new int[numPairs];
int i = 0;
int l = 0;
int r = numPairs - 1;
// Spec... | [
"static",
"int",
"[",
"]",
"unwrappingGetItems",
"(",
"final",
"PairTable",
"table",
",",
"final",
"int",
"numPairs",
")",
"{",
"if",
"(",
"numPairs",
"<",
"1",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"[",
"]",
"slotsArr",
"=",
"table",
... | While extracting the items from a linear probing hashtable,
this will usually undo the wrap-around provided that the table
isn't too full. Experiments suggest that for sufficiently large tables
the load factor would have to be over 90 percent before this would fail frequently,
and even then the subsequent sort would fi... | [
"While",
"extracting",
"the",
"items",
"from",
"a",
"linear",
"probing",
"hashtable",
"this",
"will",
"usually",
"undo",
"the",
"wrap",
"-",
"around",
"provided",
"that",
"the",
"table",
"isn",
"t",
"too",
"full",
".",
"Experiments",
"suggest",
"that",
"for"... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PairTable.java#L222-L246 |
55,050 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PairTable.java | PairTable.introspectiveInsertionSort | static void introspectiveInsertionSort(final int[] a, final int l, final int r) {
final int length = (r - l) + 1;
long cost = 0;
final long costLimit = 8L * length;
for (int i = l + 1; i <= r; i++) {
int j = i;
final long v = a[i] & 0XFFFF_FFFFL; //v must be long
while ((j >= (l + 1)) ... | java | static void introspectiveInsertionSort(final int[] a, final int l, final int r) {
final int length = (r - l) + 1;
long cost = 0;
final long costLimit = 8L * length;
for (int i = l + 1; i <= r; i++) {
int j = i;
final long v = a[i] & 0XFFFF_FFFFL; //v must be long
while ((j >= (l + 1)) ... | [
"static",
"void",
"introspectiveInsertionSort",
"(",
"final",
"int",
"[",
"]",
"a",
",",
"final",
"int",
"l",
",",
"final",
"int",
"r",
")",
"{",
"final",
"int",
"length",
"=",
"(",
"r",
"-",
"l",
")",
"+",
"1",
";",
"long",
"cost",
"=",
"0",
";"... | In applications where the input array is already nearly sorted,
insertion sort runs in linear time with a very small constant.
This introspective version of insertion sort protects against
the quadratic cost of sorting bad input arrays.
It keeps track of how much work has been done, and if that exceeds a
constant times... | [
"In",
"applications",
"where",
"the",
"input",
"array",
"is",
"already",
"nearly",
"sorted",
"insertion",
"sort",
"runs",
"in",
"linear",
"time",
"with",
"a",
"very",
"small",
"constant",
".",
"This",
"introspective",
"version",
"of",
"insertion",
"sort",
"pro... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PairTable.java#L259-L298 |
55,051 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java | UniqueCountMap.update | public double update(final byte[] key, final byte[] identifier) {
if (key == null) { return Double.NaN; }
checkMethodKeySize(key);
if (identifier == null) { return getEstimate(key); }
final short coupon = (short) Map.coupon16(identifier);
final int baseMapIndex = maps_[0].findOrInsertKey(key);
... | java | public double update(final byte[] key, final byte[] identifier) {
if (key == null) { return Double.NaN; }
checkMethodKeySize(key);
if (identifier == null) { return getEstimate(key); }
final short coupon = (short) Map.coupon16(identifier);
final int baseMapIndex = maps_[0].findOrInsertKey(key);
... | [
"public",
"double",
"update",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"identifier",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"checkMethodKeySize",
"(",
"key",
")",
... | Updates the map with a given key and identifier and returns the estimate of the number of
unique identifiers encountered so far for the given key.
@param key the given key
@param identifier the given identifier for unique counting associated with the key
@return the estimate of the number of unique identifiers encounte... | [
"Updates",
"the",
"map",
"with",
"a",
"given",
"key",
"and",
"identifier",
"and",
"returns",
"the",
"estimate",
"of",
"the",
"number",
"of",
"unique",
"identifiers",
"encountered",
"so",
"far",
"for",
"the",
"given",
"key",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L111-L130 |
55,052 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java | UniqueCountMap.getEstimate | public double getEstimate(final byte[] key) {
if (key == null) { return Double.NaN; }
checkMethodKeySize(key);
final double est = maps_[0].getEstimate(key);
if (est >= 0.0) { return est; }
//key has been promoted
final int level = -(int)est;
final Map map = maps_[level];
return map.getEs... | java | public double getEstimate(final byte[] key) {
if (key == null) { return Double.NaN; }
checkMethodKeySize(key);
final double est = maps_[0].getEstimate(key);
if (est >= 0.0) { return est; }
//key has been promoted
final int level = -(int)est;
final Map map = maps_[level];
return map.getEs... | [
"public",
"double",
"getEstimate",
"(",
"final",
"byte",
"[",
"]",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"checkMethodKeySize",
"(",
"key",
")",
";",
"final",
"double",
"est",
"=",
"maps_"... | Retrieves the current estimate of unique count for a given key.
@param key given key
@return estimate of unique count so far | [
"Retrieves",
"the",
"current",
"estimate",
"of",
"unique",
"count",
"for",
"a",
"given",
"key",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L137-L146 |
55,053 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java | UniqueCountMap.getMemoryUsageBytes | public long getMemoryUsageBytes() {
long total = 0;
for (int i = 0; i < maps_.length; i++) {
if (maps_[i] != null) {
total += maps_[i].getMemoryUsageBytes();
}
}
return total;
} | java | public long getMemoryUsageBytes() {
long total = 0;
for (int i = 0; i < maps_.length; i++) {
if (maps_[i] != null) {
total += maps_[i].getMemoryUsageBytes();
}
}
return total;
} | [
"public",
"long",
"getMemoryUsageBytes",
"(",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"maps_",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"maps_",
"[",
"i",
"]",
"!=",
"null",
")",
"... | Returns total bytes used by all internal maps
@return total bytes used by all internal maps | [
"Returns",
"total",
"bytes",
"used",
"by",
"all",
"internal",
"maps"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L196-L204 |
55,054 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java | UniqueCountMap.getKeyMemoryUsageBytes | public long getKeyMemoryUsageBytes() {
long total = 0;
for (int i = 0; i < maps_.length; i++) {
if (maps_[i] != null) {
total += (long) (maps_[i].getActiveEntries()) * keySizeBytes_;
}
}
return total;
} | java | public long getKeyMemoryUsageBytes() {
long total = 0;
for (int i = 0; i < maps_.length; i++) {
if (maps_[i] != null) {
total += (long) (maps_[i].getActiveEntries()) * keySizeBytes_;
}
}
return total;
} | [
"public",
"long",
"getKeyMemoryUsageBytes",
"(",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"maps_",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"maps_",
"[",
"i",
"]",
"!=",
"null",
")",
... | Returns total bytes used for key storage
@return total bytes used for key storage | [
"Returns",
"total",
"bytes",
"used",
"for",
"key",
"storage"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L210-L218 |
55,055 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java | UniqueCountMap.getActiveMaps | int getActiveMaps() {
int levels = 0;
final int iMapsLen = maps_.length;
for (int i = 0; i < iMapsLen; i++) {
if (maps_[i] != null) { levels++; }
}
return levels;
} | java | int getActiveMaps() {
int levels = 0;
final int iMapsLen = maps_.length;
for (int i = 0; i < iMapsLen; i++) {
if (maps_[i] != null) { levels++; }
}
return levels;
} | [
"int",
"getActiveMaps",
"(",
")",
"{",
"int",
"levels",
"=",
"0",
";",
"final",
"int",
"iMapsLen",
"=",
"maps_",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iMapsLen",
";",
"i",
"++",
")",
"{",
"if",
"(",
"maps_",
"[",... | Returns the number of active internal maps so far.
Only the base map is initialized in the constructor, so this method would return 1.
As more keys are promoted up to higher level maps, the return value would grow until the
last level HLL map is allocated.
@return the number of active levels so far | [
"Returns",
"the",
"number",
"of",
"active",
"internal",
"maps",
"so",
"far",
".",
"Only",
"the",
"base",
"map",
"is",
"initialized",
"in",
"the",
"constructor",
"so",
"this",
"method",
"would",
"return",
"1",
".",
"As",
"more",
"keys",
"are",
"promoted",
... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L235-L242 |
55,056 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java | ConcurrentHeapThetaBuffer.propagateToSharedSketch | private boolean propagateToSharedSketch(final long hash) {
//noinspection StatementWithEmptyBody
while (localPropagationInProgress.get()) {
} //busy wait until previous propagation completed
localPropagationInProgress.set(true);
final boolean res = shared.propagate(localPropagationInProgress, null, ... | java | private boolean propagateToSharedSketch(final long hash) {
//noinspection StatementWithEmptyBody
while (localPropagationInProgress.get()) {
} //busy wait until previous propagation completed
localPropagationInProgress.set(true);
final boolean res = shared.propagate(localPropagationInProgress, null, ... | [
"private",
"boolean",
"propagateToSharedSketch",
"(",
"final",
"long",
"hash",
")",
"{",
"//noinspection StatementWithEmptyBody",
"while",
"(",
"localPropagationInProgress",
".",
"get",
"(",
")",
")",
"{",
"}",
"//busy wait until previous propagation completed",
"localPropa... | Propagates a single hash value to the shared sketch
@param hash to be propagated | [
"Propagates",
"a",
"single",
"hash",
"value",
"to",
"the",
"shared",
"sketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java#L162-L171 |
55,057 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java | ConcurrentHeapThetaBuffer.propagateToSharedSketch | private void propagateToSharedSketch() {
//noinspection StatementWithEmptyBody
while (localPropagationInProgress.get()) {
} //busy wait until previous propagation completed
final CompactSketch compactSketch = compact(propagateOrderedCompact, null);
localPropagationInProgress.set(true);
shared.p... | java | private void propagateToSharedSketch() {
//noinspection StatementWithEmptyBody
while (localPropagationInProgress.get()) {
} //busy wait until previous propagation completed
final CompactSketch compactSketch = compact(propagateOrderedCompact, null);
localPropagationInProgress.set(true);
shared.p... | [
"private",
"void",
"propagateToSharedSketch",
"(",
")",
"{",
"//noinspection StatementWithEmptyBody",
"while",
"(",
"localPropagationInProgress",
".",
"get",
"(",
")",
")",
"{",
"}",
"//busy wait until previous propagation completed",
"final",
"CompactSketch",
"compactSketch"... | Propagates the content of the buffer as a sketch to the shared sketch | [
"Propagates",
"the",
"content",
"of",
"the",
"buffer",
"as",
"a",
"sketch",
"to",
"the",
"shared",
"sketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java#L176-L187 |
55,058 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketchAccessor.java | DoublesSketchAccessor.countValidLevelsBelow | private int countValidLevelsBelow(final int tgtLvl) {
int count = 0;
long bitPattern = ds_.getBitPattern();
for (int i = 0; (i < tgtLvl) && (bitPattern > 0); ++i, bitPattern >>>= 1) {
if ((bitPattern & 1L) > 0L) {
++count;
}
}
return count;
// shorter implementation, testing... | java | private int countValidLevelsBelow(final int tgtLvl) {
int count = 0;
long bitPattern = ds_.getBitPattern();
for (int i = 0; (i < tgtLvl) && (bitPattern > 0); ++i, bitPattern >>>= 1) {
if ((bitPattern & 1L) > 0L) {
++count;
}
}
return count;
// shorter implementation, testing... | [
"private",
"int",
"countValidLevelsBelow",
"(",
"final",
"int",
"tgtLvl",
")",
"{",
"int",
"count",
"=",
"0",
";",
"long",
"bitPattern",
"=",
"ds_",
".",
"getBitPattern",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"(",
"i",
"<",
"tgtLvl",
... | Counts number of full levels in the sketch below tgtLvl. Useful for computing the level
offset in a compact sketch.
@param tgtLvl Target level in the sketch
@return Number of full levels in the sketch below tgtLvl | [
"Counts",
"number",
"of",
"full",
"levels",
"in",
"the",
"sketch",
"below",
"tgtLvl",
".",
"Useful",
"for",
"computing",
"the",
"level",
"offset",
"in",
"a",
"compact",
"sketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketchAccessor.java#L118-L131 |
55,059 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.checkFamilyID | static void checkFamilyID(final int familyID) {
final Family family = Family.idToFamily(familyID);
if (!family.equals(Family.QUANTILES)) {
throw new SketchesArgumentException(
"Possible corruption: Invalid Family: " + family.toString());
}
} | java | static void checkFamilyID(final int familyID) {
final Family family = Family.idToFamily(familyID);
if (!family.equals(Family.QUANTILES)) {
throw new SketchesArgumentException(
"Possible corruption: Invalid Family: " + family.toString());
}
} | [
"static",
"void",
"checkFamilyID",
"(",
"final",
"int",
"familyID",
")",
"{",
"final",
"Family",
"family",
"=",
"Family",
".",
"idToFamily",
"(",
"familyID",
")",
";",
"if",
"(",
"!",
"family",
".",
"equals",
"(",
"Family",
".",
"QUANTILES",
")",
")",
... | Checks the validity of the given family ID
@param familyID the given family ID | [
"Checks",
"the",
"validity",
"of",
"the",
"given",
"family",
"ID"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L225-L231 |
55,060 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.checkPreLongsFlagsCap | static boolean checkPreLongsFlagsCap(final int preambleLongs, final int flags, final long memCapBytes) {
final boolean empty = (flags & EMPTY_FLAG_MASK) > 0; //Preamble flags empty state
final int minPre = Family.QUANTILES.getMinPreLongs(); //1
final int maxPre = Family.QUANTILES.getMaxPreLongs(); //2
f... | java | static boolean checkPreLongsFlagsCap(final int preambleLongs, final int flags, final long memCapBytes) {
final boolean empty = (flags & EMPTY_FLAG_MASK) > 0; //Preamble flags empty state
final int minPre = Family.QUANTILES.getMinPreLongs(); //1
final int maxPre = Family.QUANTILES.getMaxPreLongs(); //2
f... | [
"static",
"boolean",
"checkPreLongsFlagsCap",
"(",
"final",
"int",
"preambleLongs",
",",
"final",
"int",
"flags",
",",
"final",
"long",
"memCapBytes",
")",
"{",
"final",
"boolean",
"empty",
"=",
"(",
"flags",
"&",
"EMPTY_FLAG_MASK",
")",
">",
"0",
";",
"//Pr... | Checks the consistency of the flag bits and the state of preambleLong and the memory
capacity and returns the empty state.
@param preambleLongs the size of preamble in longs
@param flags the flags field
@param memCapBytes the memory capacity
@return the value of the empty state | [
"Checks",
"the",
"consistency",
"of",
"the",
"flag",
"bits",
"and",
"the",
"state",
"of",
"preambleLong",
"and",
"the",
"memory",
"capacity",
"and",
"returns",
"the",
"empty",
"state",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L241-L256 |
55,061 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.checkHeapFlags | static void checkHeapFlags(final int flags) { //only used by checkPreLongsFlagsCap and test
final int allowedFlags =
READ_ONLY_FLAG_MASK | EMPTY_FLAG_MASK | COMPACT_FLAG_MASK | ORDERED_FLAG_MASK;
final int flagsMask = ~allowedFlags;
if ((flags & flagsMask) > 0) {
throw new SketchesArgumentExc... | java | static void checkHeapFlags(final int flags) { //only used by checkPreLongsFlagsCap and test
final int allowedFlags =
READ_ONLY_FLAG_MASK | EMPTY_FLAG_MASK | COMPACT_FLAG_MASK | ORDERED_FLAG_MASK;
final int flagsMask = ~allowedFlags;
if ((flags & flagsMask) > 0) {
throw new SketchesArgumentExc... | [
"static",
"void",
"checkHeapFlags",
"(",
"final",
"int",
"flags",
")",
"{",
"//only used by checkPreLongsFlagsCap and test",
"final",
"int",
"allowedFlags",
"=",
"READ_ONLY_FLAG_MASK",
"|",
"EMPTY_FLAG_MASK",
"|",
"COMPACT_FLAG_MASK",
"|",
"ORDERED_FLAG_MASK",
";",
"final... | Checks just the flags field of the preamble. Allowed flags are Read Only, Empty, Compact, and
ordered.
@param flags the flags field | [
"Checks",
"just",
"the",
"flags",
"field",
"of",
"the",
"preamble",
".",
"Allowed",
"flags",
"are",
"Read",
"Only",
"Empty",
"Compact",
"and",
"ordered",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L263-L271 |
55,062 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.checkIsCompactMemory | static boolean checkIsCompactMemory(final Memory srcMem) {
// only reading so downcast is ok
final int flags = extractFlags(srcMem);
final int compactFlags = READ_ONLY_FLAG_MASK | COMPACT_FLAG_MASK;
return (flags & compactFlags) > 0;
} | java | static boolean checkIsCompactMemory(final Memory srcMem) {
// only reading so downcast is ok
final int flags = extractFlags(srcMem);
final int compactFlags = READ_ONLY_FLAG_MASK | COMPACT_FLAG_MASK;
return (flags & compactFlags) > 0;
} | [
"static",
"boolean",
"checkIsCompactMemory",
"(",
"final",
"Memory",
"srcMem",
")",
"{",
"// only reading so downcast is ok",
"final",
"int",
"flags",
"=",
"extractFlags",
"(",
"srcMem",
")",
";",
"final",
"int",
"compactFlags",
"=",
"READ_ONLY_FLAG_MASK",
"|",
"COM... | Checks just the flags field of an input Memory object. Returns true for a compact
sketch, false for an update sketch. Does not perform additional checks, including sketch
family.
@param srcMem the source Memory containing a sketch
@return true if flags indicate a compact sketch, otherwise false | [
"Checks",
"just",
"the",
"flags",
"field",
"of",
"an",
"input",
"Memory",
"object",
".",
"Returns",
"true",
"for",
"a",
"compact",
"sketch",
"false",
"for",
"an",
"update",
"sketch",
".",
"Does",
"not",
"perform",
"additional",
"checks",
"including",
"sketch... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L280-L285 |
55,063 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.checkSplitPointsOrder | static final void checkSplitPointsOrder(final double[] values) {
if (values == null) {
throw new SketchesArgumentException("Values cannot be null.");
}
final int lenM1 = values.length - 1;
for (int j = 0; j < lenM1; j++) {
if (values[j] < values[j + 1]) { continue; }
throw new Sketches... | java | static final void checkSplitPointsOrder(final double[] values) {
if (values == null) {
throw new SketchesArgumentException("Values cannot be null.");
}
final int lenM1 = values.length - 1;
for (int j = 0; j < lenM1; j++) {
if (values[j] < values[j + 1]) { continue; }
throw new Sketches... | [
"static",
"final",
"void",
"checkSplitPointsOrder",
"(",
"final",
"double",
"[",
"]",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"throw",
"new",
"SketchesArgumentException",
"(",
"\"Values cannot be null.\"",
")",
";",
"}",
"final",
"int"... | Checks the sequential validity of the given array of double values.
They must be unique, monotonically increasing and not NaN.
@param values the given array of double values | [
"Checks",
"the",
"sequential",
"validity",
"of",
"the",
"given",
"array",
"of",
"double",
"values",
".",
"They",
"must",
"be",
"unique",
"monotonically",
"increasing",
"and",
"not",
"NaN",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L292-L302 |
55,064 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.computeRetainedItems | static int computeRetainedItems(final int k, final long n) {
final int bbCnt = computeBaseBufferItems(k, n);
final long bitPattern = computeBitPattern(k, n);
final int validLevels = computeValidLevels(bitPattern);
return bbCnt + (validLevels * k);
} | java | static int computeRetainedItems(final int k, final long n) {
final int bbCnt = computeBaseBufferItems(k, n);
final long bitPattern = computeBitPattern(k, n);
final int validLevels = computeValidLevels(bitPattern);
return bbCnt + (validLevels * k);
} | [
"static",
"int",
"computeRetainedItems",
"(",
"final",
"int",
"k",
",",
"final",
"long",
"n",
")",
"{",
"final",
"int",
"bbCnt",
"=",
"computeBaseBufferItems",
"(",
"k",
",",
"n",
")",
";",
"final",
"long",
"bitPattern",
"=",
"computeBitPattern",
"(",
"k",... | Returns the number of retained valid items in the sketch given k and n.
@param k the given configured k of the sketch
@param n the current number of items seen by the sketch
@return the number of retained items in the sketch given k and n. | [
"Returns",
"the",
"number",
"of",
"retained",
"valid",
"items",
"in",
"the",
"sketch",
"given",
"k",
"and",
"n",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L321-L326 |
55,065 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CpcCompression.java | CpcCompression.lowLevelCompressBytes | static int lowLevelCompressBytes(
final byte[] byteArray, // input
final int numBytesToEncode, // input, must be an int
final short[] encodingTable, // input
final int[] compressedWords) { // output
int nextWordIndex = 0;
long bitBuf = 0; // bits are packed into thi... | java | static int lowLevelCompressBytes(
final byte[] byteArray, // input
final int numBytesToEncode, // input, must be an int
final short[] encodingTable, // input
final int[] compressedWords) { // output
int nextWordIndex = 0;
long bitBuf = 0; // bits are packed into thi... | [
"static",
"int",
"lowLevelCompressBytes",
"(",
"final",
"byte",
"[",
"]",
"byteArray",
",",
"// input",
"final",
"int",
"numBytesToEncode",
",",
"// input, must be an int",
"final",
"short",
"[",
"]",
"encodingTable",
",",
"// input",
"final",
"int",
"[",
"]",
"... | It is the caller's responsibility to ensure that the compressedWords array is long enough. | [
"It",
"is",
"the",
"caller",
"s",
"responsibility",
"to",
"ensure",
"that",
"the",
"compressedWords",
"array",
"is",
"long",
"enough",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L137-L177 |
55,066 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CpcCompression.java | CpcCompression.uncompressTheSurprisingValues | private static int[] uncompressTheSurprisingValues(final CompressedState source) {
final int srcK = 1 << source.lgK;
final int numPairs = source.numCsv;
assert numPairs > 0;
final int[] pairs = new int[numPairs];
final int numBaseBits = CpcCompression.golombChooseNumberOfBaseBits(srcK + numPairs, nu... | java | private static int[] uncompressTheSurprisingValues(final CompressedState source) {
final int srcK = 1 << source.lgK;
final int numPairs = source.numCsv;
assert numPairs > 0;
final int[] pairs = new int[numPairs];
final int numBaseBits = CpcCompression.golombChooseNumberOfBaseBits(srcK + numPairs, nu... | [
"private",
"static",
"int",
"[",
"]",
"uncompressTheSurprisingValues",
"(",
"final",
"CompressedState",
"source",
")",
"{",
"final",
"int",
"srcK",
"=",
"1",
"<<",
"source",
".",
"lgK",
";",
"final",
"int",
"numPairs",
"=",
"source",
".",
"numCsv",
";",
"a... | the length of this array is known to the source sketch. | [
"the",
"length",
"of",
"this",
"array",
"is",
"known",
"to",
"the",
"source",
"sketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L510-L518 |
55,067 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CpcCompression.java | CpcCompression.trickyGetPairsFromWindow | private static int[] trickyGetPairsFromWindow(final byte[] window, final int k, final int numPairsToGet,
final int emptySpace) {
final int outputLength = emptySpace + numPairsToGet;
final int[] pairs = new int[outputLength];
int rowIndex = 0;
int pairIndex = emptySpace;
for (rowIndex = 0; rowI... | java | private static int[] trickyGetPairsFromWindow(final byte[] window, final int k, final int numPairsToGet,
final int emptySpace) {
final int outputLength = emptySpace + numPairsToGet;
final int[] pairs = new int[outputLength];
int rowIndex = 0;
int pairIndex = emptySpace;
for (rowIndex = 0; rowI... | [
"private",
"static",
"int",
"[",
"]",
"trickyGetPairsFromWindow",
"(",
"final",
"byte",
"[",
"]",
"window",
",",
"final",
"int",
"k",
",",
"final",
"int",
"numPairsToGet",
",",
"final",
"int",
"emptySpace",
")",
"{",
"final",
"int",
"outputLength",
"=",
"e... | will be filled in later by the caller. | [
"will",
"be",
"filled",
"in",
"later",
"by",
"the",
"caller",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L540-L557 |
55,068 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CpcCompression.java | CpcCompression.compressHybridFlavor | private static void compressHybridFlavor(final CompressedState target, final CpcSketch source) {
final int srcK = 1 << source.lgK;
final PairTable srcPairTable = source.pairTable;
final int srcNumPairs = srcPairTable.getNumPairs();
final int[] srcPairArr = PairTable.unwrappingGetItems(srcPairTable, srcN... | java | private static void compressHybridFlavor(final CompressedState target, final CpcSketch source) {
final int srcK = 1 << source.lgK;
final PairTable srcPairTable = source.pairTable;
final int srcNumPairs = srcPairTable.getNumPairs();
final int[] srcPairArr = PairTable.unwrappingGetItems(srcPairTable, srcN... | [
"private",
"static",
"void",
"compressHybridFlavor",
"(",
"final",
"CompressedState",
"target",
",",
"final",
"CpcSketch",
"source",
")",
"{",
"final",
"int",
"srcK",
"=",
"1",
"<<",
"source",
".",
"lgK",
";",
"final",
"PairTable",
"srcPairTable",
"=",
"source... | of a Pinned sketch before compressing it. Hence the name Hybrid. | [
"of",
"a",
"Pinned",
"sketch",
"before",
"compressing",
"it",
".",
"Hence",
"the",
"name",
"Hybrid",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L561-L589 |
55,069 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CpcCompression.java | CpcCompression.compressSlidingFlavor | private static void compressSlidingFlavor(final CompressedState target, final CpcSketch source) {
compressTheWindow(target, source);
final PairTable srcPairTable = source.pairTable;
final int numPairs = srcPairTable.getNumPairs();
if (numPairs > 0) {
final int[] pairs = PairTable.unwrappingGetI... | java | private static void compressSlidingFlavor(final CompressedState target, final CpcSketch source) {
compressTheWindow(target, source);
final PairTable srcPairTable = source.pairTable;
final int numPairs = srcPairTable.getNumPairs();
if (numPairs > 0) {
final int[] pairs = PairTable.unwrappingGetI... | [
"private",
"static",
"void",
"compressSlidingFlavor",
"(",
"final",
"CompressedState",
"target",
",",
"final",
"CpcSketch",
"source",
")",
"{",
"compressTheWindow",
"(",
"target",
",",
"source",
")",
";",
"final",
"PairTable",
"srcPairTable",
"=",
"source",
".",
... | Complicated by the existence of both a left fringe and a right fringe. | [
"Complicated",
"by",
"the",
"existence",
"of",
"both",
"a",
"left",
"fringe",
"and",
"a",
"right",
"fringe",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L673-L709 |
55,070 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.update | public void update(final float value) {
if (Float.isNaN(value)) { return; }
if (isEmpty()) {
minValue_ = value;
maxValue_ = value;
} else {
if (value < minValue_) { minValue_ = value; }
if (value > maxValue_) { maxValue_ = value; }
}
if (levels_[0] == 0) {
compressWhile... | java | public void update(final float value) {
if (Float.isNaN(value)) { return; }
if (isEmpty()) {
minValue_ = value;
maxValue_ = value;
} else {
if (value < minValue_) { minValue_ = value; }
if (value > maxValue_) { maxValue_ = value; }
}
if (levels_[0] == 0) {
compressWhile... | [
"public",
"void",
"update",
"(",
"final",
"float",
"value",
")",
"{",
"if",
"(",
"Float",
".",
"isNaN",
"(",
"value",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"minValue_",
"=",
"value",
";",
"maxValue_",
"=",
"... | Updates this sketch with the given data item.
@param value an item from a stream of items. NaNs are ignored. | [
"Updates",
"this",
"sketch",
"with",
"the",
"given",
"data",
"item",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L328-L346 |
55,071 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.merge | public void merge(final KllFloatsSketch other) {
if ((other == null) || other.isEmpty()) { return; }
if (m_ != other.m_) {
throw new SketchesArgumentException("incompatible M: " + m_ + " and " + other.m_);
}
final long finalN = n_ + other.n_;
for (int i = other.levels_[0]; i < other.levels_[1]... | java | public void merge(final KllFloatsSketch other) {
if ((other == null) || other.isEmpty()) { return; }
if (m_ != other.m_) {
throw new SketchesArgumentException("incompatible M: " + m_ + " and " + other.m_);
}
final long finalN = n_ + other.n_;
for (int i = other.levels_[0]; i < other.levels_[1]... | [
"public",
"void",
"merge",
"(",
"final",
"KllFloatsSketch",
"other",
")",
"{",
"if",
"(",
"(",
"other",
"==",
"null",
")",
"||",
"other",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"m_",
"!=",
"other",
".",
"m_",
")",
"{",... | Merges another sketch into this one.
@param other sketch to merge into this one | [
"Merges",
"another",
"sketch",
"into",
"this",
"one",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L352-L371 |
55,072 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.getQuantile | public float getQuantile(final double fraction) {
if (isEmpty()) { return Float.NaN; }
if (fraction == 0.0) { return minValue_; }
if (fraction == 1.0) { return maxValue_; }
if ((fraction < 0.0) || (fraction > 1.0)) {
throw new SketchesArgumentException("Fraction cannot be less than zero or greater... | java | public float getQuantile(final double fraction) {
if (isEmpty()) { return Float.NaN; }
if (fraction == 0.0) { return minValue_; }
if (fraction == 1.0) { return maxValue_; }
if ((fraction < 0.0) || (fraction > 1.0)) {
throw new SketchesArgumentException("Fraction cannot be less than zero or greater... | [
"public",
"float",
"getQuantile",
"(",
"final",
"double",
"fraction",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Float",
".",
"NaN",
";",
"}",
"if",
"(",
"fraction",
"==",
"0.0",
")",
"{",
"return",
"minValue_",
";",
"}",
"if",
... | Returns an approximation to the value of the data item
that would be preceded by the given fraction of a hypothetical sorted
version of the input stream so far.
<p>We note that this method has a fairly large overhead (microseconds instead of nanoseconds)
so it should not be called multiple times to get different quant... | [
"Returns",
"an",
"approximation",
"to",
"the",
"value",
"of",
"the",
"data",
"item",
"that",
"would",
"be",
"preceded",
"by",
"the",
"given",
"fraction",
"of",
"a",
"hypothetical",
"sorted",
"version",
"of",
"the",
"input",
"stream",
"so",
"far",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L411-L420 |
55,073 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.getKFromEpsilon | public static int getKFromEpsilon(final double epsilon, final boolean pmf) {
//Ensure that eps is >= than the lowest possible eps given MAX_K and pmf=false.
final double eps = max(epsilon, 4.7634E-5);
final double kdbl = pmf
? exp(log(2.446 / eps) / 0.9433)
: exp(log(2.296 / eps) / 0.9723);
... | java | public static int getKFromEpsilon(final double epsilon, final boolean pmf) {
//Ensure that eps is >= than the lowest possible eps given MAX_K and pmf=false.
final double eps = max(epsilon, 4.7634E-5);
final double kdbl = pmf
? exp(log(2.446 / eps) / 0.9433)
: exp(log(2.296 / eps) / 0.9723);
... | [
"public",
"static",
"int",
"getKFromEpsilon",
"(",
"final",
"double",
"epsilon",
",",
"final",
"boolean",
"pmf",
")",
"{",
"//Ensure that eps is >= than the lowest possible eps given MAX_K and pmf=false.",
"final",
"double",
"eps",
"=",
"max",
"(",
"epsilon",
",",
"4.76... | thousands of trials | [
"thousands",
"of",
"trials"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L653-L663 |
55,074 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.toByteArray | public byte[] toByteArray() {
final byte[] bytes = new byte[getSerializedSizeBytes()];
final boolean isSingleItem = n_ == 1;
bytes[PREAMBLE_INTS_BYTE] = (byte) (isEmpty() || isSingleItem ? PREAMBLE_INTS_SHORT : PREAMBLE_INTS_FULL);
bytes[SER_VER_BYTE] = isSingleItem ? serialVersionUID2 : serialVersionUI... | java | public byte[] toByteArray() {
final byte[] bytes = new byte[getSerializedSizeBytes()];
final boolean isSingleItem = n_ == 1;
bytes[PREAMBLE_INTS_BYTE] = (byte) (isEmpty() || isSingleItem ? PREAMBLE_INTS_SHORT : PREAMBLE_INTS_FULL);
bytes[SER_VER_BYTE] = isSingleItem ? serialVersionUID2 : serialVersionUI... | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"final",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"getSerializedSizeBytes",
"(",
")",
"]",
";",
"final",
"boolean",
"isSingleItem",
"=",
"n_",
"==",
"1",
";",
"bytes",
"[",
"PREAMBLE_... | Returns serialized sketch in a byte array form.
@return serialized sketch in a byte array form. | [
"Returns",
"serialized",
"sketch",
"in",
"a",
"byte",
"array",
"form",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L757-L793 |
55,075 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.heapify | public static KllFloatsSketch heapify(final Memory mem) {
final int preambleInts = mem.getByte(PREAMBLE_INTS_BYTE) & 0xff;
final int serialVersion = mem.getByte(SER_VER_BYTE) & 0xff;
final int family = mem.getByte(FAMILY_BYTE) & 0xff;
final int flags = mem.getByte(FLAGS_BYTE) & 0xff;
final int m = m... | java | public static KllFloatsSketch heapify(final Memory mem) {
final int preambleInts = mem.getByte(PREAMBLE_INTS_BYTE) & 0xff;
final int serialVersion = mem.getByte(SER_VER_BYTE) & 0xff;
final int family = mem.getByte(FAMILY_BYTE) & 0xff;
final int flags = mem.getByte(FLAGS_BYTE) & 0xff;
final int m = m... | [
"public",
"static",
"KllFloatsSketch",
"heapify",
"(",
"final",
"Memory",
"mem",
")",
"{",
"final",
"int",
"preambleInts",
"=",
"mem",
".",
"getByte",
"(",
"PREAMBLE_INTS_BYTE",
")",
"&",
"0xff",
";",
"final",
"int",
"serialVersion",
"=",
"mem",
".",
"getByt... | Heapify takes the sketch image in Memory and instantiates an on-heap sketch.
The resulting sketch will not retain any link to the source Memory.
@param mem a Memory image of a sketch.
<a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@return a heap-based sketch based on the given Memory | [
"Heapify",
"takes",
"the",
"sketch",
"image",
"in",
"Memory",
"and",
"instantiates",
"an",
"on",
"-",
"heap",
"sketch",
".",
"The",
"resulting",
"sketch",
"will",
"not",
"retain",
"any",
"link",
"to",
"the",
"source",
"Memory",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L802-L835 |
55,076 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.checkK | static void checkK(final int k) {
if ((k < MIN_K) || (k > MAX_K)) {
throw new SketchesArgumentException(
"K must be >= " + MIN_K + " and <= " + MAX_K + ": " + k);
}
} | java | static void checkK(final int k) {
if ((k < MIN_K) || (k > MAX_K)) {
throw new SketchesArgumentException(
"K must be >= " + MIN_K + " and <= " + MAX_K + ": " + k);
}
} | [
"static",
"void",
"checkK",
"(",
"final",
"int",
"k",
")",
"{",
"if",
"(",
"(",
"k",
"<",
"MIN_K",
")",
"||",
"(",
"k",
">",
"MAX_K",
")",
")",
"{",
"throw",
"new",
"SketchesArgumentException",
"(",
"\"K must be >= \"",
"+",
"MIN_K",
"+",
"\" and <= \"... | Checks the validity of the given value k
@param k must be greater than 7 and less than 65536. | [
"Checks",
"the",
"validity",
"of",
"the",
"given",
"value",
"k"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L845-L850 |
55,077 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java | KllFloatsSketch.compressWhileUpdating | private void compressWhileUpdating() {
final int level = findLevelToCompact();
// It is important to do add the new top level right here. Be aware that this operation
// grows the buffer and shifts the data and also the boundaries of the data and grows the
// levels array and increments numLevels_
... | java | private void compressWhileUpdating() {
final int level = findLevelToCompact();
// It is important to do add the new top level right here. Be aware that this operation
// grows the buffer and shifts the data and also the boundaries of the data and grows the
// levels array and increments numLevels_
... | [
"private",
"void",
"compressWhileUpdating",
"(",
")",
"{",
"final",
"int",
"level",
"=",
"findLevelToCompact",
"(",
")",
";",
"// It is important to do add the new top level right here. Be aware that this operation",
"// grows the buffer and shifts the data and also the boundaries of t... | It cannot be used while merging, while reducing k, or anything else. | [
"It",
"cannot",
"be",
"used",
"while",
"merging",
"while",
"reducing",
"k",
"or",
"anything",
"else",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L924-L975 |
55,078 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/UpdateDoublesSketch.java | UpdateDoublesSketch.compact | public CompactDoublesSketch compact(final WritableMemory dstMem) {
if (dstMem == null) {
return HeapCompactDoublesSketch.createFromUpdateSketch(this);
}
return DirectCompactDoublesSketch.createFromUpdateSketch(this, dstMem);
} | java | public CompactDoublesSketch compact(final WritableMemory dstMem) {
if (dstMem == null) {
return HeapCompactDoublesSketch.createFromUpdateSketch(this);
}
return DirectCompactDoublesSketch.createFromUpdateSketch(this, dstMem);
} | [
"public",
"CompactDoublesSketch",
"compact",
"(",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"if",
"(",
"dstMem",
"==",
"null",
")",
"{",
"return",
"HeapCompactDoublesSketch",
".",
"createFromUpdateSketch",
"(",
"this",
")",
";",
"}",
"return",
"DirectCompactD... | Returns a compact version of this sketch. If passing in a Memory object, the compact sketch
will use that direct memory; otherwise, an on-heap sketch will be returned.
@param dstMem An optional target memory to hold the sketch.
@return A compact version of this sketch | [
"Returns",
"a",
"compact",
"version",
"of",
"this",
"sketch",
".",
"If",
"passing",
"in",
"a",
"Memory",
"object",
"the",
"compact",
"sketch",
"will",
"use",
"that",
"direct",
"memory",
";",
"otherwise",
"an",
"on",
"-",
"heap",
"sketch",
"will",
"be",
"... | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/UpdateDoublesSketch.java#L55-L60 |
55,079 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.getInstance | public static <T> ItemsSketch<T> getInstance(final Comparator<? super T> comparator) {
return getInstance(PreambleUtil.DEFAULT_K, comparator);
} | java | public static <T> ItemsSketch<T> getInstance(final Comparator<? super T> comparator) {
return getInstance(PreambleUtil.DEFAULT_K, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"ItemsSketch",
"<",
"T",
">",
"getInstance",
"(",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"getInstance",
"(",
"PreambleUtil",
".",
"DEFAULT_K",
",",
"comparator",
")",
";",
... | Obtains a new instance of an ItemsSketch using the DEFAULT_K.
@param <T> type of item
@param comparator to compare items
@return a GenericQuantileSketch | [
"Obtains",
"a",
"new",
"instance",
"of",
"an",
"ItemsSketch",
"using",
"the",
"DEFAULT_K",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L125-L127 |
55,080 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.getInstance | public static <T> ItemsSketch<T> getInstance(final int k, final Comparator<? super T> comparator) {
final ItemsSketch<T> qs = new ItemsSketch<>(k, comparator);
final int bufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important
qs.n_ = 0;
qs.combinedBufferItemCapacity_ = bufAlloc;
qs.c... | java | public static <T> ItemsSketch<T> getInstance(final int k, final Comparator<? super T> comparator) {
final ItemsSketch<T> qs = new ItemsSketch<>(k, comparator);
final int bufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important
qs.n_ = 0;
qs.combinedBufferItemCapacity_ = bufAlloc;
qs.c... | [
"public",
"static",
"<",
"T",
">",
"ItemsSketch",
"<",
"T",
">",
"getInstance",
"(",
"final",
"int",
"k",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"final",
"ItemsSketch",
"<",
"T",
">",
"qs",
"=",
"new",
"Items... | Obtains a new instance of an ItemsSketch.
@param <T> type of item
@param k Parameter that controls space usage of sketch and accuracy of estimates.
Must be greater than 2 and less than 65536 and a power of 2.
@param comparator to compare items
@return a GenericQuantileSketch | [
"Obtains",
"a",
"new",
"instance",
"of",
"an",
"ItemsSketch",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L137-L148 |
55,081 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.getInstance | public static <T> ItemsSketch<T> getInstance(final Memory srcMem,
final Comparator<? super T> comparator,
final ArrayOfItemsSerDe<T> serDe) {
final long memCapBytes = srcMem.getCapacity();
if (memCapBytes < 8) {
... | java | public static <T> ItemsSketch<T> getInstance(final Memory srcMem,
final Comparator<? super T> comparator,
final ArrayOfItemsSerDe<T> serDe) {
final long memCapBytes = srcMem.getCapacity();
if (memCapBytes < 8) {
... | [
"public",
"static",
"<",
"T",
">",
"ItemsSketch",
"<",
"T",
">",
"getInstance",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
",",
"final",
"ArrayOfItemsSerDe",
"<",
"T",
">",
"serDe",
")",
"{",
... | Heapifies the given srcMem, which must be a Memory image of a ItemsSketch
@param <T> type of item
@param srcMem a Memory image of a sketch.
<a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@param comparator to compare items
@param serDe an instance of ArrayOfItemsSerDe
@return a ItemsSketch on the Java... | [
"Heapifies",
"the",
"given",
"srcMem",
"which",
"must",
"be",
"a",
"Memory",
"image",
"of",
"a",
"ItemsSketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L159-L205 |
55,082 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.copy | static <T> ItemsSketch<T> copy(final ItemsSketch<T> sketch) {
final ItemsSketch<T> qsCopy = ItemsSketch.getInstance(sketch.k_, sketch.comparator_);
qsCopy.n_ = sketch.n_;
qsCopy.minValue_ = sketch.getMinValue();
qsCopy.maxValue_ = sketch.getMaxValue();
qsCopy.combinedBufferItemCapacity_ = sketch.get... | java | static <T> ItemsSketch<T> copy(final ItemsSketch<T> sketch) {
final ItemsSketch<T> qsCopy = ItemsSketch.getInstance(sketch.k_, sketch.comparator_);
qsCopy.n_ = sketch.n_;
qsCopy.minValue_ = sketch.getMinValue();
qsCopy.maxValue_ = sketch.getMaxValue();
qsCopy.combinedBufferItemCapacity_ = sketch.get... | [
"static",
"<",
"T",
">",
"ItemsSketch",
"<",
"T",
">",
"copy",
"(",
"final",
"ItemsSketch",
"<",
"T",
">",
"sketch",
")",
"{",
"final",
"ItemsSketch",
"<",
"T",
">",
"qsCopy",
"=",
"ItemsSketch",
".",
"getInstance",
"(",
"sketch",
".",
"k_",
",",
"sk... | Returns a copy of the given sketch
@param <T> the data type
@param sketch the given sketch
@return a copy of the given sketch | [
"Returns",
"a",
"copy",
"of",
"the",
"given",
"sketch"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L213-L224 |
55,083 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.update | public void update(final T dataItem) {
// this method only uses the base buffer part of the combined buffer
if (dataItem == null) { return; }
if ((maxValue_ == null) || (comparator_.compare(dataItem, maxValue_) > 0)) { maxValue_ = dataItem; }
if ((minValue_ == null) || (comparator_.compare(dataItem, mi... | java | public void update(final T dataItem) {
// this method only uses the base buffer part of the combined buffer
if (dataItem == null) { return; }
if ((maxValue_ == null) || (comparator_.compare(dataItem, maxValue_) > 0)) { maxValue_ = dataItem; }
if ((minValue_ == null) || (comparator_.compare(dataItem, mi... | [
"public",
"void",
"update",
"(",
"final",
"T",
"dataItem",
")",
"{",
"// this method only uses the base buffer part of the combined buffer",
"if",
"(",
"dataItem",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"(",
"maxValue_",
"==",
"null",
")",
"||",
... | Updates this sketch with the given double data item
@param dataItem an item from a stream of items. NaNs are ignored. | [
"Updates",
"this",
"sketch",
"with",
"the",
"given",
"double",
"data",
"item"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L230-L245 |
55,084 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.getQuantileUpperBound | public T getQuantileUpperBound(final double fraction) {
return getQuantile(min(1.0, fraction + Util.getNormalizedRankError(k_, false)));
} | java | public T getQuantileUpperBound(final double fraction) {
return getQuantile(min(1.0, fraction + Util.getNormalizedRankError(k_, false)));
} | [
"public",
"T",
"getQuantileUpperBound",
"(",
"final",
"double",
"fraction",
")",
"{",
"return",
"getQuantile",
"(",
"min",
"(",
"1.0",
",",
"fraction",
"+",
"Util",
".",
"getNormalizedRankError",
"(",
"k_",
",",
"false",
")",
")",
")",
";",
"}"
] | Gets the upper bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%.
@param fraction the given normalized rank as a fraction
@return the upper bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%. R... | [
"Gets",
"the",
"upper",
"bound",
"of",
"the",
"value",
"interval",
"in",
"which",
"the",
"true",
"quantile",
"of",
"the",
"given",
"rank",
"exists",
"with",
"a",
"confidence",
"of",
"at",
"least",
"99%",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L282-L284 |
55,085 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.getQuantileLowerBound | public T getQuantileLowerBound(final double fraction) {
return getQuantile(max(0, fraction - Util.getNormalizedRankError(k_, false)));
} | java | public T getQuantileLowerBound(final double fraction) {
return getQuantile(max(0, fraction - Util.getNormalizedRankError(k_, false)));
} | [
"public",
"T",
"getQuantileLowerBound",
"(",
"final",
"double",
"fraction",
")",
"{",
"return",
"getQuantile",
"(",
"max",
"(",
"0",
",",
"fraction",
"-",
"Util",
".",
"getNormalizedRankError",
"(",
"k_",
",",
"false",
")",
")",
")",
";",
"}"
] | Gets the lower bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%.
@param fraction the given normalized rank as a fraction
@return the lower bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%. R... | [
"Gets",
"the",
"lower",
"bound",
"of",
"the",
"value",
"interval",
"in",
"which",
"the",
"true",
"quantile",
"of",
"the",
"given",
"rank",
"exists",
"with",
"a",
"confidence",
"of",
"at",
"least",
"99%",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L293-L295 |
55,086 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.reset | public void reset() {
n_ = 0;
combinedBufferItemCapacity_ = 2 * Math.min(DoublesSketch.MIN_K, k_); //the min is important
combinedBuffer_ = new Object[combinedBufferItemCapacity_];
baseBufferCount_ = 0;
bitPattern_ = 0;
minValue_ = null;
maxValue_ = null;
} | java | public void reset() {
n_ = 0;
combinedBufferItemCapacity_ = 2 * Math.min(DoublesSketch.MIN_K, k_); //the min is important
combinedBuffer_ = new Object[combinedBufferItemCapacity_];
baseBufferCount_ = 0;
bitPattern_ = 0;
minValue_ = null;
maxValue_ = null;
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"n_",
"=",
"0",
";",
"combinedBufferItemCapacity_",
"=",
"2",
"*",
"Math",
".",
"min",
"(",
"DoublesSketch",
".",
"MIN_K",
",",
"k_",
")",
";",
"//the min is important",
"combinedBuffer_",
"=",
"new",
"Object",
"["... | Resets this sketch to a virgin state, but retains the original value of k. | [
"Resets",
"this",
"sketch",
"to",
"a",
"virgin",
"state",
"but",
"retains",
"the",
"original",
"value",
"of",
"k",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L568-L576 |
55,087 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.downSample | public ItemsSketch<T> downSample(final int newK) {
final ItemsSketch<T> newSketch = ItemsSketch.getInstance(newK, comparator_);
ItemsMergeImpl.downSamplingMergeInto(this, newSketch);
return newSketch;
} | java | public ItemsSketch<T> downSample(final int newK) {
final ItemsSketch<T> newSketch = ItemsSketch.getInstance(newK, comparator_);
ItemsMergeImpl.downSamplingMergeInto(this, newSketch);
return newSketch;
} | [
"public",
"ItemsSketch",
"<",
"T",
">",
"downSample",
"(",
"final",
"int",
"newK",
")",
"{",
"final",
"ItemsSketch",
"<",
"T",
">",
"newSketch",
"=",
"ItemsSketch",
".",
"getInstance",
"(",
"newK",
",",
"comparator_",
")",
";",
"ItemsMergeImpl",
".",
"down... | From an existing sketch, this creates a new sketch that can have a smaller value of K.
The original sketch is not modified.
@param newK the new value of K that must be smaller than current value of K.
It is required that this.getK() = newK * 2^(nonnegative integer).
@return the new sketch. | [
"From",
"an",
"existing",
"sketch",
"this",
"creates",
"a",
"new",
"sketch",
"that",
"can",
"have",
"a",
"smaller",
"value",
"of",
"K",
".",
"The",
"original",
"sketch",
"is",
"not",
"modified",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L642-L646 |
55,088 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.putMemory | public void putMemory(final WritableMemory dstMem, final ArrayOfItemsSerDe<T> serDe) {
final byte[] byteArr = toByteArray(serDe);
final long memCap = dstMem.getCapacity();
if (memCap < byteArr.length) {
throw new SketchesArgumentException(
"Destination Memory not large enough: " + memCap + "... | java | public void putMemory(final WritableMemory dstMem, final ArrayOfItemsSerDe<T> serDe) {
final byte[] byteArr = toByteArray(serDe);
final long memCap = dstMem.getCapacity();
if (memCap < byteArr.length) {
throw new SketchesArgumentException(
"Destination Memory not large enough: " + memCap + "... | [
"public",
"void",
"putMemory",
"(",
"final",
"WritableMemory",
"dstMem",
",",
"final",
"ArrayOfItemsSerDe",
"<",
"T",
">",
"serDe",
")",
"{",
"final",
"byte",
"[",
"]",
"byteArr",
"=",
"toByteArray",
"(",
"serDe",
")",
";",
"final",
"long",
"memCap",
"=",
... | Puts the current sketch into the given Memory if there is sufficient space.
Otherwise, throws an error.
@param dstMem the given memory.
@param serDe an instance of ArrayOfItemsSerDe | [
"Puts",
"the",
"current",
"sketch",
"into",
"the",
"given",
"Memory",
"if",
"there",
"is",
"sufficient",
"space",
".",
"Otherwise",
"throws",
"an",
"error",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L663-L671 |
55,089 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.itemsArrayToCombinedBuffer | private void itemsArrayToCombinedBuffer(final T[] itemsArray) {
final int extra = 2; // space for min and max values
//Load min, max
minValue_ = itemsArray[0];
maxValue_ = itemsArray[1];
//Load base buffer
System.arraycopy(itemsArray, extra, combinedBuffer_, 0, baseBufferCount_);
//Load l... | java | private void itemsArrayToCombinedBuffer(final T[] itemsArray) {
final int extra = 2; // space for min and max values
//Load min, max
minValue_ = itemsArray[0];
maxValue_ = itemsArray[1];
//Load base buffer
System.arraycopy(itemsArray, extra, combinedBuffer_, 0, baseBufferCount_);
//Load l... | [
"private",
"void",
"itemsArrayToCombinedBuffer",
"(",
"final",
"T",
"[",
"]",
"itemsArray",
")",
"{",
"final",
"int",
"extra",
"=",
"2",
";",
"// space for min and max values",
"//Load min, max",
"minValue_",
"=",
"itemsArray",
"[",
"0",
"]",
";",
"maxValue_",
"... | Loads the Combined Buffer, min and max from the given items array.
The Combined Buffer is always in non-compact form and must be pre-allocated.
@param itemsArray the given items array | [
"Loads",
"the",
"Combined",
"Buffer",
"min",
"and",
"max",
"from",
"the",
"given",
"items",
"array",
".",
"The",
"Combined",
"Buffer",
"is",
"always",
"in",
"non",
"-",
"compact",
"form",
"and",
"must",
"be",
"pre",
"-",
"allocated",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L720-L741 |
55,090 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/HeapAnotB.java | HeapAnotB.scanAllAsearchB | private void scanAllAsearchB() {
final long[] scanAArr = a_.getCache();
final int arrLongsIn = scanAArr.length;
cache_ = new long[arrLongsIn];
for (int i = 0; i < arrLongsIn; i++ ) {
final long hashIn = scanAArr[i];
if ((hashIn <= 0L) || (hashIn >= thetaLong_)) { continue; }
final int ... | java | private void scanAllAsearchB() {
final long[] scanAArr = a_.getCache();
final int arrLongsIn = scanAArr.length;
cache_ = new long[arrLongsIn];
for (int i = 0; i < arrLongsIn; i++ ) {
final long hashIn = scanAArr[i];
if ((hashIn <= 0L) || (hashIn >= thetaLong_)) { continue; }
final int ... | [
"private",
"void",
"scanAllAsearchB",
"(",
")",
"{",
"final",
"long",
"[",
"]",
"scanAArr",
"=",
"a_",
".",
"getCache",
"(",
")",
";",
"final",
"int",
"arrLongsIn",
"=",
"scanAArr",
".",
"length",
";",
"cache_",
"=",
"new",
"long",
"[",
"arrLongsIn",
"... | Sketch A is either unordered compact or hash table | [
"Sketch",
"A",
"is",
"either",
"unordered",
"compact",
"or",
"hash",
"table"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapAnotB.java#L262-L273 |
55,091 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java | BoundsOnBinomialProportions.approximateLowerBoundOnP | public static double approximateLowerBoundOnP(final long n, final long k, final double numStdDevs) {
checkInputs(n, k);
if (n == 0) { return 0.0; } // the coin was never flipped, so we know nothing
else if (k == 0) { return 0.0; }
else if (k == 1) { return (exactLowerBoundOnPForKequalsOne(n, deltaOfNumS... | java | public static double approximateLowerBoundOnP(final long n, final long k, final double numStdDevs) {
checkInputs(n, k);
if (n == 0) { return 0.0; } // the coin was never flipped, so we know nothing
else if (k == 0) { return 0.0; }
else if (k == 1) { return (exactLowerBoundOnPForKequalsOne(n, deltaOfNumS... | [
"public",
"static",
"double",
"approximateLowerBoundOnP",
"(",
"final",
"long",
"n",
",",
"final",
"long",
"k",
",",
"final",
"double",
"numStdDevs",
")",
"{",
"checkInputs",
"(",
"n",
",",
"k",
")",
";",
"if",
"(",
"n",
"==",
"0",
")",
"{",
"return",
... | Computes lower bound of approximate Clopper-Pearson confidence interval for a binomial
proportion.
<p>Implementation Notes:<br>
The approximateLowerBoundOnP is defined with respect to the right tail of the binomial
distribution.</p>
<ul>
<li>We want to solve for the <i>p</i> for which sum<sub><i>j,k,n</i></sub>bino(<i... | [
"Computes",
"lower",
"bound",
"of",
"approximate",
"Clopper",
"-",
"Pearson",
"confidence",
"interval",
"for",
"a",
"binomial",
"proportion",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L93-L103 |
55,092 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java | BoundsOnBinomialProportions.approximateUpperBoundOnP | public static double approximateUpperBoundOnP(final long n, final long k, final double numStdDevs) {
checkInputs(n, k);
if (n == 0) { return 1.0; } // the coin was never flipped, so we know nothing
else if (k == n) { return 1.0; }
else if (k == (n - 1)) {
return (exactUpperBoundOnPForKequalsNminus... | java | public static double approximateUpperBoundOnP(final long n, final long k, final double numStdDevs) {
checkInputs(n, k);
if (n == 0) { return 1.0; } // the coin was never flipped, so we know nothing
else if (k == n) { return 1.0; }
else if (k == (n - 1)) {
return (exactUpperBoundOnPForKequalsNminus... | [
"public",
"static",
"double",
"approximateUpperBoundOnP",
"(",
"final",
"long",
"n",
",",
"final",
"long",
"k",
",",
"final",
"double",
"numStdDevs",
")",
"{",
"checkInputs",
"(",
"n",
",",
"k",
")",
";",
"if",
"(",
"n",
"==",
"0",
")",
"{",
"return",
... | Computes upper bound of approximate Clopper-Pearson confidence interval for a binomial
proportion.
<p>Implementation Notes:<br>
The approximateUpperBoundOnP is defined with respect to the left tail of the binomial
distribution.</p>
<ul>
<li>We want to solve for the <i>p</i> for which sum<sub><i>j,0,k</i></sub>bino(<i>... | [
"Computes",
"upper",
"bound",
"of",
"approximate",
"Clopper",
"-",
"Pearson",
"confidence",
"interval",
"for",
"a",
"binomial",
"proportion",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L128-L142 |
55,093 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java | BoundsOnBinomialProportions.erf_of_nonneg | private static double erf_of_nonneg(final double x) {
// The constants that appear below, formatted for easy checking against the book.
// a1 = 0.07052 30784
// a3 = 0.00927 05272
// a5 = 0.00027 65672
// a2 = 0.04228 20123
// a4 = 0.00015 20143
// a6 = 0.00004 30638
fi... | java | private static double erf_of_nonneg(final double x) {
// The constants that appear below, formatted for easy checking against the book.
// a1 = 0.07052 30784
// a3 = 0.00927 05272
// a5 = 0.00027 65672
// a2 = 0.04228 20123
// a4 = 0.00015 20143
// a6 = 0.00004 30638
fi... | [
"private",
"static",
"double",
"erf_of_nonneg",
"(",
"final",
"double",
"x",
")",
"{",
"// The constants that appear below, formatted for easy checking against the book.",
"// a1 = 0.07052 30784",
"// a3 = 0.00927 05272",
"// a5 = 0.00027 65672",
"// a2 = 0.04228 20123",
"/... | Abramowitz and Stegun formula 7.1.28, p. 88; Claims accuracy of about 7 decimal digits | [
"Abramowitz",
"and",
"Stegun",
"formula",
"7",
".",
"1",
".",
"28",
"p",
".",
"88",
";",
"Claims",
"accuracy",
"of",
"about",
"7",
"decimal",
"digits"
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L183-L214 |
55,094 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java | BoundsOnBinomialProportions.abramowitzStegunFormula26p5p22 | private static double abramowitzStegunFormula26p5p22(final double a, final double b,
final double yp) {
final double b2m1 = (2.0 * b) - 1.0;
final double a2m1 = (2.0 * a) - 1.0;
final double lambda = ((yp * yp) - 3.0) / 6.0;
final double htmp = (1.0 / a2m1) + (1.0 / b2m1);
final double h = 2.0... | java | private static double abramowitzStegunFormula26p5p22(final double a, final double b,
final double yp) {
final double b2m1 = (2.0 * b) - 1.0;
final double a2m1 = (2.0 * a) - 1.0;
final double lambda = ((yp * yp) - 3.0) / 6.0;
final double htmp = (1.0 / a2m1) + (1.0 / b2m1);
final double h = 2.0... | [
"private",
"static",
"double",
"abramowitzStegunFormula26p5p22",
"(",
"final",
"double",
"a",
",",
"final",
"double",
"b",
",",
"final",
"double",
"yp",
")",
"{",
"final",
"double",
"b2m1",
"=",
"(",
"2.0",
"*",
"b",
")",
"-",
"1.0",
";",
"final",
"doubl... | that the formula was typed in correctly. | [
"that",
"the",
"formula",
"was",
"typed",
"in",
"correctly",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L233-L246 |
55,095 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java | ReservoirItemsSketch.newInstance | public static <T> ReservoirItemsSketch<T> newInstance(final int k, final ResizeFactor rf) {
return new ReservoirItemsSketch<>(k, rf);
} | java | public static <T> ReservoirItemsSketch<T> newInstance(final int k, final ResizeFactor rf) {
return new ReservoirItemsSketch<>(k, rf);
} | [
"public",
"static",
"<",
"T",
">",
"ReservoirItemsSketch",
"<",
"T",
">",
"newInstance",
"(",
"final",
"int",
"k",
",",
"final",
"ResizeFactor",
"rf",
")",
"{",
"return",
"new",
"ReservoirItemsSketch",
"<>",
"(",
"k",
",",
"rf",
")",
";",
"}"
] | Construct a mergeable sampling sketch with up to k samples using a specified resize factor.
@param k Maximum size of sampling. Allocated size may be smaller until reservoir fills.
Unlike many sketches in this package, this value does <em>not</em> need to be a
power of 2.
@param rf <a href="{@docRoot}/resources/dict... | [
"Construct",
"a",
"mergeable",
"sampling",
"sketch",
"with",
"up",
"to",
"k",
"samples",
"using",
"a",
"specified",
"resize",
"factor",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L168-L170 |
55,096 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java | ReservoirItemsSketch.getSamples | @SuppressWarnings("unchecked")
public T[] getSamples() {
if (itemsSeen_ == 0) {
return null;
}
final Class<?> clazz = data_.get(0).getClass();
return data_.toArray((T[]) Array.newInstance(clazz, 0));
} | java | @SuppressWarnings("unchecked")
public T[] getSamples() {
if (itemsSeen_ == 0) {
return null;
}
final Class<?> clazz = data_.get(0).getClass();
return data_.toArray((T[]) Array.newInstance(clazz, 0));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"[",
"]",
"getSamples",
"(",
")",
"{",
"if",
"(",
"itemsSeen_",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"data_",
".",
"get",
... | Returns a copy of the items in the reservoir, or null if empty. The returned array length
may be smaller than the reservoir capacity.
<p>In order to allocate an array of generic type T, uses the class of the first item in
the array. This method method may throw an <tt>ArrayAssignmentException</tt> if the
reservoir sto... | [
"Returns",
"a",
"copy",
"of",
"the",
"items",
"in",
"the",
"reservoir",
"or",
"null",
"if",
"empty",
".",
"The",
"returned",
"array",
"length",
"may",
"be",
"smaller",
"than",
"the",
"reservoir",
"capacity",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L343-L351 |
55,097 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java | ReservoirItemsSketch.copy | @SuppressWarnings("unchecked")
ReservoirItemsSketch<T> copy() {
return new ReservoirItemsSketch<>(reservoirSize_, currItemsAlloc_,
itemsSeen_, rf_, (ArrayList<T>) data_.clone());
} | java | @SuppressWarnings("unchecked")
ReservoirItemsSketch<T> copy() {
return new ReservoirItemsSketch<>(reservoirSize_, currItemsAlloc_,
itemsSeen_, rf_, (ArrayList<T>) data_.clone());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"ReservoirItemsSketch",
"<",
"T",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"ReservoirItemsSketch",
"<>",
"(",
"reservoirSize_",
",",
"currItemsAlloc_",
",",
"itemsSeen_",
",",
"rf_",
",",
"(",
"ArrayList",
... | Used during union operations to ensure we do not overwrite an existing reservoir. Creates a
shallow copy of the reservoir.
@return A copy of the current sketch | [
"Used",
"during",
"union",
"operations",
"to",
"ensure",
"we",
"do",
"not",
"overwrite",
"an",
"existing",
"reservoir",
".",
"Creates",
"a",
"shallow",
"copy",
"of",
"the",
"reservoir",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L597-L601 |
55,098 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/Intersection.java | Intersection.intersect | public CompactSketch intersect(final Sketch a, final Sketch b) {
return intersect(a, b, true, null);
} | java | public CompactSketch intersect(final Sketch a, final Sketch b) {
return intersect(a, b, true, null);
} | [
"public",
"CompactSketch",
"intersect",
"(",
"final",
"Sketch",
"a",
",",
"final",
"Sketch",
"b",
")",
"{",
"return",
"intersect",
"(",
"a",
",",
"b",
",",
"true",
",",
"null",
")",
";",
"}"
] | Perform intersect set operation on the two given sketch arguments and return the result as an
ordered CompactSketch on the heap.
@param a The first sketch argument
@param b The second sketch argument
@return an ordered CompactSketch on the heap | [
"Perform",
"intersect",
"set",
"operation",
"on",
"the",
"two",
"given",
"sketch",
"arguments",
"and",
"return",
"the",
"result",
"as",
"an",
"ordered",
"CompactSketch",
"on",
"the",
"heap",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Intersection.java#L80-L82 |
55,099 | DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hll/DirectCouponList.java | DirectCouponList.newInstance | static DirectCouponList newInstance(final int lgConfigK, final TgtHllType tgtHllType,
final WritableMemory dstMem) {
insertPreInts(dstMem, LIST_PREINTS);
insertSerVer(dstMem);
insertFamilyId(dstMem);
insertLgK(dstMem, lgConfigK);
insertLgArr(dstMem, LG_INIT_LIST_SIZE);
insertFlags(dstMem, ... | java | static DirectCouponList newInstance(final int lgConfigK, final TgtHllType tgtHllType,
final WritableMemory dstMem) {
insertPreInts(dstMem, LIST_PREINTS);
insertSerVer(dstMem);
insertFamilyId(dstMem);
insertLgK(dstMem, lgConfigK);
insertLgArr(dstMem, LG_INIT_LIST_SIZE);
insertFlags(dstMem, ... | [
"static",
"DirectCouponList",
"newInstance",
"(",
"final",
"int",
"lgConfigK",
",",
"final",
"TgtHllType",
"tgtHllType",
",",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"insertPreInts",
"(",
"dstMem",
",",
"LIST_PREINTS",
")",
";",
"insertSerVer",
"(",
"dstMem... | Standard factory for new DirectCouponList.
This initializes the given WritableMemory.
@param lgConfigK the configured Lg K
@param tgtHllType the configured HLL target
@param dstMem the destination memory for the sketch.
@return a new DirectCouponList | [
"Standard",
"factory",
"for",
"new",
"DirectCouponList",
".",
"This",
"initializes",
"the",
"given",
"WritableMemory",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/DirectCouponList.java#L86-L97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.