strassen

Matrix multiplication: Strassen vs. Standard

孤街醉人 提交于 2019-12-03 03:48:00
I tried to implement the Strassen algorithm for matrix multiplication with C++, but the result isn't that, what I expected. As you can see strassen always takes more time then standard implementation and only with a dimension from a power of 2 is as fast as standard implementation. What went wrong? matrix mult_strassen(matrix a, matrix b) { if (a.dim() <= cut) return mult_std(a, b); matrix a11 = get_part(0, 0, a); matrix a12 = get_part(0, 1, a); matrix a21 = get_part(1, 0, a); matrix a22 = get_part(1, 1, a); matrix b11 = get_part(0, 0, b); matrix b12 = get_part(0, 1, b); matrix b21 = get_part

Why is my Strassen's Matrix Multiplication slow?

ぐ巨炮叔叔 提交于 2019-11-29 01:16:45
问题 I wrote two Matrix Multiplications programs in C++: Regular MM (source), and Strassen's MM (source), both of which operate on square matrices of sizes 2^k x 2^k(in other words, square matrices of even size). Results are just terrible. For 1024 x 1024 matrix, Regular MM takes 46.381 sec , while Strassen's MM takes 1484.303 sec ( 25 minutes !!!!). I attempted to keep the code as simple as possible. Other Strassen's MM examples found on the web are not that much different from my code. One issue

Strassen's algorithm for matrix multiplication

房东的猫 提交于 2019-11-28 16:13:38
Can someone please explain strassen's algorithm for matrix multiplication in an intuitive way? I've gone through (well, tried to go through) the explanation in the book and wiki but it's not clicking upstairs. Any links on the web that use a lot of English rather than formal notation etc. would be helpful, too. Are there any analogies which might help me build this algorithm from scratch without having to memorize it? Consider multiplying two 2x2 matrices, as follows: A B * E F = AE+BG AF+BH C D G H CE+DG CF+DH The obvious way to compute the right side is just to do the 8 multiplies and 4