List of usage examples for java.lang Float NEGATIVE_INFINITY
float NEGATIVE_INFINITY
To view the source code for java.lang Float NEGATIVE_INFINITY.
Click Source Link
From source file:Main.java
/** * Determines the minimum and maximum values in the <tt>array</tt>, ignoring any instances of <tt>noDataValue</tt>. * //from w w w. jav a2 s .co m * @param array * @param noDataValue * @return a <tt>float[]</tt> where [0]==minimum and [1]==maximum */ public static float[] minMax(float[] array, float noDataValue) { float[] ret = null; float min = Float.POSITIVE_INFINITY, max = Float.NEGATIVE_INFINITY; float val; for (int i = 0; i < array.length; i++) { val = array[i]; if (val != noDataValue) { min = (val < min) ? val : min; max = (val > max) ? val : max; } } if (!Float.isInfinite(min) & !Float.isInfinite(max)) { ret = new float[] { min, max }; } return ret; }
From source file:test.uk.co.modularaudio.util.audio.mvc.displayslider.TestMixdownMeterIntToFloatConverter.java
private void floatToIntTests(final MixdownMeterIntToFloatConverter intToFloatConverter) { final float[] testFloatVals = new float[] { 0.0f, -1.0f, -5.0f, -10.0f, -15.0f, -29.0f, -30.0f, -31.0f, -50.0f, -69.0f, -70.0f, -71.0f, -80.0f, -90.0f, -120.0f, // This should get rounded down to -INF since -90.0dB is the lowest value -1000.0f, Float.NEGATIVE_INFINITY }; for (final float f : testFloatVals) { final int sliderIntVal = intToFloatConverter.floatValueToSliderIntValue(null, f); if (f == Float.NEGATIVE_INFINITY) { log.debug("FloatToInt -Inf as int: " + sliderIntVal); } else {// w w w . ja v a 2 s .co m log.debug("FloatToInt " + MathFormatter.fastFloatPrint(f, 5, true) + " as int: " + sliderIntVal); } } }
From source file:uk.co.modularaudio.util.audio.controlinterpolation.SpringAndDamper24Interpolator.java
public SpringAndDamper24Interpolator() { curState.x = 0.0f;// ww w .jav a 2s. c om curState.v = 0.0f; this.lowerBound = Float.NEGATIVE_INFINITY; this.upperBound = Float.POSITIVE_INFINITY; deltaTimestep = INTEGRATION_TIMESTEP_FOR_48K; }
From source file:test.uk.co.modularaudio.util.audio.mvc.displayslider.TestMixdownSliderIntToFloatConverter.java
private void floatToIntTests(final MixdownSliderIntToFloatConverter intToFloatConverter) { final float[] testFloatVals = new float[] { 10.0f, 5.0f, 1.0f, 0.0f, -1.0f, -5.0f, -10.0f, -15.0f, -29.0f, -30.0f, -31.0f, -50.0f, -69.0f, -70.0f, -71.0f, -80.0f, -90.0f, -120.0f, // This should get rounded down to -INF since -90.0dB is the lowest value -1000.0f, Float.NEGATIVE_INFINITY }; for (final float f : testFloatVals) { final int sliderIntVal = intToFloatConverter.floatValueToSliderIntValue(null, f); if (f == Float.NEGATIVE_INFINITY) { log.debug("FloatToInt -Inf as int: " + sliderIntVal); } else {/* ww w . ja v a 2 s .c o m*/ log.debug("FloatToInt " + MathFormatter.fastFloatPrint(f, 5, true) + " as int: " + sliderIntVal); } } }
From source file:kishida.cnn.layers.MaxPoolingLayer.java
@Override public float[] backward(float[] in, float[] delta) { Arrays.fill(newDelta, 0);// ww w. j a va2 s . c o m IntStream.range(0, inputChannels).parallel().forEach(ch -> { for (int x = 0; x < outputWidth; ++x) { for (int y = 0; y < outputHeight; ++y) { float max = Float.NEGATIVE_INFINITY; int maxX = 0; int maxY = 0; for (int i = 0; i < size; ++i) { int xx = x * stride + i - size / 2; if (xx < 0 || xx >= inputWidth) { continue; } for (int j = 0; j < size; ++j) { int yy = y * stride + j - size / 2; if (yy < 0 || yy >= inputHeight) { continue; } float d = in[ch * inputWidth * inputHeight + xx * inputWidth + yy]; if (max < d) { max = d; maxX = xx; maxY = yy; } } } int chxy = ch * outputWidth * outputHeight + x * outputHeight + y; newDelta[ch * inputWidth * inputHeight + maxX * inputHeight + maxY] += delta[chxy]; } } }); return newDelta; }
From source file:uk.co.modularaudio.util.audio.controlinterpolation.SpringAndDamperDouble24Interpolator.java
public SpringAndDamperDouble24Interpolator() { curState.x = 0.0;//from www .j a va2s .c om curState.v = 0.0; this.lowerBound = Float.NEGATIVE_INFINITY; this.upperBound = Float.POSITIVE_INFINITY; deltaTimestep = INTEGRATION_TIMESTEP_FOR_48K; }
From source file:au.org.ala.delta.intkey.ui.RealInputDialog.java
@Override void handleBtnOKClicked() { String inputTxt = _txtInput.getText(); if (inputTxt.length() > 0) { try {//from w w w. j a v a 2 s. com _inputData = ParsingUtils.parseRealCharacterValue(inputTxt); setVisible(false); } catch (IllegalArgumentException ex) { JOptionPane.showMessageDialog(this, validationErrorMessage, validationErrorTitle, JOptionPane.ERROR_MESSAGE); } } else { // return a float range with negative infinity. This represents // "no values selected". _inputData = new FloatRange(Float.NEGATIVE_INFINITY); setVisible(false); } }
From source file:uk.co.modularaudio.mads.base.stereo_compressor.ui.SourceSignalAmpMeter.java
private Color getColorForDb(final float dbValue) { if (dbValue == Float.NEGATIVE_INFINITY) { return UNDER_THRESHOLD_COLOR; } else if (dbValue <= currentThresholdValueDb) { return UNDER_THRESHOLD_COLOR; } else if (dbValue > currentThresholdValueDb) { return OVER_THRESHOLD_COLOR; } else {// w w w . ja va2s. c o m return Color.ORANGE; } }
From source file:uk.co.modularaudio.mads.base.stereo_compressor.ui.OutSignalAmpMeter.java
private Color getColorForDb(final float dbValue) { if (dbValue == Float.NEGATIVE_INFINITY) { return Color.green; } else if (dbValue > ORANGE_THRESHOLD_DB) { return Color.RED; } else if (dbValue > GREEN_THRESHOLD_DB) { return Color.orange; } else {//from www . jav a2 s. co m return Color.green; } }
From source file:Main.java
/** * Determines the minimum and maximum values in the two dimensional array <tt>multi</tt>, ignoring any instances of <tt>noDataValue</tt> * .//from w w w.j a v a 2 s . c o m * * @param multi * @param noDataValue * @return a <tt>float[]</tt> where [0]==minimum and [1]==maximum */ public static float[] minMax(float[][] multi, float noDataValue) { float[] ret = null; float min = Float.POSITIVE_INFINITY, max = Float.NEGATIVE_INFINITY; float val; for (int i = 0; i < multi.length; i++) { for (int j = 0; j < multi[i].length; j++) { val = multi[i][j]; if (val != noDataValue) { min = (val < min) ? val : min; max = (val > max) ? val : max; } } } if (!Float.isInfinite(min) & !Float.isInfinite(max)) { ret = new float[] { min, max }; } return ret; }