-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
31 lines (31 loc) · 854 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from project.threadGo import threadMatrixProduct
# enter the size of the matrices
n = int(input("Enter the size of the matrix "))
# take input from user
A = []
B = []
print("Enter the elements of matrix A")
for i in range(n):
a =[]
for j in range(n):
a.append(int(input()))
print()
A.append(a)
print("Enter the elements of matrix B")
for i in range(n):
a =[]
for j in range(n):
a.append(int(input()))
print()
B.append(a)
# initialise the handle with an instance of
# class threadMatrixProduct with matrices A, B and size n
handle = threadMatrixProduct(A,B,n)
# invoke the matrix multiplication function
handle.matrixProduct()
# check out the output stored in handle.C
print("The resultant matrix is as follows ")
for i in range(n):
for j in range(n):
print(handle.C[i][j],end=' ')
print()