Search in sources :

Example 1 with ClusteredDataGenerator

use of me.lemire.integercompression.synth.ClusteredDataGenerator in project RoaringBitmap by RoaringBitmap.

the class BenchmarkDataGenerator method generate.

static BenchmarkData generate(int param, int howMany, int smallType, int bigType) {
    IntegerDistribution ud = new UniformIntegerDistribution(new Well19937c(param + 17), Short.MIN_VALUE, Short.MAX_VALUE);
    ClusteredDataGenerator cd = new ClusteredDataGenerator();
    IntegerDistribution p = new UniformIntegerDistribution(new Well19937c(param + 123), SMALLEST_ARRAY, BIGGEST_ARRAY / param);
    BenchmarkContainer[] smalls = new BenchmarkContainer[howMany];
    BenchmarkContainer[] bigs = new BenchmarkContainer[howMany];
    for (int i = 0; i < howMany; i++) {
        int smallSize = p.sample();
        int bigSize = smallSize * param;
        short[] small = smallType == 0 ? generateUniform(ud, smallSize) : generateClustered(cd, smallSize);
        short[] big = bigType == 0 ? generateUniform(ud, bigSize) : generateClustered(cd, bigSize);
        smalls[i] = new BenchmarkContainer(small);
        bigs[i] = new BenchmarkContainer(big);
    }
    return new BenchmarkData(smalls, bigs);
}
Also used : IntegerDistribution(org.apache.commons.math3.distribution.IntegerDistribution) UniformIntegerDistribution(org.apache.commons.math3.distribution.UniformIntegerDistribution) Well19937c(org.apache.commons.math3.random.Well19937c) UniformIntegerDistribution(org.apache.commons.math3.distribution.UniformIntegerDistribution) ClusteredDataGenerator(me.lemire.integercompression.synth.ClusteredDataGenerator)

Example 2 with ClusteredDataGenerator

use of me.lemire.integercompression.synth.ClusteredDataGenerator in project RoaringBitmap by RoaringBitmap.

the class BenchmarkDataGenerator method generate.

static BenchmarkData generate(int param, int howMany, int smallType, int bigType) {
    IntegerDistribution ud = new UniformIntegerDistribution(new Well19937c(param + 17), Short.MIN_VALUE, Short.MAX_VALUE);
    ClusteredDataGenerator cd = new ClusteredDataGenerator();
    IntegerDistribution p = new UniformIntegerDistribution(new Well19937c(param + 123), SMALLEST_ARRAY, BIGGEST_ARRAY / param);
    BenchmarkContainer[] smalls = new BenchmarkContainer[howMany];
    BenchmarkContainer[] bigs = new BenchmarkContainer[howMany];
    for (int i = 0; i < howMany; i++) {
        int smallSize = p.sample();
        int bigSize = smallSize * param;
        short[] small = smallType == 0 ? generateUniform(ud, smallSize) : generateClustered(cd, smallSize);
        short[] big = bigType == 0 ? generateUniform(ud, bigSize) : generateClustered(cd, bigSize);
        smalls[i] = new BenchmarkContainer(small);
        bigs[i] = new BenchmarkContainer(big);
    }
    return new BenchmarkData(smalls, bigs);
}
Also used : IntegerDistribution(org.apache.commons.math3.distribution.IntegerDistribution) UniformIntegerDistribution(org.apache.commons.math3.distribution.UniformIntegerDistribution) Well19937c(org.apache.commons.math3.random.Well19937c) UniformIntegerDistribution(org.apache.commons.math3.distribution.UniformIntegerDistribution) ClusteredDataGenerator(me.lemire.integercompression.synth.ClusteredDataGenerator)

Aggregations

ClusteredDataGenerator (me.lemire.integercompression.synth.ClusteredDataGenerator)2 IntegerDistribution (org.apache.commons.math3.distribution.IntegerDistribution)2 UniformIntegerDistribution (org.apache.commons.math3.distribution.UniformIntegerDistribution)2 Well19937c (org.apache.commons.math3.random.Well19937c)2