DAS_2024_1/kadyrov_aydar_lab_5/matrix_multiplication/sequential.py

10 lines
232 B
Python
Raw Permalink Normal View History

2024-10-27 02:13:51 +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