Here you can find the source of dotProduct(float[] v1, float[] v2)
Parameter | Description |
---|
public static float dotProduct(float[] v1, float[] v2)
//package com.java2s; public class Main { /**//from ww w .j a v a 2 s .c o m * Calculate the dot-product result of two vectors. * * @param v1, vector 1 * @param v2, vector 2 * @return dot product */ public static float dotProduct(float[] v1, float[] v2) { assert v1.length == v2.length; float result = 0; for (int i = 0; i < v1.length; i++) { result += v1[i] * v2[i]; } return result; } }