List of utility methods to do Array Normalize
double[] | normalize(double[] weights) Normalizes weights to sum to one. final int n = weights.length; double sum = 0.0; for (int i = n; --i >= 0;) sum += weights[i]; if (sum != 0.0) { for (int i = n; --i >= 0;) weights[i] /= sum; return weights; |
double | normalize(double[] x) normalize double len = 0; for (int i = 0; i < x.length; i++) len += x[i] * x[i]; len = Math.sqrt(len); if (len <= 0.0) return 0.0; scale(x, 1.0 / len); return len; ... |
double[] | normalize(double[] xs) normalize double l2norm = Math.sqrt(dotProduct(xs, xs)); return scalarProduct(1.0 / l2norm, xs); |
double[][] | normalize(double[][] matrix, double lower, double upper) normalize double[][] normalized = new double[matrix.length][]; for (int row = 0; row < matrix.length; row++) { normalized[row] = normalize(matrix[row], lower, upper); return normalized; |
void | normalize(double[][] result) normalize int lvdimensions = result[0].length; int lvinstances = result.length; double[] lvlowrange = new double[lvdimensions]; double[] lvhighrange = new double[lvdimensions]; for (int lvins = 0; lvins < lvinstances; lvins++) { for (int lvfield = 0; lvfield < lvdimensions; lvfield++) { if (lvins == 0) { lvlowrange[lvfield] = result[lvins][lvfield]; ... |
double[][] | normalize(double[][] X) normalize int n = X.length; int m = X[0].length; double eps = 1e-12; double[] mean = mean(X); double[] stds = stdev(X); double[][] Xnew = new double[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ... |
byte[] | normalize(final byte[] input, final int bit) Normalizes a ByteArray and fits it in the given range. byte[] tmp = input; final double max = Math.pow(2, bit); int out = ((int) (byteArrayToInt(input) % max)); if (out < 0) { out += max; tmp = intToByteArray((out)); return tmp; ... |
void | normalize(final double[] a) normalize a, i.e., scale to unit length. final int rows = rows(a); final double len = length(a); for (int i = 0; i < rows; ++i) a[i] /= len; |
void | normalize(final double[] doubles) normalize final int len = doubles.length; double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; for (int i = 0; i < len; i++) { if (doubles[i] < min) min = doubles[i]; if (doubles[i] > max) max = doubles[i]; ... |
double[] | normalize(final double[] fir) Normalizes the sum of the given FIR filter to 1. double sum = 0; for (int i = 0; i < fir.length; i++) { sum += fir[i]; if (sum != 0) { for (int i = 0; i < fir.length; i++) { fir[i] /= sum; return fir; |