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

StringnormalizeMemberNames(final String[] memberNames)
normalize Member Names
final StringBuffer buffer = new StringBuffer();
return buffer.toString();
double[][]normalizePositiveValues(double[][] array)
normalize Positive Values
if (array == null) {
    return new double[0][0];
double max = calculateMax(array);
if (max > 0) {
} else {
return null;
...
doublenormalizeProb(double[] prob)
normalize probabilities and check convergence by the maximum probability
double maxp = 0, sump = 0;
for (int i = 0; i < prob.length; ++i)
    sump += prob[i];
for (int i = 0; i < prob.length; ++i) {
    double p = prob[i] / sump;
    if (maxp < p)
        maxp = p;
    prob[i] = p;
...
intnormalizeRecorderColumn(int column, int tabSize, int[] tabIndices)

Normalizes the given column index computed by KeY's recorder component into a normal column index in that each tab ( '\t' ) character has a fixed tab size of one which means that a tab is treated as a normal character.

if (column >= 0 && tabSize >= 2 && tabIndices != null) {
    int result = 0;
    int i = 0;
    int lastTab = -1;
    int tabOverhead = 0;
    while (i < tabIndices.length) {
        if (lastTab >= 0) {
            result += tabIndices[i] - lastTab;
...
voidnormalizeRows(float[][] input)
Normalizes each row in a matrix, in place.
for (int i = 0; i < input.length; ++i) {
    normalize(input[i]);
StringnormalizeSpaces(char[] buf, int origStart, int origEnd)
Method that will check character array passed, and remove all "extra" spaces (leading and trailing space), and normalize other white space (more than one consequtive space character replaced with a single space).
--origEnd;
int start = origStart;
int end = origEnd;
while (start <= end && buf[start] == CHAR_SPACE) {
    ++start;
if (start > end) {
    return "";
...
float[]normalizeTo(float[] in, float normsum)
normalize To
float sum = 0;
float[] out = new float[in.length];
for (int i = 0; i < in.length; i++) {
    sum += in[i];
for (int i = 0; i < in.length; i++) {
    out[i] = normsum * in[i] / sum;
return out;
voidnormalizeToInPlace(double[] in, double normsum)
normalize To In Place
double sum = 0;
for (int i = 0; i < in.length; i++) {
    sum += in[i];
for (int i = 0; i < in.length; i++) {
    in[i] = normsum * in[i] / sum;
voidnormalizeToLogProbs(double[] x)
normalize To Log Probs
double max = max(x, x.length);
double sumExp = 0;
for (int i = 0; i < x.length; i++) {
    if (!Double.isNaN(x[i]))
        sumExp += Math.exp(x[i] - max);
double logSumExp = max + Math.log(sumExp);
for (int i = 0; i < x.length; i++)
...
double[]normalizeToOne(double[] doubles)
normalize To One
normalize(doubles, sum(doubles));
return doubles;