Strassen Algorithm
Matrix Multiplication
Input: Two square matrices and
Output:
# initialize matrix c (n x n)for i in range (n):for j in range(n):c[i][j] = 0for k in range (n):c[i]c[j] = c[i][j] + a[i][k] * b[k][j]return c
Strassen Algorithm
Input: Two square matrices and
if (n == 1):C = A * Belse:m_1 = (A_11 + A_22) * (B_11 + B_22)m_2 = (A_21 + A_22) * B_11m_3 = A_11 * (B_12 - B_22)m_4 = A_22 * (B_21 - B_11)m_5 = (A_11 + A_12) * B_22m_6 = (A_21 - A_11) * (B_11 + B_12)m_7 = (A_12 - A_22) * (B_21 + B_22)C_11 = m_1 + m_4 - m_5 + m_7C_12 = m_3 + m_5C_21 = m_2 + m_4C_22 = m_1 - m_2 + m_3 + m6return C
Time complexity