Return the dotproduct of two vectors.
493866
def dot_v3(v, w):
    """"""

    return sum([x * y for x, y in zip(v, w)])
806297
def cosine(vector1, vector2)
      dot_product = vector1.inner_product(vector2)
      dot_product / (vector1.r * vector2.r) # Vector#r is same as ||v||
    end
602784
def scalar_projection(v1, v2):
    '''
    '''
    return np.dot(v1, v2) / np.linalg.norm(v2)
859592
def dot(self, rhs):
    

    return self.x * rhs.x + self.y * rhs.y + self.z * rhs.z
50043
function distanceSquared(a, b) {
    const diff = {
        x: a.x - b.x,
        y: a.y - b.y,
    };

    return dotProduct(diff, diff);
}
393746
public double dot(SparseVector b) {
		SparseVector a = this;
		if (a.N != b.N) throw new IllegalArgumentException("Vector lengths disagree. " + a.N + " != " + b.N);
		double sum = 0.0;

		// iterate over the vector with the fewest nonzeros
		if (a.symbolTable.size() <= b.symbolTable.size()) {
			for (int i : a.symbolTable)
				if (b.symbolTable.contains(i)) sum += a.get(i) * b.get(i);
		}
		else  {
			for (int i : b.symbolTable)
				if (a.symbolTable.contains(i)) sum += a.get(i) * b.get(i);
		}
		return sum;
	}
1199464
def dot_solve(self, y):
        

        """
        return np.dot(y.T, cho_solve(self._factor, y))
339198
public static double dotProductWithAddition(double[] pointA1,
			double[] pointA2, double[] pointB) {
		assert (pointA1.length == pointA2.length && pointA1.length == pointB.length);
		double product = 0.0;
		for (int i = 0; i < pointA1.length; i++) {
			product += (pointA1[i] + pointA2[i]) * pointB[i];
		}
		return product;
	}
726532
def dot(a, b)
        unless a.size == b.size
          raise "Vectors must be the same length"
        end
  
        # Make element-by-element array of pairs
        (a.to_a).zip(b.to_a).inject(0) {|tot, pair| tot = tot + pair[0]*pair[1]}
      end
1093652
def component_div(vec1, vec2):
        """"""
        new_vec = Vector2()
        new_vec.X = vec1.X / vec2.X
        new_vec.Y = vec1.Y / vec2.Y
        return new_vec
597127
def distance(vec1, vec2):
        """"""
        if isinstance(vec1, Vector2) \
                and isinstance(vec2, Vector2):
            dist_vec = vec2 - vec1
            return dist_vec.length()
        else:
            raise TypeError("vec1 and vec2 must be Vector2's")
569414
public double dot(Vector3d v1) {
        return x * v1.x + y * v1.y + z * v1.z;
    }
241378
def dot_product(p1, p2, o=(0, 0)):
    
    v1 = vector(o, p1)
    v2 = vector(o, p2)
    return v1[0] * v2[0] + v1[1] * v2[1]
1347808
public int dot(IntIntVector y) {
        if (y instanceof IntIntSortedVector) {
            IntIntSortedVector other = ((IntIntSortedVector) y);
            int dot = 0;
            int oc = 0;
            for (int c = 0; c < used; c++) {
                while (oc < other.used) {
                    if (other.indices[oc] < indices[c]) {
                        oc++;
                    } else if (indices[c] == other.indices[oc]) {
                        dot += values[c] * other.values[oc];
                        break;
                    } else {
                        break;
                    }
                }
            }
            return dot;
        } else {
            int dot = 0;
            for (int c = 0; c < used; c++) {
                dot += this.values[c] * y.get(indices[c]);
            }
            return dot;
        }
    }
692987
def dot(self, w):
        """"""

        return sum([x * y for x, y in zip(self, w)])
568897
def vector_distance(v1, v2):
    """"""
    dist = 0
    for dim in v1:
        for x in v1[dim]:
            dd = int(v1[dim][x]) - int(v2[dim][x])
            dist = dist + dd**2
    return dist
1340654
public float dotProduct(LinearSparseVector sv, int li, int n) {
		float product = 0;
		int z = n * li;
		for (int i = 0; i < length; i++) {
			int p = Arrays.binarySearch(sv.index, index[i] + z);
			if (p >= 0) {
				product += (float) data[i] + (float) sv.data[p];
			}
		}
		return product;
	}