@@ -118,9 +118,7 @@ def split_matrix(matrix: Matrix) -> tuple[Matrix, Matrix, Matrix, Matrix]:
118118 return a11 , a12 , a21 , a22
119119
120120
121- def combine_matrices (
122- c11 : Matrix , c12 : Matrix , c21 : Matrix , c22 : Matrix
123- ) -> Matrix :
121+ def combine_matrices (c11 : Matrix , c12 : Matrix , c21 : Matrix , c22 : Matrix ) -> Matrix :
124122 """
125123 Combines four quadrants into a single matrix.
126124 >>> a, b, c, d = split_matrix(matrix_count_up)
@@ -185,9 +183,7 @@ def strassen(matrix_a: Matrix, matrix_b: Matrix) -> Matrix:
185183 return []
186184
187185 if not (
188- len (matrix_a ) == len (matrix_b )
189- and is_square (matrix_a )
190- and is_square (matrix_b )
186+ len (matrix_a ) == len (matrix_b ) and is_square (matrix_a ) and is_square (matrix_b )
191187 ):
192188 raise ValueError ("Matrices must be square and of the same dimensions" )
193189
@@ -244,7 +240,7 @@ def strassen(matrix_a: Matrix, matrix_b: Matrix) -> Matrix:
244240 from timeit import timeit
245241
246242 # Run fewer iterations as Strassen is slower for small matrices in Python
247- mytimeit = partial (timeit , globals = globals (), number = 10_0 DENIED )
243+ mytimeit = partial (timeit , globals = globals (), number = 10_000 )
248244 for func in ("matrix_multiply" , "strassen" ):
249245 print (
250246 f"{ func :>25} (): "
0 commit comments