dotproduct

iteration_utilities.dotproduct(vec1, vec2)

Dot product (matrix multiplication) of two vectors.

Parameters:

vec1, vec2 : iterable

Any iterables to calculate the dot product. Positional-only parameter.

Returns:

dotproduct : number

The dot product - the sum of the element-wise multiplication.

Examples

>>> from iteration_utilities import dotproduct
>>> dotproduct([1,2,3,4], [1,2,3,4])
30