Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- with open('a.txt', 'r') as file1:
- with open('a.txt','r') as file11:
- with open('b.txt', 'r') as file2:
- n = len(file1.readline().split()) #количество столбцов в первой матрице
- file1 = file11.readlines()
- file2 = file2.readlines()
- for i in range(len(file1)):
- file1[i] = list(file1[i].strip().split())
- for j in range(len(file2)):
- file2[j] = list(file2[j].strip().split())
- m = len(file2) #количество строк во второй матрице
- if n == m:
- x1 = np.array(file1, 'f')
- x2 = np.array(file2, 'f')
- c = np.dot(x1,x2)
- file3 = open('c.txt', 'w')
- print(c,file = file3)
- file3.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement