in src/main/java/org/apache/datasketches/characterization/fdt/FdtAccuracyProfile.java [138:174]
void doTrial() {
sketch.reset(); //reuse the same sketch
groupsGenerated = 0;
sketchUpdates = 0;
int xG, yU;
for (xG = minG; xG <= maxG; xG = (int)pwr2SeriesNext(gPPO, xG)) { //select major group
groupsGenerated += xG;
yU = (int) Math.round(getY(p1, slope, xG)); //compute target # uniques
for (int g = 1; g <= xG; g++) { //select the minor group
for (int u = minU; u <= yU; u++) { //create the minor group with yU unique variations
final String[] tuple =
{Integer.toString(xG), Integer.toString(g), Integer.toString(yU), Long.toHexString(vIn++)};
sketch.update(tuple);
sketchUpdates++;
}
}
}
//sketch has been fully updated
lastPost = sketch.getPostProcessor(new TestGroup(), sep);
final List<Group> gpList = lastPost.getGroupList(priKeyIndices, numStdDev, 0);
final Iterator<Group> itr = gpList.iterator();
while (itr.hasNext()) {
final Group gp = itr.next();
yU = Integer.parseInt(gp.getPrimaryKey().split(sepr)[2]); //true uniques
AccuracyStats q = qMap.get(yU); //get the q sketch for all priKeys with the same yU
if (q == null) {
q = new AccuracyStats(1 << lgQK, yU);
q.update(gp.getEstimate());
q.bytes = 1;
qMap.put(yU, q);
} else {
q.update(gp.getEstimate());
q.bytes++;
}
}
}