![]() |
VOOZH | about |
numpy.dot() is used to compute the dot product of two arrays.
Example: This example shows how numpy.dot() calculates the dot product of two 1D arrays.
23
Explanation: np.dot(a, b) -> 2*4 + 3*5 = 8 + 15 = 23.
numpy.dot(a, b, out=None)
Parameters:
Example 1: This example demonstrates the dot product of two complex numbers using numpy.dot().
(-7+22j)
Explanation:np.dot(a, b) multiplies using complex arithmetic -> 2*(4+5j) + 3j*(4+5j) -> -7 + 22j.
Example 2: This example shows matrix multiplication using numpy.dot() on two 2D arrays.
[[22 12] [40 32]]
Explanation: np.dot(a, b) performs matrix multiplication
Example 3: This example uses numpy.dot() with a 2D array and a 1D array to produce a vector.
[21 8 11]
Explanation: Each row of a is dotted with vector b