Java Array Value Dot Product arrayMultiply(double[] a, double[] b)

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

Description

Multiplies two vectors of doubles, array-wise.

License

Open Source License

Parameter

Parameter Description
a - the first vector of doubles.
b - the second vector of doubles.

Return

the result of multiplying two vectors of doubles.

Declaration


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

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   ww w .j  a  v a2  s  . c  o  m*/
     * Multiplies two vectors of doubles, array-wise.
     * @param a - the first vector of doubles.
     * @param b - the second vector of doubles.
     * @return the result of multiplying two vectors of doubles.
     */

    public static double[] arrayMultiply(double[] a, double[] b) {
        double[] out = new double[a.length];
        for (int i = 0; i < a.length; i++) {
            out[i] = a[i] * b[i];
        }
        return out;
    }
}

Related

  1. arrayDot(final Double[] first, final Double[] second)
  2. arrayDot2Zero(String[] values)
  3. arrayMultiplication(double[] a, double[] b)
  4. arrayProduct(int[] vs)