Java Array Sum sumOfMinimum(double[] a, double[] b)

Here you can find the source of sumOfMinimum(double[] a, double[] b)

Description

sum Of Minimum

License

Open Source License

Declaration

public static double sumOfMinimum(double[] a, double[] b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double sumOfMinimum(double[] a, double[] b) {

        if (a.length != b.length) {
            throw new IndexOutOfBoundsException("The length of two arrays must be equal");
        }/*from   ww  w  .  j  a  va2s  . c o m*/

        double s = 0.0;
        for (int i = 0, n = a.length; i < n; i++) {
            s += a[i] < b[i] ? a[i] : b[i];
        }

        return s;

    }
}

Related

  1. sumNaive(final double... values)
  2. sumOf(int... values)
  3. sumOfArray(double[] array)
  4. sumOfArray(final double[] array)
  5. sumOfMeanDifferencesOnePoint(double[] vector)
  6. sumOfProducts(double[]... nums)
  7. sumOverVector(float[] a)
  8. sumProd(double[] v1, double[] v2, int i_, int n_)
  9. sumRightShifts(int num, int... shifts)