Java Array Normalize normalizeToInPlace(double[] in, double normsum)

Here you can find the source of normalizeToInPlace(double[] in, double normsum)

Description

normalize To In Place

License

Apache License

Declaration

public static final void normalizeToInPlace(double[] in, double normsum) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final void normalizeToInPlace(double[] in, double normsum) {
        double sum = 0;
        for (int i = 0; i < in.length; i++) {
            sum += in[i];/*from www  .j  ava 2  s  .  c  o  m*/
        }
        for (int i = 0; i < in.length; i++) {
            in[i] = normsum * in[i] / sum;
        }
    }
}

Related

  1. normalizeProb(double[] prob)
  2. normalizeRecorderColumn(int column, int tabSize, int[] tabIndices)
  3. normalizeRows(float[][] input)
  4. normalizeSpaces(char[] buf, int origStart, int origEnd)
  5. normalizeTo(float[] in, float normsum)
  6. normalizeToLogProbs(double[] x)
  7. normalizeToOne(double[] doubles)
  8. normalizeToSumUpTo(double[] x, double sumUp)
  9. normalizeTrimmedText(char[] ch)