Java Array Normalize normalize(final double[] doubles)

Here you can find the source of normalize(final double[] doubles)

Description

normalize

License

Open Source License

Declaration

public static void normalize(final double[] doubles) 

Method Source Code

//package com.java2s;
/**/*from  ww w  .j  a  v a 2 s  . co  m*/
 * Copyright? 2014-2016 LIST (Luxembourg Institute of Science and Technology), all right reserved.
 * Authorship : Olivier PARISOT, Yoanne DIDRY
 * Licensed under GNU General Public License version 3
 */

public class Main {
    public static void normalize(final double[] doubles) {
        final int len = doubles.length;
        double min = Double.MAX_VALUE;
        double max = Double.MIN_VALUE;
        for (int i = 0; i < len; i++) {
            if (doubles[i] < min)
                min = doubles[i];
            if (doubles[i] > max)
                max = doubles[i];
        }
        for (int i = 0; i < len; i++) {
            doubles[i] = (doubles[i] - min) / max;
        }
    }
}

Related

  1. normalize(double[][] matrix, double lower, double upper)
  2. normalize(double[][] result)
  3. normalize(double[][] X)
  4. normalize(final byte[] input, final int bit)
  5. normalize(final double[] a)
  6. normalize(final double[] fir)
  7. normalize(final double[] tab)
  8. normalize(final double[] vec)
  9. normalize(final double[] vector, final double[] minima, final double[] maxima)