public void testComputeRangeDoubleArray() { final DoubleList array = TestHelper.createArray(new int[]{2, -3, 4, 5, -6, 7, 8, 9}); Range range = new Range(); Range.computeRangeDouble(array, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(-6, range.getMin(), 1e-10d); assertEquals(9, range.getMax(), 1e-10d); Range.computeRangeDouble(array, _validator, range, ProgressMonitor.NULL); assertEquals(-6, range.getMin(), 1e-10d); assertEquals(7, range.getMax(), 1e-10d); }
public void testComputeRangeGenericUInt() { final boolean unsigned = true; final int[] uInts = TestHelper.createUInts(new long[]{2, 4294967293L, 4, 5, 4294967290L, 7, 8, 9}); Range range = new Range(); Range.computeRangeGeneric(uInts, unsigned, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(2, range.getMin(), 1e-10d); assertEquals(4294967293L, range.getMax(), 1e-10d); Range.computeRangeGeneric(uInts, unsigned, _validator, range, ProgressMonitor.NULL); assertEquals(4, range.getMin(), 1e-10d); assertEquals(4294967290L, range.getMax(), 1e-10d); }
public void testLinearOptimization() { FXYSum fxyRaw = new FXYSum(FXYSum.FXY_LINEAR); FXYSum fxyOpt = new FXYSum.Linear(); testRawAgainstOptimized(fxyRaw, fxyOpt); }
public void testAggregatingRangeUShort() { final boolean unsigned = true; final short[] uShorts = TestHelper.createUShorts(new int[]{40, 20, 50, 30000, 40000, 50000}); final Range range = new Range(87, 100); range.aggregate(uShorts, unsigned, IndexValidator.TRUE, ProgressMonitor.NULL); assertEquals(20, range.getMin(), 1e-10); assertEquals(50000, range.getMax(), 1e-10); range.setMinMax(87, 100); range.aggregate(uShorts, unsigned, _validator, ProgressMonitor.NULL); assertEquals(40, range.getMin(), 1e-10); assertEquals(40000, range.getMax(), 1e-10); }
public void testAggregatingRangeUInt() { final boolean unsigned = true; final int[] uInts = TestHelper.createUInts(new long[]{40, 20, 50, 2000000000, 3000000000L, 3500000000L}); final Range range = new Range(87, 100); range.aggregate(uInts, unsigned, IndexValidator.TRUE, ProgressMonitor.NULL); assertEquals(20, range.getMin(), 1e-10); assertEquals(3500000000L, range.getMax(), 1e-10); range.setMinMax(87, 100); range.aggregate(uInts, unsigned, _validator, ProgressMonitor.NULL); assertEquals(40, range.getMin(), 1e-10); assertEquals(3000000000L, range.getMax(), 1e-10); }
public void testAggregatingRangeUByte() { final boolean unsigned = true; final byte[] uBytes = TestHelper.createUBytes(new short[]{40, 20, 50, 60, 200, 230}); final Range range = new Range(87, 100); range.aggregate(uBytes, unsigned, IndexValidator.TRUE, ProgressMonitor.NULL); assertEquals(20, range.getMin(), 1e-10); assertEquals(230, range.getMax(), 1e-10); range.setMinMax(87, 100); range.aggregate(uBytes, unsigned, _validator, ProgressMonitor.NULL); assertEquals(40, range.getMin(), 1e-10); assertEquals(200, range.getMax(), 1e-10); }
public void testAggregatingRangeDoubleArray() { final boolean unsigned = false; final DoubleList array = TestHelper.createArray(new int[]{2, -5, 7, 20, 40, 100}); final Range range = new Range(6, 15); range.aggregate(array, unsigned, IndexValidator.TRUE, ProgressMonitor.NULL); assertEquals(-5, range.getMin(), 1e-10); assertEquals(100, range.getMax(), 1e-10); range.setMinMax(6, 15); range.aggregate(array, unsigned, _validator, ProgressMonitor.NULL); assertEquals(2, range.getMin(), 1e-10); assertEquals(40, range.getMax(), 1e-10); }
public void testComputeRangeUShort() { final short[] uShorts = TestHelper.createUShorts(new int[]{2, 65533, 4, 5, 65530, 7, 8, 9}); Range range = new Range(); Range.computeRangeUShort(uShorts, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(2, range.getMin(), 1e-10d); assertEquals(65533, range.getMax(), 1e-10d); Range.computeRangeUShort(uShorts, _validator, range, ProgressMonitor.NULL); assertEquals(4, range.getMin(), 1e-10d); assertEquals(65530, range.getMax(), 1e-10d); }
public void testComputeRangeUInt() { final int[] uInts = TestHelper.createUInts(new long[]{2, 4294967293L, 4, 5, 4294967290L, 7, 8, 9}); Range range = new Range(); Range.computeRangeUInt(uInts, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(2, range.getMin(), 1e-10d); assertEquals(4294967293L, range.getMax(), 1e-10d); Range.computeRangeUInt(uInts, _validator, range, ProgressMonitor.NULL); assertEquals(4, range.getMin(), 1e-10d); assertEquals(4294967290L, range.getMax(), 1e-10d); }
public void testComputeRangeGenericUByte() { final boolean unsigned = true; final byte[] uBytes = TestHelper.createUBytes(new short[]{2, 253, 4, 5, 250, 7, 8, 9}); Range range = new Range(); Range.computeRangeGeneric(uBytes, unsigned, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(2, range.getMin(), 1e-10d); assertEquals(253, range.getMax(), 1e-10d); Range.computeRangeGeneric(uBytes, unsigned, _validator, range, ProgressMonitor.NULL); assertEquals(4, range.getMin(), 1e-10d); assertEquals(250, range.getMax(), 1e-10d); }
public void testComputeRangeGenericUShort() { final boolean unsigned = true; final short[] uShorts = TestHelper.createUShorts(new int[]{2, 65533, 4, 5, 65530, 7, 8, 9}); Range range = new Range(); Range.computeRangeGeneric(uShorts, unsigned, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(2, range.getMin(), 1e-10d); assertEquals(65533, range.getMax(), 1e-10d); Range.computeRangeGeneric(uShorts, unsigned, _validator, range, ProgressMonitor.NULL); assertEquals(4, range.getMin(), 1e-10d); assertEquals(65530, range.getMax(), 1e-10d); }
public void testComputeRangeGenericDoubleArray() { final boolean unsigned = false; final DoubleList array = TestHelper.createArray(new int[]{2, -3, 4, 5, -6, 7, 8, 9}); Range range = new Range(); Range.computeRangeGeneric(array, unsigned, IndexValidator.TRUE, range, ProgressMonitor.NULL); assertEquals(-6, range.getMin(), 1e-10d); assertEquals(9, range.getMax(), 1e-10d); Range.computeRangeGeneric(array, unsigned, _validator, range, ProgressMonitor.NULL); assertEquals(-6, range.getMin(), 1e-10d); assertEquals(7, range.getMax(), 1e-10d); } }
public void testInterpolation1D() { final double[] dimension = new double[]{0, 1}; final double[] values = new double[]{0, 1}; final LookupTable lut = new LookupTable(values, dimension); assertEquals(1, lut.getDimensionCount()); assertEquals(0.0, lut.getDimension(0).getMin(), 0.0); assertEquals(1.0, lut.getDimension(0).getMax(), 0.0); assertEquals(0.0, lut.getValue(0.0), 0.0); assertEquals(1.0, lut.getValue(1.0), 0.0); assertEquals(0.5, lut.getValue(0.5), 0.0); }
public void testCubicOptimization() { FXYSum fxyRaw = new FXYSum(FXYSum.FXY_CUBIC); FXYSum fxyOpt = new FXYSum.Cubic(); testRawAgainstOptimized(fxyRaw, fxyOpt); }
public void testQuadricOptimization() { FXYSum fxyRaw = new FXYSum(FXYSum.FXY_QUADRATIC); FXYSum fxyOpt = new FXYSum.Quadric(); testRawAgainstOptimized(fxyRaw, fxyOpt); }
public void testBiCubicOptimization() { FXYSum fxyRaw = new FXYSum(FXYSum.FXY_BI_CUBIC); FXYSum fxyOpt = new FXYSum.BiCubic(); testRawAgainstOptimized(fxyRaw, fxyOpt); }
public void testDoubleCopyTo() { final Array array = new Array.Double(new double[]{1, 2, 3, 4, 5}); final double[] dest = new double[3]; array.copyTo(1, dest, 0, 3); assertEquals(2.0, dest[0], 0.0); assertEquals(3.0, dest[1], 0.0); assertEquals(4.0, dest[2], 0.0); }
public void testBiQuadricOptimization() { FXYSum fxyRaw = new FXYSum(FXYSum.FXY_BI_QUADRATIC); FXYSum fxyOpt = new FXYSum.BiQuadric(); testRawAgainstOptimized(fxyRaw, fxyOpt); }
public void testFloatCopyTo() { final Array array = new Array.Float(new float[]{1, 2, 3, 4, 5}); final double[] dest = new double[3]; array.copyTo(1, dest, 0, 3); assertEquals(2.0, dest[0], 0.0); assertEquals(3.0, dest[1], 0.0); assertEquals(4.0, dest[2], 0.0); } }
public void testBiLinearOptimization() { FXYSum fxyRaw = new FXYSum(FXYSum.FXY_BI_LINEAR); FXYSum fxyOpt = new FXYSum.BiLinear(); testRawAgainstOptimized(fxyRaw, fxyOpt); }