DAS_2024_1/kurushina_ksenia_lab_5/sequential.py

10 lines
232 B
Python
Raw Normal View History

2024-12-09 19:55:48 +04:00
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