use of org.apache.datasketches.tuple.AnotB in project sketches-core by DataSketches.
the class AdoubleAnotBTest method aNotBNullEmptyCombinations.
/**
**************************************
*/
@Test
public void aNotBNullEmptyCombinations() {
final AnotB<DoubleSummary> aNotB = new AnotB<>();
// calling getResult() before calling update() should yield an empty set
final CompactSketch<DoubleSummary> result = aNotB.getResult(true);
results.set(0, true, 0.0, 0.0, 0.0).check(result);
final UpdatableSketch<Double, DoubleSummary> sketch = buildUpdatableTuple();
final UpdateSketch skTheta = buildUpdateTheta();
threeMethodsWithTheta(aNotB, null, null, null, results);
threeMethodsWithTheta(aNotB, sketch, null, null, results);
threeMethodsWithTheta(aNotB, null, sketch, null, results);
threeMethodsWithTheta(aNotB, sketch, sketch, null, results);
threeMethodsWithTheta(aNotB, null, null, skTheta, results);
threeMethodsWithTheta(aNotB, sketch, null, skTheta, results);
threeMethodsWithTheta(aNotB, null, sketch, skTheta, results);
threeMethodsWithTheta(aNotB, sketch, sketch, skTheta, results);
}
use of org.apache.datasketches.tuple.AnotB in project sketches-core by DataSketches.
the class AdoubleAnotBTest method aNotBExactOverlap.
@Test
public void aNotBExactOverlap() {
final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
sketchA.update(1, 1.0);
sketchA.update(1, 1.0);
sketchA.update(2, 1.0);
sketchA.update(2, 1.0);
final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
sketchB.update(2, 1.0);
sketchB.update(2, 1.0);
sketchB.update(3, 1.0);
sketchB.update(3, 1.0);
final UpdateSketch skThetaB = buildUpdateTheta();
skThetaB.update(2);
skThetaB.update(3);
final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(1, false, 1.0, 0.0, 2.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
}
use of org.apache.datasketches.tuple.AnotB in project sketches-core by DataSketches.
the class AdoubleAnotBTest method aNotBEmptyExact.
@Test
public void aNotBEmptyExact() {
final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
sketchB.update(1, 1.0);
sketchB.update(2, 1.0);
final UpdateSketch skThetaB = buildUpdateTheta();
skThetaB.update(1);
skThetaB.update(2);
final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(0, true, 0.0, 0.0, 0.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
}
use of org.apache.datasketches.tuple.AnotB in project sketches-core by DataSketches.
the class AdoubleAnotBTest method aNotBEstimationOverlapLargeB.
@Test
public void aNotBEstimationOverlapLargeB() {
final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
for (int i = 0; i < 10_000; i++) {
sketchA.update(i, 1.0);
}
final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
for (int i = 0; i < 100_000; i++) {
sketchB.update(i + 8000, 1.0);
}
final UpdateSketch skThetaB = buildUpdateTheta();
for (int i = 0; i < 100_000; i++) {
skThetaB.update(i + 8000);
}
final int expected = 8_000;
final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(376, false, expected, 0.1, 1.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
// same thing, but compact sketches
threeMethodsWithTheta(aNotB, sketchA.compact(), sketchB.compact(), skThetaB.compact(), results);
}
use of org.apache.datasketches.tuple.AnotB in project sketches-core by DataSketches.
the class AdoubleAnotBTest method aNotBEstimationOverlap.
@Test
public void aNotBEstimationOverlap() {
final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
for (int i = 0; i < 8192; i++) {
sketchA.update(i, 1.0);
}
final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
for (int i = 0; i < 4096; i++) {
sketchB.update(i, 1.0);
}
final UpdateSketch skThetaB = buildUpdateTheta();
for (int i = 0; i < 4096; i++) {
skThetaB.update(i);
}
final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(2123, false, 4096.0, 0.03, 1.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
// same thing, but compact sketches
threeMethodsWithTheta(aNotB, sketchA.compact(), sketchB.compact(), skThetaB.compact(), results);
}
Aggregations