numpy.dot (vector_a, vector_b, out = None) returns the point product of vectors a and b. It can handle two-dimensional arrays, but treats them like a matrix and does matrix multiplication. For N measurements, this is the sum of the products along the last a axis and the second longest b:
dot (a, b) [i, j, k, m] = sum (a [i, j, :] * b [k,:, m])
- vector_a: [array_like], if a is complex, its complex conjugate is used to compute the dot product.
- vector_b: [array_like], if b is complex, its complex conjugate used to compute the dot product.
- out: [array, optional] The output argument must be C-contiguous and its dtype must be the dtype that will be returned for dot (a, b).
Dot product of vectors a and b. if vector_a and vector_b are 1D then scalar is returned
Code 1 —
Dot Product of scalar values: 20 Dot Product: (-7 + 22j)
How does Code1 work?
vector_a = 2 + 3j
vector_b = 4 + 5j
is now a dot product
= 2 (4 + 5j) + 3j (4 — 5j)
= 8 + 10j + 12j — 15
= -7 + 22j
Code 2 —
Dot Product: [[22 12] [40 32]] Dot Product: [[22 32] [15 32]]
This article is provided by Mohit Gupta_OMG