use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.
the class ErfTest method checkErfxHasLowError.
private static void checkErfxHasLowError(RandomSeed seed, BaseErf erf, double expected) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final int range = 8;
double max = 0;
for (int xi = -range; xi <= range; xi++) {
for (int i = 0; i < 5; i++) {
final double x = xi + rg.nextDouble();
final double o = erf.erf(x);
final double e = org.apache.commons.math3.special.Erf.erf(x);
final double error = Math.abs(o - e);
if (max < error) {
max = error;
}
// logger.fine(FunctionUtils.getSupplier("x=%f, e=%f, o=%f, error=%f", x, e, o, error);
Assertions.assertTrue(error < expected);
}
}
logger.log(TestLogUtils.getRecord(Level.INFO, "erfx %s max error = %g", erf.name, max));
}
use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.
the class SumFilterTest method intBlockSumNxNInternalAndStripedBlockSumNxNInternalReturnSameResult.
@SeededTest
void intBlockSumNxNInternalAndStripedBlockSumNxNInternalReturnSameResult(RandomSeed seed) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final SumFilter filter = new SumFilter();
for (final int width : primes) {
for (final int height : primes) {
for (final int boxSize : boxSizes) {
intCompareBlockSumNxNInternalAndStripedBlockSumNxNInternal(rg, filter, width, height, boxSize);
}
}
}
}
use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.
the class SumFilterTest method intBlockSumNxNInternalAndRollingBlockSumNxNInternalReturnSameResult.
@SeededTest
void intBlockSumNxNInternalAndRollingBlockSumNxNInternalReturnSameResult(RandomSeed seed) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final SumFilter filter = new SumFilter();
for (final int width : primes) {
for (final int height : primes) {
for (final int boxSize : boxSizes) {
intCompareBlockSumNxNInternalAndRollingBlockSumNxNInternal(rg, filter, width, height, boxSize);
}
}
}
}
use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.
the class SumFilterTest method intRollingBlockSum3x3InternalAndRollingBlockSumNxNInternalReturnSameResult.
@SeededTest
public void intRollingBlockSum3x3InternalAndRollingBlockSumNxNInternalReturnSameResult(RandomSeed seed) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final SumFilter filter = new SumFilter();
for (final int width : primes) {
for (final int height : primes) {
intCompareRollingBlockSum3x3InternalAndRollingBlockSumNxNInternal(rg, filter, width, height);
}
}
}
use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.
the class SumFilterTest method floatStripedBlockSum3x3AndStripedBlockSumNxNReturnSameResult.
@SeededTest
void floatStripedBlockSum3x3AndStripedBlockSumNxNReturnSameResult(RandomSeed seed) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final SumFilter filter = new SumFilter();
for (final int width : primes) {
for (final int height : primes) {
floatCompareStripedBlockSum3x3AndStripedBlockSumNxN(rg, filter, width, height);
}
}
}
Aggregations