Java Array Normalize normalize(double arr[])

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

Description

normalize

License

Open Source License

Declaration

public static double[] normalize(double arr[]) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double[] normalize(double arr[]) {
        double sum = fsum(arr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] / sum;/*from  www  . ja  v  a2  s  . co m*/
        }
        return arr;
    }

    public static double fsum(double arr[]) {
        double sum = 0.0;
        for (double val : arr) {
            sum += val;
        }
        return sum;
    }
}

Related

  1. normaliseFloats(final float[] table, final int position, final int length)
  2. normaliseHeaders(String[] headers)
  3. normaliseSum(double[] a)
  4. normaliseUnicode(String unicodeText, char[] mappings)
  5. normalize(byte[] data, byte maximum, byte minimum)
  6. normalize(double wheelSpeeds[])
  7. normalize(double[] a)
  8. normalize(double[] a)
  9. normalize(double[] a)