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/01/29 23:22:11 UTC

[datasketches-java] 03/05: Update comments and code structure.

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch FixKllComments
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git

commit 2fc239f9a51231149fff18b2527a705aafc83a49
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Wed Jan 26 11:34:30 2022 -0800

    Update comments and code structure.
    
    Minor changes to KLL.toString() format.
---
 src/main/java/org/apache/datasketches/QuantilesHelper.java          | 2 +-
 .../org/apache/datasketches/kll/KllFloatsQuantileCalculator.java    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/QuantilesHelper.java b/src/main/java/org/apache/datasketches/QuantilesHelper.java
index 985f8fa..a1983a5 100644
--- a/src/main/java/org/apache/datasketches/QuantilesHelper.java
+++ b/src/main/java/org/apache/datasketches/QuantilesHelper.java
@@ -41,7 +41,7 @@ public class QuantilesHelper {
   }
 
   /**
-   * Returns the zero-based index (position) of a value in the hypothetical sorted stream of
+   * Returns the linear zero-based index (position) of a value in the hypothetical sorted stream of
    * values of size n.
    * @param phi the fractional position where: 0 &le; &#966; &le; 1.0.
    * @param n the size of the stream
diff --git a/src/main/java/org/apache/datasketches/kll/KllFloatsQuantileCalculator.java b/src/main/java/org/apache/datasketches/kll/KllFloatsQuantileCalculator.java
index c0fdf06..97f628e 100644
--- a/src/main/java/org/apache/datasketches/kll/KllFloatsQuantileCalculator.java
+++ b/src/main/java/org/apache/datasketches/kll/KllFloatsQuantileCalculator.java
@@ -54,8 +54,8 @@ final class KllFloatsQuantileCalculator {
     n_ = n;
     items_ = items;
     weights_ = weights; //must be size of items + 1
-    levels_ = null;  //not used
-    numLevels_ = 0;  //not used
+    levels_ = null;  //not used by test
+    numLevels_ = 0;  //not used by test
   }
 
   float getQuantile(final double phi) { //phi is normalized rank [0,1].
@@ -80,7 +80,7 @@ final class KllFloatsQuantileCalculator {
     while (srcLevel < numLevels) {
       final int fromIndex = srcLevels[srcLevel] - offset;
       final int toIndex = srcLevels[srcLevel + 1] - offset; // exclusive
-      if (fromIndex < toIndex) { // skip empty levels
+      if (fromIndex < toIndex) { // if equal, skip empty level
         Arrays.fill(weights_, fromIndex, toIndex, weight);
         levels_[dstLevel] = fromIndex;
         levels_[dstLevel + 1] = toIndex;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org