HomeLanguagesNumpy ndarray.dot() function | Python

Numpy ndarray.dot() function | Python

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.]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32700 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7076 POSTS0 COMMENTS
Nicole Veronica
12208 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12301 POSTS0 COMMENTS
Shaida Kate Naidoo
7196 POSTS0 COMMENTS
Ted Musemwa
7456 POSTS0 COMMENTS
Thapelo Manthata
7171 POSTS0 COMMENTS
Umr Jansen
7158 POSTS0 COMMENTS