Java Number Minus minus(double a[], double b)

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

Description

Creates a new vector by subtracting the given real number from the given vector.

License

Open Source License

Parameter

Parameter Description
a the vector
b the number

Return

the result of subtracting the given real number from the given vector

Declaration

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

Method Source Code

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

public class Main {
    /**/* www  .  java 2 s  . c o m*/
     * Creates a new vector by subtracting the given real number from the given vector.
     * @param a the vector
     * @param b the number
     * @return the result of subtracting the given real number from the given vector
     */
    public static double[] minus(double a[], double b) {
        double[] c = new double[a.length];
        for (int i = 0; i < c.length; i++) {
            c[i] = a[i] - b;
        }
        return c;
    }

    /**
     * Creates a new vector by subtracting the second vector from the first vector.
     * @param a the first vector
     * @param b the second vector
     * @return the result of subtracting the second vector from the first vector
     */
    public static double[] minus(double a[], double b[]) {
        double[] c = new double[a.length];
        for (int i = 0; i < c.length; i++) {
            c[i] = a[i] - b[i];
        }
        return c;
    }

    /**
     * Creates a new vector by subtracting the given real number from the given vector.
     * @param a the vector
     * @param b the number
     * @return the result of subtracting the given real number from the given vector
     */
    public static int[] minus(int a[], int b) {
        int[] c = new int[a.length];
        for (int i = 0; i < c.length; i++) {
            c[i] = a[i] - b;
        }
        return c;
    }

    /**
     * Creates a new vector by subtracting the second vector from the first vector.
     * @param a the first vector
     * @param b the second vector
     * @return the result of subtracting the second vector from the first vector
     */
    public static int[] minus(int a[], int b[]) {
        int[] c = new int[a.length];
        for (int i = 0; i < c.length; i++) {
            c[i] = a[i] - b[i];
        }
        return c;
    }
}

Related

  1. minus(boolean a, boolean b)
  2. minus(double[] a)
  3. minus(double[] p, double[] q)
  4. minus(double[][] x, double[][] y, double[][] r)
  5. minus(int flags, int set)