Python | Numpy np.ma.innerproduct() method

With the help of np.ma.innerproduct() method, we can calculate the vector product of two list by using np.ma.innerproduct() method.

Syntax : np.ma.innerproduct()
Return : Return a vector product of two lists.

Example #1 :
In this example we can see that by using np.ma.innerproduct() method, we are able to get the value of inner product of two vectors.

filter_none

edit
close

play_arrow

link
brightness_4
code

# import numpy
import numpy.ma as ma
  
# using np.ma.innerproduct() method
gfg = ma.innerproduct([1, 2, 3], [5, 5, 5])
  
print(gfg)

chevron_right


Output :

30



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# import numpy
import numpy.ma as ma
  
# using np.ma.innerproduct() method
gfg = ma.innerproduct([[1, 2, 3], [7, 8, 9]], [5, 5, 5])
  
print(gfg)

chevron_right


Output :

[ 30 120]

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.