Java Array Max Value maxOverArraySubset(double[] array, Iterable subset)

Here you can find the source of maxOverArraySubset(double[] array, Iterable subset)

Description

Compute the maximum value over a subset of an array of doubles.

License

Open Source License

Parameter

Parameter Description
array The array
subset The subset

Declaration

public static double maxOverArraySubset(double[] array,
        Iterable<Integer> subset) 

Method Source Code

//package com.java2s;
//   it under the terms of the GNU General Public License as published by

public class Main {
    /**/*from  w  w w .ja  va 2 s  .com*/
     * Compute the maximum value over a subset of an array of doubles.
     * @param array The array
     * @param subset The subset
     */
    public static double maxOverArraySubset(double[] array,
            Iterable<Integer> subset) {
        double d;
        d = Double.NEGATIVE_INFINITY;
        for (int j : subset) {
            if (array[j] > d)
                d = array[j];
        }
        return d;
    }
}

Related

  1. maxNorm(double[] arr)
  2. maxNorm(double[] x1, double[] x2)
  3. maxNormWithAbort(double[] x1, double[] x2, double limit)
  4. maxNum(Number iArr[])
  5. maxOfSortedValues(double[] sortedValues)
  6. maxpool(float[] curr, float[] probs)
  7. maxPosition(float[] v)
  8. maxPositive(int[] array)
  9. maxPrim(final int... numbers)