Skip to content

Commit 1e7fd8d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent cde9409 commit 1e7fd8d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

divide_and_conquer/strassen_matrix_multiplication.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,23 @@ def actual_strassen(matrix_a: list, matrix_b: list) -> list:
113113

114114
def strassen(matrix1: list, matrix2: list) -> list:
115115
"""
116-
Perform matrix multiplication using Strassen’s algorithm.
116+
Perform matrix multiplication using Strassen’s algorithm.
117117
118-
Examples:
119-
>>> strassen([[2,1,3],[3,4,6],[1,4,2],[7,6,7]], [[4,2,3,4],[2,1,1,1],[8,6,4,2]])
120-
[[34, 23, 19, 15], [68, 46, 37, 28], [28, 18, 15, 12], [96, 62, 55, 48]]
118+
Examples:
119+
>>> strassen([[2,1,3],[3,4,6],[1,4,2],[7,6,7]], [[4,2,3,4],[2,1,1,1],[8,6,4,2]])
120+
[[34, 23, 19, 15], [68, 46, 37, 28], [28, 18, 15, 12], [96, 62, 55, 48]]
121121
122-
>>> strassen(
123-
... [[3,7,5,6,9],[1,5,3,7,8],[1,4,4,5,7]],
124-
... [[2,4],[5,2],[1,7],[5,5],[7,8]]
125-
... )
122+
>>> strassen(
123+
... [[3,7,5,6,9],[1,5,3,7,8],[1,4,4,5,7]],
124+
... [[2,4],[5,2],[1,7],[5,5],[7,8]]
125+
... )
126126
127127
128-
Complexity Notes:
129-
- Classical matrix multiplication: O(n^3).
130-
- Strassen's algorithm: O(n^(log2(7))) ≈ O(n^2.81).
131-
- Strassen reduces the number of multiplications from 8 to 7 per recursion,
132-
trading them for additional additions/subtractions.
128+
Complexity Notes:
129+
- Classical matrix multiplication: O(n^3).
130+
- Strassen's algorithm: O(n^(log2(7))) ≈ O(n^2.81).
131+
- Strassen reduces the number of multiplications from 8 to 7 per recursion,
132+
trading them for additional additions/subtractions.
133133
"""
134134
if matrix_dimensions(matrix1)[1] != matrix_dimensions(matrix2)[0]:
135135
msg = (

0 commit comments

Comments
 (0)