use of uk.ac.sussex.gdsc.smlm.function.DummyGradientFunction in project GDSC-SMLM by aherbert.
the class LsqLvmGradientProcedureTest method gradientProcedureFactoryCreatesOptimisedProcedures.
@SeededTest
void gradientProcedureFactoryCreatesOptimisedProcedures() {
final double[] y = new double[0];
Assertions.assertEquals(LsqLvmGradientProcedureMatrixUtils.create(y, null, new DummyGradientFunction(6)).getClass(), LsqLvmGradientProcedureMatrix6.class);
Assertions.assertEquals(LsqLvmGradientProcedureMatrixUtils.create(y, null, new DummyGradientFunction(5)).getClass(), LsqLvmGradientProcedureMatrix5.class);
Assertions.assertEquals(LsqLvmGradientProcedureMatrixUtils.create(y, null, new DummyGradientFunction(4)).getClass(), LsqLvmGradientProcedureMatrix4.class);
Assertions.assertEquals(LsqLvmGradientProcedureLinearUtils.create(y, null, new DummyGradientFunction(6)).getClass(), LsqLvmGradientProcedureLinear6.class);
Assertions.assertEquals(LsqLvmGradientProcedureLinearUtils.create(y, null, new DummyGradientFunction(5)).getClass(), LsqLvmGradientProcedureLinear5.class);
Assertions.assertEquals(LsqLvmGradientProcedureLinearUtils.create(y, null, new DummyGradientFunction(4)).getClass(), LsqLvmGradientProcedureLinear4.class);
}
use of uk.ac.sussex.gdsc.smlm.function.DummyGradientFunction in project GDSC-SMLM by aherbert.
the class PoissonGradientProcedureTest method gradientProcedureFactoryCreatesOptimisedProcedures.
@SeededTest
void gradientProcedureFactoryCreatesOptimisedProcedures() {
Assertions.assertEquals(PoissonGradientProcedureUtils.create(new DummyGradientFunction(6)).getClass(), PoissonGradientProcedure6.class);
Assertions.assertEquals(PoissonGradientProcedureUtils.create(new DummyGradientFunction(5)).getClass(), PoissonGradientProcedure5.class);
Assertions.assertEquals(PoissonGradientProcedureUtils.create(new DummyGradientFunction(4)).getClass(), PoissonGradientProcedure4.class);
}
use of uk.ac.sussex.gdsc.smlm.function.DummyGradientFunction in project GDSC-SMLM by aherbert.
the class LvmGradientProcedureTest method gradientProcedureFactoryCreatesOptimisedProcedures.
@SeededTest
void gradientProcedureFactoryCreatesOptimisedProcedures() {
final DummyGradientFunction[] f = new DummyGradientFunction[7];
for (int i = 1; i < f.length; i++) {
f[i] = new DummyGradientFunction(i);
}
final LvmGradientProcedureUtils.Type mle = LvmGradientProcedureUtils.Type.MLE;
final LvmGradientProcedureUtils.Type wlsq = LvmGradientProcedureUtils.Type.WLSQ;
final LvmGradientProcedureUtils.Type lsq = LvmGradientProcedureUtils.Type.LSQ;
final LvmGradientProcedureUtils.Type fmle = LvmGradientProcedureUtils.Type.FAST_LOG_MLE;
final FastLog fl = getFastLog();
// @formatter:off
// Generic factory
final double[] y0 = new double[1];
final double[] y1 = new double[] { 1 };
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[6], lsq, fl).getClass(), LsqLvmGradientProcedure6.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[5], lsq, fl).getClass(), LsqLvmGradientProcedure5.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[4], lsq, fl).getClass(), LsqLvmGradientProcedure4.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[1], lsq, fl).getClass(), LsqLvmGradientProcedure.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[6], mle, fl).getClass(), MleLvmGradientProcedure6.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[5], mle, fl).getClass(), MleLvmGradientProcedure5.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[4], mle, fl).getClass(), MleLvmGradientProcedure4.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[1], mle, fl).getClass(), MleLvmGradientProcedure.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[6], mle, fl).getClass(), MleLvmGradientProcedureX6.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[5], mle, fl).getClass(), MleLvmGradientProcedureX5.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[4], mle, fl).getClass(), MleLvmGradientProcedureX4.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[1], mle, fl).getClass(), MleLvmGradientProcedureX.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[6], wlsq, fl).getClass(), WLsqLvmGradientProcedure6.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[5], wlsq, fl).getClass(), WLsqLvmGradientProcedure5.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[4], wlsq, fl).getClass(), WLsqLvmGradientProcedure4.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[1], wlsq, fl).getClass(), WLsqLvmGradientProcedure.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[6], fmle, fl).getClass(), FastLogMleLvmGradientProcedure6.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[5], fmle, fl).getClass(), FastLogMleLvmGradientProcedure5.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[4], fmle, fl).getClass(), FastLogMleLvmGradientProcedure4.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y0, f[1], fmle, fl).getClass(), FastLogMleLvmGradientProcedure.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[6], fmle, fl).getClass(), FastLogMleLvmGradientProcedureX6.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[5], fmle, fl).getClass(), FastLogMleLvmGradientProcedureX5.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[4], fmle, fl).getClass(), FastLogMleLvmGradientProcedureX4.class);
Assertions.assertEquals(LvmGradientProcedureUtils.create(y1, f[1], fmle, fl).getClass(), FastLogMleLvmGradientProcedureX.class);
// Dedicated factories
Assertions.assertEquals(LsqLvmGradientProcedureUtils.create(y0, f[6]).getClass(), LsqLvmGradientProcedure6.class);
Assertions.assertEquals(LsqLvmGradientProcedureUtils.create(y0, f[5]).getClass(), LsqLvmGradientProcedure5.class);
Assertions.assertEquals(LsqLvmGradientProcedureUtils.create(y0, f[4]).getClass(), LsqLvmGradientProcedure4.class);
Assertions.assertEquals(LsqLvmGradientProcedureUtils.create(y0, f[1]).getClass(), LsqLvmGradientProcedure.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[6]).getClass(), MleLvmGradientProcedure6.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[5]).getClass(), MleLvmGradientProcedure5.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[4]).getClass(), MleLvmGradientProcedure4.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[1]).getClass(), MleLvmGradientProcedure.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[6]).getClass(), MleLvmGradientProcedureX6.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[5]).getClass(), MleLvmGradientProcedureX5.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[4]).getClass(), MleLvmGradientProcedureX4.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[1]).getClass(), MleLvmGradientProcedureX.class);
Assertions.assertEquals(WLsqLvmGradientProcedureUtils.create(y0, null, f[6]).getClass(), WLsqLvmGradientProcedure6.class);
Assertions.assertEquals(WLsqLvmGradientProcedureUtils.create(y0, null, f[5]).getClass(), WLsqLvmGradientProcedure5.class);
Assertions.assertEquals(WLsqLvmGradientProcedureUtils.create(y0, null, f[4]).getClass(), WLsqLvmGradientProcedure4.class);
Assertions.assertEquals(WLsqLvmGradientProcedureUtils.create(y0, null, f[1]).getClass(), WLsqLvmGradientProcedure.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[6], fl).getClass(), FastLogMleLvmGradientProcedure6.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[5], fl).getClass(), FastLogMleLvmGradientProcedure5.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[4], fl).getClass(), FastLogMleLvmGradientProcedure4.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y0, f[1], fl).getClass(), FastLogMleLvmGradientProcedure.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[6], fl).getClass(), FastLogMleLvmGradientProcedureX6.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[5], fl).getClass(), FastLogMleLvmGradientProcedureX5.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[4], fl).getClass(), FastLogMleLvmGradientProcedureX4.class);
Assertions.assertEquals(MleLvmGradientProcedureUtils.create(y1, f[1], fl).getClass(), FastLogMleLvmGradientProcedureX.class);
// @formatter:on
}
use of uk.ac.sussex.gdsc.smlm.function.DummyGradientFunction in project GDSC-SMLM by aherbert.
the class WPoissonGradientProcedureTest method gradientProcedureFactoryCreatesOptimisedProcedures.
@SeededTest
void gradientProcedureFactoryCreatesOptimisedProcedures(RandomSeed seed) {
final double[] var = dataCache.computeIfAbsent(seed, WPoissonGradientProcedureTest::createData);
final double[] y = SimpleArrayUtils.newDoubleArray(var.length, 1);
Assertions.assertEquals(WPoissonGradientProcedureUtils.create(y, var, new DummyGradientFunction(6)).getClass(), WPoissonGradientProcedure6.class);
Assertions.assertEquals(WPoissonGradientProcedureUtils.create(y, var, new DummyGradientFunction(5)).getClass(), WPoissonGradientProcedure5.class);
Assertions.assertEquals(WPoissonGradientProcedureUtils.create(y, var, new DummyGradientFunction(4)).getClass(), WPoissonGradientProcedure4.class);
}
use of uk.ac.sussex.gdsc.smlm.function.DummyGradientFunction in project GDSC-SMLM by aherbert.
the class LsqVarianceGradientProcedureTest method gradientProcedureFactoryCreatesOptimisedProcedures.
@SeededTest
void gradientProcedureFactoryCreatesOptimisedProcedures() {
Assertions.assertEquals(LsqVarianceGradientProcedureUtils.create(new DummyGradientFunction(6)).getClass(), LsqVarianceGradientProcedure6.class);
Assertions.assertEquals(LsqVarianceGradientProcedureUtils.create(new DummyGradientFunction(5)).getClass(), LsqVarianceGradientProcedure5.class);
Assertions.assertEquals(LsqVarianceGradientProcedureUtils.create(new DummyGradientFunction(4)).getClass(), LsqVarianceGradientProcedure4.class);
}
Aggregations