DAS_2024_1/chernyshov_nikita_lab_5/matrix_multiplication/sequential.py
Никита Чернышов 36dfe3c47a chernyshov_nikita_lab_5 is ready
2024-12-15 17:10:21 +04:00

10 lines
232 B
Python

def matrix_multiply_sequential(A, B):
n = len(A)
result = [[0] * n for _ in range(n)]
for i in range(n):
for j in range(n):
result[i][j] = sum(A[i][k] * B[k][j] for k in range(n))
return result