psychopy.tools.mathtools.dot

psychopy.tools.mathtools.dot(v0, v1, out=None, dtype=None)[source]

Dot product of two vectors.

The behaviour of this function depends on the format of the input arguments:

  • If v0 and v1 are 1D, the dot product is returned as a scalar and out is ignored.

  • If v0 and v1 are 2D, a 1D array of dot products between corresponding row vectors are returned.

  • If either v0 and v1 are 1D and 2D, an array of dot products between each row of the 2D vector and the 1D vector are returned.

Parameters:
  • v0 (array_like) – Vector(s) to compute dot products of (e.g. [x, y, z]). v0 must have equal or fewer dimensions than v1.

  • v1 (array_like) – Vector(s) to compute dot products of (e.g. [x, y, z]). v0 must have equal or fewer dimensions than v1.

  • out (ndarray, optional) – Optional output array. Must be same shape and dtype as the expected output if out was not specified.

  • dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.

Returns:

Dot product(s) of v0 and v1.

Return type:

ndarray


Back to top