numpy.dot() in PythonThe numpy module of Python provides a function to perform the dot product of two arrays.
SyntaxParametersa: array_like This parameter defines the first array. b: array_like This parameter defines the second array. out: ndarray(optional) It is an output argument. It should have the exact kind which would be returned in the case when it was not used. Particularly, it should meet the performance feature, i.e., it must contain the right type, i.e., it must be C-contiguous, and its dtype must be the dtype that would be returned for dot(a,b). Thus, if it does not meet these specified conditions, it raises an exception. ReturnsThis function returns the dot product of 'a' and 'b'. This function returns a scalar if 'a' and 'b' are both scalars or 1-dimensional; otherwise, it returns an array. If 'out' is given, then it is returned. RaisesThe ValueError occurs when the last dimension of 'a' is not having the same size as the second-to-last dimension of 'b'. Example 1:Output: 72 Example 2:Output: (-34+0j) Example 3:Output: array([[ 8, 17], [18, 47]]) In the above code
In the output, it shows the matrix product as an array. Example 4:Output: 499128 499128 In the above code
In the output, it shows the matrix product as an array. Next Topicnumpy.loadtxt() |