Dot product of two vectors/points.

@param Vector $vector1
@param Vector $vector2
@return float
327430
public static function dot(Vector $vector1, Vector $vector2) : float {
        $count = count($vector1);
        $value = 0;
        for ($i=0;$i<$count;$i++) {
            $value += ($vector1[$i] * $vector2[$i]);
        }
        return $value;
    }
267875
public float dot(float x, float y, float z) {
        return this.x * x + this.y * y + this.z * z;
    }
903355
def dot(a, b):
    """"""
    if hasattr(a, '__dot__'):
        return a.__dot__(b)
    if a is None:
        return b
    else:
        raise ValueError(
            'Dot is waiting for two TT-vectors or two TT-    matrices')
1301520
public double dot(Vector v)
	{
		return (x * v.x) + (y * v.y) + (z * v.z);
	}
139798
public static double getCosinValue(double[] vector1, double[] vector2) {
        if (vector1 == null || vector2 == null) {
            return 0;
        }
        double dotProduct = VectorUtils.dotProduct(vector1, vector2);
        double euclideanDistance = VectorUtils.vectorLen(vector1) * VectorUtils.vectorLen(vector2);
        double cosineValue = Math.abs(dotProduct / euclideanDistance);
        return cosineValue > 1.0D ? 1.0D : cosineValue;  // because of the precision error
    }
709461
public double dot(Vector3dc v) {
        return dot(v.x(), v.y(), v.z());
    }
261618
public static double sumOfMeanDifferences(double[] vector, double[] vector2) {
        double mean = sum(vector) / vector.length;
        double mean2 = sum(vector2) / vector2.length;
        double ret = 0;
        for (int i = 0; i < vector.length; i++) {
            double vec1Diff = vector[i] - mean;
            double vec2Diff = vector2[i] - mean2;
            ret += vec1Diff * vec2Diff;
        }
        return ret;
    }
950363
public function projectOnto(Vector $that) : Vector
    {
        $that = $that->normalize();

        return $that->multiply($this->dotProduct($that));
    }
680894
def dot(vec1, vec2):
        """"""
        if isinstance(vec1, Vector2) \
                and isinstance(vec2, Vector2):
            return ((vec1.X * vec2.X) + (vec1.Y * vec2.Y))
        else:
            raise TypeError("vec1 and vec2 must be Vector2's")
724921
def dot_v2(vec1, vec2):
    """"""

    return vec1.x * vec2.x + vec1.y * vec2.y
1229422
public static function sub($float1, $float2)
    {
        if (!static::is($float1) || !static::is($float2)) {
            throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float.");
        }

        return ($float1 - $float2);
    }
806297
def cosine(vector1, vector2)
      dot_product = vector1.inner_product(vector2)
      dot_product / (vector1.r * vector2.r) # Vector#r is same as ||v||
    end
1336789
public static Vector add(Vector vector1, Vector vector2) {
        if (vector2.length() != vector1.length())
            throw new IllegalArgumentException(
                    "Vectors of different sizes cannot be added");
        if (vector2 instanceof IntegerVector &&
            vector1 instanceof DoubleVector)
            return add(vector1, Vectors.asDouble(vector2));
        if (vector2 instanceof SparseVector)
            addSparseValues(vector1, vector2);
        else {
            int length = vector2.length();
            for (int i = 0; i < length; ++i) {
                double value = vector2.getValue(i).doubleValue() +
                               vector1.getValue(i).doubleValue();
                vector1.set(i, value);
            }
        }

        return vector1;
    }
853080
public float dot(Vector4fc v) {
        return x * v.x() + y * v.y() + z * v.z() + w * v.w();
    }
185690
public function produce( $vector1, $vector2 )
	{
		if( $vector1->getDimension() != $vector2->getDimension() )
			throw new Exception( 'Dimensions of Vectors are not compatible.' );
		if( $vector1->getDimension() == 3 )
		{
			$x = $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 2 ) - $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 1 );
			$y = $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 0 ) - $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 2 );
			$z = $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 1 ) - $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 0 );
			$c = new Alg_Math_Algebra_Vector( $x, $y, $z );
		}
		return $c;
	}
960273
public static double[] pairwiseMax (double[] vector1, double[] vector2) {
        // Initialize the return value:
        final double[] retval = new double[vector1.length];

        // Iterate over values and get maxs:
        for (int i = 0; i < retval.length; i++) {
            retval[i] = Math.max(vector1[i], vector2[i]);
        }

        // Done, return:
        return retval;
    }
781109
public Vector2f pointAt(float t) {
		float a = 1 - t;
		float b = t;
		
		float f1 = a * a * a;
		float f2 = 3 * a * a * b;
		float f3 = 3 * a * b * b;
		float f4 = b * b * b;
		
		float nx = (p1.x * f1) + (c1.x * f2) + (c2.x * f3) + (p2.x * f4);
		float ny = (p1.y * f1) + (c1.y * f2) + (c2.y * f3) + (p2.y * f4);
		
		return new Vector2f(nx,ny);
	}