List of utility methods to do Array Average
float[] | average(float[][] data, int startIndex, int endIndex) Calculates average vector if (data.length == 0) { return new float[] {}; float[] out = new float[data[startIndex].length]; for (int i = startIndex; i < endIndex; i++) { for (int j = 0; j < out.length; j++) { out[j] += data[i][j] / (endIndex - startIndex + 1); return out; |
void | average(float[][] originalValues, float[][] newValues, int[] indexArray) set newValues to be the average of the original values in the index array if (indexArray.length == 0) { return; float total = 0; for (int j = 0; j < indexArray.length; j++) { total += originalValues[0][indexArray[j]]; for (int j = 0; j < indexArray.length; j++) { ... |
int | average(int argb0, int argb1) Averages two ARGB colors. return packPixel((getAlpha(argb0) + getAlpha(argb1)) / 2, (getRed(argb0) + getRed(argb1)) / 2,
(getGreen(argb0) + getGreen(argb1)) / 2, (getBlue(argb0) + getBlue(argb1)) / 2);
|
int | average(int... is) average if (is.length == 0) return 0; int i = 0; for (double ii : is) { i += ii; return i / is.length; |
int | average(int... values) Gets the rounded average of all the integer values given int total = 0; for (int v : values) total += v; return Math.round((float) total / (float) values.length); |
int | average(int[] a) average int sum = sum(a); return sum / a.length; |
double | average(int[] array) average return sum(array) / array.length;
|
int | average(int[] pixels) average float m = 0; for (int i = 0; i < pixels.length; ++i) { m += pixels[i]; m = m / pixels.length; return (int) m; |
int | average(int[] pixels) average float m = 0; for (int i = 0; i < pixels.length; ++i) { m += pixels[i]; m = m / pixels.length; return (int) m; |
double | average(int[] x) average int sum = 0; for (int v : x) sum += v; return (double) sum / x.length; |