use of org.apache.datasketches.theta.UpdateSketch in project sketches-core by DataSketches.
the class CornerCaseTupleSetOperationsTest method emptyExact.
@Test
public void emptyExact() {
IntegerSketch tupleA = getTupleSketch(SkType.EMPTY, 0, 0);
IntegerSketch tupleB = getTupleSketch(SkType.EXACT, 0, GT_MIDP_V);
UpdateSketch thetaB = getThetaSketch(SkType.EXACT, 0, GT_MIDP_V);
final double expectedIntersectTheta = 1.0;
final int expectedIntersectCount = 0;
final boolean expectedIntersectEmpty = true;
final double expectedAnotbTheta = 1.0;
final int expectedAnotbCount = 0;
final boolean expectedAnotbEmpty = true;
final double expectedUnionTheta = 1.0;
final int expectedUnionCount = 1;
final boolean expectedUnionEmpty = false;
checks(tupleA, tupleB, thetaB, expectedIntersectTheta, expectedIntersectCount, expectedIntersectEmpty, expectedAnotbTheta, expectedAnotbCount, expectedAnotbEmpty, expectedUnionTheta, expectedUnionCount, expectedUnionEmpty);
}
use of org.apache.datasketches.theta.UpdateSketch in project sketches-core by DataSketches.
the class CornerCaseTupleSetOperationsTest method estimationEmpty.
// =================================
@Test
public void estimationEmpty() {
IntegerSketch tupleA = getTupleSketch(SkType.ESTIMATION, LOWP_FLT, LT_LOWP_V);
IntegerSketch tupleB = getTupleSketch(SkType.EMPTY, 0, 0);
UpdateSketch thetaB = getThetaSketch(SkType.EMPTY, 0, 0);
final double expectedIntersectTheta = 1.0;
final int expectedIntersectCount = 0;
final boolean expectedIntersectEmpty = true;
final double expectedAnotbTheta = LOWP_FLT;
final int expectedAnotbCount = 1;
final boolean expectedAnotbEmpty = false;
final double expectedUnionTheta = LOWP_FLT;
final int expectedUnionCount = 1;
final boolean expectedUnionEmpty = false;
checks(tupleA, tupleB, thetaB, expectedIntersectTheta, expectedIntersectCount, expectedIntersectEmpty, expectedAnotbTheta, expectedAnotbCount, expectedAnotbEmpty, expectedUnionTheta, expectedUnionCount, expectedUnionEmpty);
}
use of org.apache.datasketches.theta.UpdateSketch in project sketches-core by DataSketches.
the class CornerCaseTupleSetOperationsTest method degenerateDegenerate.
@Test
public void degenerateDegenerate() {
// entries = 0
IntegerSketch tupleA = getTupleSketch(SkType.DEGENERATE, MIDP_FLT, GT_MIDP_V);
IntegerSketch tupleB = getTupleSketch(SkType.DEGENERATE, LOWP_FLT, GT_LOWP_V);
UpdateSketch thetaB = getThetaSketch(SkType.DEGENERATE, LOWP_FLT, GT_LOWP_V);
final double expectedIntersectTheta = LOWP_FLT;
final int expectedIntersectCount = 0;
final boolean expectedIntersectEmpty = false;
final double expectedAnotbTheta = LOWP_FLT;
final int expectedAnotbCount = 0;
final boolean expectedAnotbEmpty = false;
final double expectedUnionTheta = LOWP_FLT;
final int expectedUnionCount = 0;
final boolean expectedUnionEmpty = false;
checks(tupleA, tupleB, thetaB, expectedIntersectTheta, expectedIntersectCount, expectedIntersectEmpty, expectedAnotbTheta, expectedAnotbCount, expectedAnotbEmpty, expectedUnionTheta, expectedUnionCount, expectedUnionEmpty);
}
use of org.apache.datasketches.theta.UpdateSketch in project sketches-core by DataSketches.
the class CornerCaseTupleSetOperationsTest method degenerateExact.
@Test
public void degenerateExact() {
// entries = 0
IntegerSketch tupleA = getTupleSketch(SkType.DEGENERATE, LOWP_FLT, GT_LOWP_V);
IntegerSketch tupleB = getTupleSketch(SkType.EXACT, 0, LT_LOWP_V);
UpdateSketch thetaB = getThetaSketch(SkType.EXACT, 0, LT_LOWP_V);
final double expectedIntersectTheta = LOWP_FLT;
final int expectedIntersectCount = 0;
final boolean expectedIntersectEmpty = false;
final double expectedAnotbTheta = LOWP_FLT;
final int expectedAnotbCount = 0;
final boolean expectedAnotbEmpty = false;
final double expectedUnionTheta = LOWP_FLT;
final int expectedUnionCount = 1;
final boolean expectedUnionEmpty = false;
checks(tupleA, tupleB, thetaB, expectedIntersectTheta, expectedIntersectCount, expectedIntersectEmpty, expectedAnotbTheta, expectedAnotbCount, expectedAnotbEmpty, expectedUnionTheta, expectedUnionCount, expectedUnionEmpty);
}
use of org.apache.datasketches.theta.UpdateSketch in project sketches-core by DataSketches.
the class CornerCaseTupleSetOperationsTest method estimationEstimation.
@Test
public void estimationEstimation() {
IntegerSketch tupleA = getTupleSketch(SkType.ESTIMATION, MIDP_FLT, LT_LOWP_V);
IntegerSketch tupleB = getTupleSketch(SkType.ESTIMATION, LOWP_FLT, LT_LOWP_V);
UpdateSketch thetaB = getThetaSketch(SkType.ESTIMATION, LOWP_FLT, LT_LOWP_V);
final double expectedIntersectTheta = LOWP_FLT;
final int expectedIntersectCount = 1;
final boolean expectedIntersectEmpty = false;
final double expectedAnotbTheta = LOWP_FLT;
final int expectedAnotbCount = 0;
final boolean expectedAnotbEmpty = false;
final double expectedUnionTheta = LOWP_FLT;
final int expectedUnionCount = 1;
final boolean expectedUnionEmpty = false;
checks(tupleA, tupleB, thetaB, expectedIntersectTheta, expectedIntersectCount, expectedIntersectEmpty, expectedAnotbTheta, expectedAnotbCount, expectedAnotbEmpty, expectedUnionTheta, expectedUnionCount, expectedUnionEmpty);
}
Aggregations