We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Dot and Cross
- Discussions
Dot and Cross
Dot and Cross
Sort by
recency
|
338 Discussions
|
Please Login in order to post a comment
import numpy n=int(input()) arr_a=[] for _ in range(n): arr_a.append(list(map(int,input().split()))) arr_b=[] for _ in range(n): arr_b.append(list(map(int,input().split())))
print(numpy.dot(arr_a,arr_b))
For Python3
Use Dot Product to do matrix multiplication for multiple dimensions
Just use this easy code
import numpy
n=int(input()) A=[] B=[] for _ in range(n): A.append(list(map(int,input().split()))) for _ in range(n): B.append(list(map(int,input().split())))
A=numpy.array(A) B=numpy.array(B)
C=numpy.dot(A,B)
print(C)