Java Array Dot Product dotProduct(final double[] a, final double[] b)

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

Description

dot Product

License

Open Source License

Declaration

public static Double dotProduct(final double[] a, final double[] b) 

Method Source Code

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

public class Main {
    public static Double dotProduct(final double[] a, final double[] b) {
        double result = 0;
        try {//www  . j a v a2s  .  c o m
            for (int i = 0; i < a.length; i++)
                result += a[i] * b[i];
        } catch (ArrayIndexOutOfBoundsException e) {
            System.err.println("Number of inputs does not match the number of weights. Exiting...");
            System.exit(1);
        }
        return result;
    }
}

Related

  1. dotProduct(double[] fv1, double[] fv2)
  2. dotProduct(double[] thisVector, double[] thatVector)
  3. dotProduct(double[] v, double[] u)
  4. dotProduct(double[] vector1, double[] vector2)
  5. dotProduct(double[] x, double[] y)
  6. dotProduct(final double[] anArray, final double[] anotherArray)
  7. dotProduct(final double[] v1, final double[] v2, int n)
  8. dotProduct(float x1, float y1, float x2, float y2)
  9. dotProduct(float[] p, int a, int b, int c)