yytInHfut commented on issue #395:
URL: 
https://github.com/apache/datasketches-cpp/issues/395#issuecomment-1754218186

   Thanks for your reply. 
   The Java code and results:
   
   ```java
   final static int  commonSizes = 50000;
       final static double[] DUM = new double[] {0};
   
       public static void main(String[] args) {
           for (int j = 0; j < 10; j++) {
               ArrayOfDoublesUpdatableSketch sketchA = new 
ArrayOfDoublesUpdatableSketchBuilder().setNominalEntries(1<<14).build();
               for (int i = 0; i < 2 * commonSizes; i++) {
                   sketchA.update(i , DUM);
               }
               ArrayOfDoublesUpdatableSketch sketchB = new 
ArrayOfDoublesUpdatableSketchBuilder().setNominalEntries(1<<14).build();
               for (int i = commonSizes; i < 3 * commonSizes; i++) {
                   sketchB.update(i, DUM);
               }
               System.out.println(sketchA);
               ArrayOfDoublesCompactSketch skA = sketchA.compact();
               ArrayOfDoublesCompactSketch skB = sketchB.compact();
               ArrayOfDoublesSetOperationBuilder builder = new 
ArrayOfDoublesSetOperationBuilder();
               ArrayOfDoublesIntersection intersection = 
builder.buildIntersection();
               long start = System.currentTimeMillis();
               intersection.intersect(skA, (a, b) -> a);
               intersection.intersect(skB, (a, b) -> a);
               ArrayOfDoublesCompactSketch result = intersection.getResult();
               System.out.println("iteration: " + j);
               System.out.println("common_size: " + commonSizes);
               System.out.println("run time: " + (System.currentTimeMillis() - 
start) + "ms");
               System.out.println("Intersection unique count estimate: " + 
result.getEstimate());
               System.out.println("Intersection unique count estimate lower 
bound 95% confidence: " + result.getLowerBound(2));
               System.out.println("Intersection unique count estimate upper 
bound 95% confidence: " + result.getUpperBound(2));
               System.out.println();
           }
       }
   ``` 
   Outputs:
   ```
   iteration: 9
   common_size: 50000
   run time: 2ms
   Intersection unique count estimate: 49500.199335479825
   Intersection unique count estimate lower bound 95% confidence: 
48801.65021039344
   Intersection unique count estimate upper bound 95% confidence: 
50208.70802304575
   ```
   
   ```
   iteration: 9
   common_size: 500000
   run time: 1ms
   Intersection unique count estimate: 501314.8477448015
   Intersection unique count estimate lower bound 95% confidence: 
492069.85049213597
   Intersection unique count estimate upper bound 95% confidence: 
510733.10167792573
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to