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(float[][] vals, float min, float max)
normalize
final float divider = max - min + 1;
for (int xx = 0; xx < vals.length; xx++) {
    for (int zz = 0; zz < vals[xx].length; zz++) {
        vals[xx][zz] = clamp(vals[xx][zz], min, max);
        vals[xx][zz] -= min;
        vals[xx][zz] /= divider;
int[]normalize(int[] a)
Normalize the sequence a by first shortening it to the shortest subsequence which when repeated yields a, and then finding the lexicographically largest of its shifts.
int len = a.length;
for (int i = 1; i < len; i++) 
    if (len % i == 0) {
        boolean cannot_be_cut = false;
        for (int j = 0; j < i; j++) {
            for (int k = 1; k < (len / i); k++) {
                if (a[j] != a[(j + i * k) % len]) {
...
float[]normalize(int[] values)
Normalizes an array of integers from the bounding [min,max] to [0.0, 1.0].
float[] normalized = new float[values.length];
int min = getMinValue(values);
int max = getMaxValue(values);
int spread = max - min;
if (spread == 0) {
    Arrays.fill(normalized, 1f);
    return normalized;
for (int i = 0; i < values.length; i++) {
    normalized[i] = (values[i] - min) / (float) spread;
return normalized;
voidnormalize(int[][][] data, int startX, int startY, int stopX, int stopY, double scale)
Normalizes the image data by the given scale
for (int y = startY; y < stopY; y++) {
    for (int x = startX; x < stopX; x++) {
        data[y][x][1] = (int) (data[y][x][1] * scale);
        data[y][x][2] = (int) (data[y][x][2] * scale);
        data[y][x][3] = (int) (data[y][x][3] * scale);
voidnormalize(long[] v, float[] target)
Returns a normalized vector (in R^2)
double len = length(v);
target[0] = (float) (v[0] / len);
target[1] = (float) (v[1] / len);
Double[]normalize(Number[] array)
Normalizes the given array (returns a copy), i.e., the array will sum up to 1.
Double[] result;
double sum;
int i;
result = new Double[array.length];
sum = 0;
for (i = 0; i < array.length; i++)
    sum += array[i].doubleValue();
if (sum > 0) {
...
String[]normalize(String[] slist)
normalize
if (slist == null)
    return null;
String[] ret = new String[slist.length];
for (int i = 0; i < slist.length; i++) {
    ret[i] = normalize(slist[i]);
return ret;
voidnormalize01(float[] array)
normalize
float min = min(array);
float div = max(array) - min;
for (int i = 0; i < array.length; i++)
    array[i] = (array[i] - min) / div;
voidnormalize2(double[] x)
normalize
double sum = 0;
for (int i = 0; i < x.length; i++)
    if (!Double.isNaN(x[i]))
        sum += x[i] * x[i];
if (sum == 0)
    return;
double f = 1.0 / Math.sqrt(sum);
for (int i = 0; i < x.length; i++)
...
voidnormalize3(float[] result, float[] a)
normalize
float invertedLength = invertedLength3(a);
result[0] = a[0] * invertedLength;
result[1] = a[1] * invertedLength;
result[2] = a[2] * invertedLength;