numpy.vdot() in Python Last Updated : 08 Mar, 2024 Comments Improve Suggest changes Like Article Like Report Prerequisite - numpy.dot() in Python numpy.vdot(vector_a, vector_b) returns the dot product of vectors a and b. If first argument is complex the complex conjugate of the first argument(this is where vdot() differs working of dot() method) is used for the calculation of the dot product. It can handle multi-dimensional arrays but working on it as a flattened array. Parameters - vector_a : [array_like] if a is complex its complex conjugate is used for the calculation of the dot product. vector_b : [array_like] if b is complex its complex conjugate is used for the calculation of the dot product. Return - dot Product of vectors a and b. Code 1 : Python3 # Python Program illustrating # numpy.vdot() method import numpy as geek # 1D array vector_a = 2 + 3j vector_b = 4 + 5j product = geek.vdot(vector_a, vector_b) print("Dot Product : ", product) Output : Dot Product : (23-2j) How Code1 works ? vector_a = 2 + 3j vector_b = 4 + 5j As per method, take conjugate of vector_a i.e. 2 - 3j now dot product = 2(4 - 5j) + 3j(4 - 5j) = 8 - 10j + 12j + 15 = 23 - 2j Code 2 : Python3 # Python Program illustrating # numpy.vdot() method import numpy as geek # 1D array vector_a = geek.array([[1, 4], [5, 6]]) vector_b = geek.array([[2, 4], [5, 2]]) product = geek.vdot(vector_a, vector_b) print("Dot Product : ", product) product = geek.vdot(vector_b, vector_a) print("\nDot Product : ", product) """ How Code 2 works : array is being flattened 1 * 2 + 4 * 4 + 5 * 5 + 6 * 2 = 55 """ Output : Dot Product : 55 Dot Product : 55 Comment More infoAdvertise with us Next Article numpy.vdot() in Python M Mohit Gupta Improve Article Tags : Python Practice Tags : python Similar Reads numpy.var() in Python numpy.var(arr, axis = None) : Compute the variance of the given data (array elements) along the specified axis(if any). Example : x = 1 1 1 1 1 Standard Deviation = 0 . Variance = 0 y = 9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4 Step 1 : Mean of distribution 4 = 7 Step 2 : Summat 3 min read numpy.std() in Python numpy.std() is a function provided by the NumPy library that calculates the standard deviation of an array or a set of values. Standard deviation is a measure of the amount of variation or dispersion of a set of values.\text{Standard Deviation} = \sqrt{\text{mean} \left( (x - x.\text{mean}())^2 \rig 3 min read numpy.vstack() in python numpy.vstack() is a function in NumPy used to stack arrays vertically (row-wise). It takes a sequence of arrays as input and returns a single array by stacking them along the vertical axis (axis 0).Example: Vertical Stacking of 1D Arrays Using numpy.vstack()Pythonimport numpy as geek a = geek.array( 2 min read numpy.dot() in Python numpy.dot(vector_a, vector_b, out = None) returns the dot product of vectors a and b. It can handle 2D arrays but considers them as matrix and will perform matrix multiplication. For N dimensions it is a sum-product over the last axis of a and the second-to-last of b : dot(a, b)[i,j,k,m] = sum(a[i,j 2 min read numpy.eye() in Python numpy.eye() is a function in the NumPy library that creates a 2D array with ones on the diagonal and zeros elsewhere. This function is often used to generate identity matrices with ones along the diagonal and zeros in all other positions.Let's understand with the help of an example:Pythonimport nump 2 min read Like