Strassen's algorithm: Difference between revisions

Content added Content deleted
(→‎With dynamic padding: bugfixes: T,int -> Int, <=128 || -> ==1 && (otherwise it's just cheating).)
(added switch size requirement limit to the task (which as of now all entries meet))
Line 5: Line 5:
;Task
;Task
Write a routine, function, procedure etc. in your language to implement the Strassen algorithm for matrix multiplication.
Write a routine, function, procedure etc. in your language to implement the Strassen algorithm for matrix multiplication.

While practical implementations of Strassen's algorithm usually switch to standard methods of matrix multiplication for small enough submatrices (currently anything < 512x512 according to wp), for the purposes of this task you should not switch below sizes of 1 or 2.


;Related task
;Related task
Line 237: Line 239:
# if rows <= 128 || cols <= 128
# if rows <= 128 || cols <= 128
if rows == 1 && cols == 1
if rows == 1 && cols == 1
# if rows == 2 && cols == 2
return a * b
return a * b
end
end