List of utility methods to do Array Max Value
int | argmax(double[] array, boolean naturalNumbers) Returns the index of the maximal value in a double[] int best = -1; double value = (naturalNumbers) ? 0D : Double.MIN_VALUE; for (int i = 0; i < array.length; ++i) { if (array[i] > value) { value = array[i]; best = i; return best; |
int | argmax(double[] weights) argmax if (weights == null) return -1; if (weights.length == 1) return 0; double max = weights[0]; int maxI = 0; for (int i = 1; i < weights.length; i++) if (weights[i] > max) ... |
int | argmax(final double[] vec) Returns the index of the greatest element in a vector. assert (vec != null); double max = vec[0]; int argmax = 0; for (int i = 1; i < vec.length; i++) { final double tmp = vec[i]; if (tmp > max) { max = tmp; argmax = i; ... |
int | argmax(float[] args) argmax int result = 0; for (int i = 1; i < args.length; i++) { if (Float.compare(args[result], args[i]) < 0) result = i; return result; |
int | argMax(int[] a) arg Max int v = Integer.MIN_VALUE; int ind = -1; for (int i = 0; i < a.length; i++) { if (a[i] > v) { v = a[i]; ind = i; return ind; |
int | argmax(int[] a) argmax int re = Integer.MIN_VALUE; int arg = -1; for (int i = 0; i < a.length; i++) { if (a[i] > re) { re = a[i]; arg = i; return arg; |
int | argmax(int[] array) argmax return getArgmax(array);
|
int | argmax(int[] array) Returns the index of the max value in the specified array int index = -1; int max = Integer.MIN_VALUE; for (int i = 0; i < array.length; i++) { if (array[i] > max) { max = array[i]; index = i; return index; |
int | argmax(int[] input) Returns the index of the largest element in an array. int i = input.length - 1; int currentMaximum = input[i]; int currentArgmax = i; while (i >= 0) { if (input[i] > currentMaximum) { currentMaximum = input[i]; currentArgmax = i; i++; return currentArgmax; |
double[] | arrayMax(double maxVal, double[] vals) Applies a max value to all elements in an array double[] out = new double[vals.length]; for (int i = 0; i < vals.length; i++) { out[i] = Math.max(maxVal, vals[i]); return out; |