Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Numpy ndarray.dot() function | Python

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

numpy.ndarray.dot() function return the dot product of two arrays.

Syntax : numpy.ndarray.dot(arr, out=None)

Parameters :
arr : [array_like] Input array.
out : [ndarray, optional] Output argument.

Return : [ndarray] The dot product of two arrays.

Code #1 :




# Python program explaining
# numpy.ndarray.dot() function
  
# importing numpy as geek 
import numpy as geek
  
arr1 = geek.eye(3)
arr = geek.ones((3, 3)) * 3
  
gfg = arr1.dot( arr )
  
print( gfg)

Output :

[[ 3.  3.  3.]
 [ 3.  3.  3.]
 [ 3.  3.  3.]]

 
Code #2 :




# Python program explaining
# numpy.ndarray.dot() function
  
# importing numpy as geek 
import numpy as geek
  
arr1 = geek.eye(3)
arr = geek.ones((3, 3)) * 3
  
gfg = arr1.dot(arr).dot(arr)
  
print( gfg)

Output :

[[ 27.  27.  27.]
 [ 27.  27.  27.]
 [ 27.  27.  27.]]
My Personal Notes arrow_drop_up
Last Updated : 22 Apr, 2020
Like Article
Save Article
Similar Reads
Related Tutorials