Skip to content
Permalink
Browse files
enforce theta=1 for empty sketch
  • Loading branch information
AlexanderSaydakov committed Nov 19, 2021
1 parent e173172 commit a8e94b5d3a15db2147426bcb1cd86197ca6835b6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
@@ -139,7 +139,7 @@ public int getRetainedEntries(final boolean valid) { //always valid

@Override
public long getThetaLong() {
return wmem_.getLong(THETA_LONG);
return isEmpty() ? Long.MAX_VALUE : wmem_.getLong(THETA_LONG);
}

@Override
@@ -159,7 +159,7 @@ public int getRetainedEntries(final boolean valid) {

@Override
public long getThetaLong() {
return thetaLong_;
return empty_ ? Long.MAX_VALUE : thetaLong_;
}

@Override
@@ -162,7 +162,7 @@ public SummaryFactory<S> getSummaryFactory() {
* @return the value of theta as a double
*/
public double getTheta() {
return thetaLong_ / (double) Long.MAX_VALUE;
return getThetaLong() / (double) Long.MAX_VALUE;
}

/**
@@ -186,7 +186,7 @@ public double getTheta() {
* @return Theta as a long
*/
public long getThetaLong() {
return thetaLong_;
return isEmpty() ? Long.MAX_VALUE : thetaLong_;
}

@Override
@@ -179,7 +179,7 @@ public boolean isEstimationMode() {
* @return the value of theta as a double
*/
public double getTheta() {
return theta_ / (double) Long.MAX_VALUE;
return getThetaLong() / (double) Long.MAX_VALUE;
}

/**
@@ -201,7 +201,7 @@ public double getTheta() {
* @return the value of theta as a long
*/
long getThetaLong() {
return theta_;
return isEmpty() ? Long.MAX_VALUE : theta_;
}

abstract short getSeedHash();

0 comments on commit a8e94b5

Please sign in to comment.