Java Utililty Methods Array Normalize

List of utility methods to do Array Normalize

Description

The list of methods to do Array Normalize are organized into topic(s).

Method

voidnormalize(double[] doubles)
Normalizes the doubles in the array by their sum.
double sum = 0;
for (int i = 0; i < doubles.length; i++) {
    sum += doubles[i];
normalize(doubles, sum);
voidnormalize(double[] doubles)
Normalizes the doubles in the array by their sum.
normalize(doubles, sum(doubles));
double[]normalize(double[] doubles)
normalize
double sum = 0;
for (double d : doubles) {
    sum += d;
for (int i = 0; i < doubles.length; i++) {
    doubles[i] /= sum;
return doubles;
...
voidnormalize(double[] doubles, double sum)
normalize
if (Double.isNaN(sum)) {
    throw new IllegalArgumentException("Can't normalize array. Sum is NaN.");
if (sum == 0) {
    throw new IllegalArgumentException("Can't normalize array. Sum is zero.");
for (int i = 0; i < doubles.length; i++) {
    doubles[i] /= sum;
...
voidnormalize(double[] doubles, double sum)
Normalizes the doubles in the array using the given value.
if (Double.isNaN(sum)) {
    throw new IllegalArgumentException("Can't normalize array. Sum is NaN.");
if (sum == 0) {
    throw new IllegalArgumentException("Can't normalize array. Sum is zero.");
for (int i = 0; i < doubles.length; i++) {
    doubles[i] /= sum;
...
double[]normalize(double[] in)
Complexity: O( 2 * N ) Should in contain only one unique number, this method return an array of 0's
double min = Double.POSITIVE_INFINITY, max = Double.NEGATIVE_INFINITY;
for (double val : in) {
    if (val > max)
        max = val;
    if (val < min)
        min = val;
return normalize(in, min, max);
...
voidnormalize(double[] in)
normalize
double maxsample = 0;
for (int i = 0; i < in.length; i++) {
    maxsample = Math.max(maxsample, Math.abs(in[i]));
if (maxsample >= 0.01) {
    for (int i = 0; i < in.length; i++) {
        in[i] = in[i] / maxsample;
double[]normalize(double[] point, double[] uni, double[] unideltas)
normalize
double[] normPoint = new double[point.length];
for (int i = 0; i < normPoint.length; i++) {
    normPoint[i] = (point[i] - uni[i]) / unideltas[i];
return normPoint;
double[]normalize(double[] points)
Normalizes a vector
double length = length(points);
for (int i = 0; i < points.length; i++) {
    points[i] = points[i] / length;
return points;
double[]normalize(double[] probDist)
normalize
int len = probDist.length;
double total = 0.0;
for (double d : probDist) {
    total = total + d;
double[] normalized = new double[len];
if (total != 0) {
    for (int i = 0; i < len; i++) {
...