Java Array Subtract subtract(double[] a, double[] b)

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

Description

Subtracts two points

License

Open Source License

Parameter

Parameter Description
a a parameter
b a parameter

Return

a-b

Declaration

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

Method Source Code

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

public class Main {
    /**//from   w w w .j a  va  2s  . c om
     * Subtracts two points
     * 
     * @param a
     * @param b
     * @return a-b
     */
    public static double[] subtract(double[] a, double[] b) {
        if (a.length != b.length)
            throw new IllegalArgumentException("Subtracted two not matching Vectors.");
        double[] erg = new double[a.length];
        for (int i = 0; i < a.length; i++) {
            erg[i] = a[i] - b[i];
        }
        return erg;
    }
}

Related

  1. arraySubtract(final Double[] first, final Double[] second)
  2. subtract(byte[] a, byte[] b)
  3. subtract(double[] a, double[] b)
  4. subtract(double[] a, double[] b)
  5. subtract(double[] a, double[] b)
  6. subtract(double[] accumulator, double[] values)
  7. subtract(double[] array, double a)
  8. subtract(double[] array, double value)
  9. subtract(double[] first, double[] second)