Skip to content

Instantly share code, notes, and snippets.

@Robofied
Created February 15, 2019 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robofied/c37f378657051e4bfabe2874227b3393 to your computer and use it in GitHub Desktop.
Save Robofied/c37f378657051e4bfabe2874227b3393 to your computer and use it in GitHub Desktop.
Numpy
##importing libraries
import numpy.linalg as lnp
import numpy as np
## dot product for simple numbers.
np.dot(3,4)
#[Output]:
#12
## dot products for 1-d array
np.dot([2,3],[3,4])
#[Output]:
#18
## dot product for 2-d arrays
np.dot([[2,3],[3,4]],[[1,2],[5,6]])
#[Output]:
#array([[17, 22],
# [23, 30]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment