Java Array Normalize normalizedBySum(double[] values)

Here you can find the source of normalizedBySum(double[] values)

Description

normalized By Sum

License

Open Source License

Declaration

public static double[] normalizedBySum(double[] values) 

Method Source Code

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

public class Main {
    public static double[] normalizedBySum(double[] values) {
        double[] normedValues = new double[values.length];
        double sum = 0.0;
        for (int k = 0; k < values.length; k++) {
            sum += values[k];/*from   w  ww  . j  av a  2 s.c  om*/
        }
        for (int k = 0; k < values.length; k++) {
            normedValues[k] = values[k] / sum;
        }
        return normedValues;
    }
}

Related

  1. normalizeCharacterData(char[] ch, int start, int length)
  2. normalizeComplexVectorsToUnitVectors(float[] complex)
  3. normalizeComponentsOverwrite(float[][][][] in)
  4. normalizeContingencyTable(final int[][] table)
  5. normalizeCoordsSum(float[] vector, float newSum)
  6. normalizedTermMu(double ui, double[] uis)
  7. normalizeFloatArray(float[] buffer, float peak, float target)
  8. normalizeForce(double[] data)
  9. normalizeFromLog10(double[] array)