You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2022/06/22 20:31:06 UTC
[datasketches-java] branch FixMethodName created (now c538b65d)
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a change to branch FixMethodName
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
at c538b65d Method name was incorrect and misleading.
This branch includes the following new commits:
new c538b65d Method name was incorrect and misleading.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
[datasketches-java] 01/01: Method name was incorrect and misleading.
Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch FixMethodName
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
commit c538b65dbd4d08a6de7417d59693e82563f0ff77
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Wed Jun 22 13:31:00 2022 -0700
Method name was incorrect and misleading.
---
src/main/java/org/apache/datasketches/Util.java | 2 +-
.../cpc/CompressionCharacterization.java | 4 ++--
.../apache/datasketches/cpc/MergingValidation.java | 6 +++---
.../datasketches/cpc/StreamingValidation.java | 4 ++--
.../java/org/apache/datasketches/UtilTest.java | 22 ++++++++++++++++------
5 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/Util.java b/src/main/java/org/apache/datasketches/Util.java
index 9ccb90c8..d24ada3e 100644
--- a/src/main/java/org/apache/datasketches/Util.java
+++ b/src/main/java/org/apache/datasketches/Util.java
@@ -610,7 +610,7 @@ public final class Util {
* @param logBase the desired base of the logarithms
* @return the next point in the power series.
*/
- public static double pwr2SeriesNextDouble(final int ppo, final double curPoint,
+ public static double powerSeriesNextDouble(final int ppo, final double curPoint,
final boolean roundToInt, final double logBase) {
final double cur = curPoint < 1.0 ? 1.0 : curPoint;
double gi = round(logBaseOfX(logBase, cur) * ppo ); //current generating index
diff --git a/src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java b/src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java
index 6391b7f6..21ff2899 100644
--- a/src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java
+++ b/src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java
@@ -23,7 +23,7 @@ import static org.apache.datasketches.Util.DEFAULT_UPDATE_SEED;
import static org.apache.datasketches.Util.ceilingIntPowerOf2;
import static org.apache.datasketches.Util.iGoldenU64;
import static org.apache.datasketches.Util.log2;
-import static org.apache.datasketches.Util.pwr2SeriesNextDouble;
+import static org.apache.datasketches.Util.powerSeriesNextDouble;
import static org.apache.datasketches.cpc.CompressedState.importFromMemory;
import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssert;
@@ -109,7 +109,7 @@ public class CompressionCharacterization {
final double lgT = (slope * log2(n)) + lgMaxT;
final int totTrials = Math.max(ceilingIntPowerOf2((int) Math.pow(2.0, lgT)), (1 << lgMinT));
doTrialsAtLgKAtN(lgK, n, totTrials);
- n = Math.round(pwr2SeriesNextDouble(uPPO, n, true, 2.0));
+ n = Math.round(powerSeriesNextDouble(uPPO, n, true, 2.0));
}
}
diff --git a/src/main/java/org/apache/datasketches/cpc/MergingValidation.java b/src/main/java/org/apache/datasketches/cpc/MergingValidation.java
index 3fe75ec7..9db16939 100644
--- a/src/main/java/org/apache/datasketches/cpc/MergingValidation.java
+++ b/src/main/java/org/apache/datasketches/cpc/MergingValidation.java
@@ -20,7 +20,7 @@
package org.apache.datasketches.cpc;
import static org.apache.datasketches.Util.iGoldenU64;
-import static org.apache.datasketches.Util.pwr2SeriesNextDouble;
+import static org.apache.datasketches.Util.powerSeriesNextDouble;
import static org.apache.datasketches.cpc.IconEstimator.getIconEstimate;
import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssert;
import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssertEquals;
@@ -93,9 +93,9 @@ public class MergingValidation {
long nB = 0;
while (nB <= limB) {
testMerging(lgKm, lgKa, lgKb, nA, nB);
- nB = Math.round(pwr2SeriesNextDouble(uPPO, nB, true, 2.0));
+ nB = Math.round(powerSeriesNextDouble(uPPO, nB, true, 2.0));
}
- nA = Math.round(pwr2SeriesNextDouble(uPPO, nA, true, 2.0));
+ nA = Math.round(powerSeriesNextDouble(uPPO, nA, true, 2.0));
}
}
diff --git a/src/main/java/org/apache/datasketches/cpc/StreamingValidation.java b/src/main/java/org/apache/datasketches/cpc/StreamingValidation.java
index cb97151c..0f0576d3 100644
--- a/src/main/java/org/apache/datasketches/cpc/StreamingValidation.java
+++ b/src/main/java/org/apache/datasketches/cpc/StreamingValidation.java
@@ -20,7 +20,7 @@
package org.apache.datasketches.cpc;
import static org.apache.datasketches.Util.iGoldenU64;
-import static org.apache.datasketches.Util.pwr2SeriesNextDouble;
+import static org.apache.datasketches.Util.powerSeriesNextDouble;
import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssertEquals;
import java.io.PrintStream;
@@ -80,7 +80,7 @@ public class StreamingValidation {
final long maxN = 64L * (1L << lgK); //1200
while (n < maxN) {
doTrialsAtLgKAtN(lgK, n);
- n = Math.round(pwr2SeriesNextDouble(ppoN, n, true, 2.0));
+ n = Math.round(powerSeriesNextDouble(ppoN, n, true, 2.0));
}
}
diff --git a/src/test/java/org/apache/datasketches/UtilTest.java b/src/test/java/org/apache/datasketches/UtilTest.java
index 4616d47f..931f6a71 100644
--- a/src/test/java/org/apache/datasketches/UtilTest.java
+++ b/src/test/java/org/apache/datasketches/UtilTest.java
@@ -54,7 +54,7 @@ import static org.apache.datasketches.Util.numberOfLeadingOnes;
import static org.apache.datasketches.Util.numberOfTrailingOnes;
import static org.apache.datasketches.Util.pwr2SeriesNext;
import static org.apache.datasketches.Util.pwr2SeriesPrev;
-import static org.apache.datasketches.Util.pwr2SeriesNextDouble;
+import static org.apache.datasketches.Util.powerSeriesNextDouble;
import static org.apache.datasketches.Util.startingSubMultiple;
import static org.apache.datasketches.Util.zeroPad;
import static org.testng.Assert.assertEquals;
@@ -388,21 +388,31 @@ public class UtilTest {
public void checkPwr2LawNext() {
int next = pwr2SeriesNext(2, 1);
Assert.assertEquals(next, 2);
+ next = pwr2SeriesNext(2, 2);
+ Assert.assertEquals(next, 3);
+ next = pwr2SeriesNext(2, 3);
+ Assert.assertEquals(next, 4);
+
next = pwr2SeriesNext(2, 0);
Assert.assertEquals(next, 1);
}
@Test
public void checkPwr2LawNextDouble() {
- double next = pwr2SeriesNextDouble(2, 1.0, true, 2.0);
+ double next = powerSeriesNextDouble(2, 1.0, true, 2.0);
Assert.assertEquals(next, 2.0, 0.0);
- next = pwr2SeriesNextDouble(2, 1.0, false, 2.0);
+ next = powerSeriesNextDouble(2, 2.0, true, 2.0);
+ Assert.assertEquals(next, 3.0, 0.0);
+ next = powerSeriesNextDouble(2, 3, true, 2.0);
+ Assert.assertEquals(next, 4.0, 0.0);
+
+ next = powerSeriesNextDouble(2, 1, false, 2.0);
Assert.assertEquals(next, Math.sqrt(2), 0.0);
- next = pwr2SeriesNextDouble(2, 0.5, true, 2.0);
+ next = powerSeriesNextDouble(2, 0.5, true, 2.0);
Assert.assertEquals(next, 2.0, 0.0);
- next = pwr2SeriesNextDouble(2, 0.5, false, 2.0);
+ next = powerSeriesNextDouble(2, 0.5, false, 2.0);
Assert.assertEquals(next, Math.sqrt(2), 0.0);
- next = pwr2SeriesNextDouble(2, next, false, 2.0);
+ next = powerSeriesNextDouble(2, next, false, 2.0);
Assert.assertEquals(next, 2.0, 0.0);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org