List of utility methods to do Array Max Value
int | maxInt(int... values) Deprecated - use NumberArray assert values != null; int max = Integer.MIN_VALUE; for (int value : values) { if (value > max) { max = value; return max; ... |
int | maxInVector(double[] _vector) Returns the index of the higher value int toRet = 0; for (int j = 0; j < _vector.length; ++j) { if (_vector[toRet] < _vector[j]) { toRet = j; return toRet; |
float[] | maxJoinArray(float[] array1, float[] array2) max Join Array float[] result = new float[array1.length]; if (array1.length != array2.length) return result; for (int i = 0; i < array1.length; i++) result[i] = Math.max(array1[i], array2[i]); return result; |
int | maxLength(String... array) max Length int i = 0; for (String s : array) if (s.length() > i) i = s.length(); return i; |
double | maxLikelihood(int[] i, long[] Xi) max Likelihood double sum = 0; for (int x = 0; x < i.length; x++) { sum += i[x] * Xi[x]; double n = getN(Xi); return ((1d / n) * sum); |
int | maxLimit(int receiver, int... maxBound) max Limit return min(receiver, maxBound);
|
int | maxLocation(double[] list) This method finds the location of the first minimum of list int location = 0; for (int i = 1; i < list.length; ++i) if (list[i] > list[location]) location = i; return location; |
double | maxNorm(double[] arr) max Norm double norm = 0; for (double number : arr) { double abs = Math.abs(number); if (abs > norm) { norm = abs; return norm; ... |
double | maxNorm(double[] x1, double[] x2) Computing the norm as the Max norm. double distance = 0.0; for (int d = 0; d < x1.length; d++) { double difference = x1[d] - x2[d]; if (difference < 0) { difference = -difference; if (difference > distance) { distance = difference; ... |
double | maxNormWithAbort(double[] x1, double[] x2, double limit) Computing the norm as the Max norm; if it becomes clear that norm will be larger than limit, then return Double.POSITIVE_INFINITY immediately. double distance = 0.0; for (int d = 0; d < x1.length; d++) { double difference = x1[d] - x2[d]; if (difference < 0) { difference = -difference; if (difference > distance) { if (difference > limit) { ... |