Divide and Conquer, Matrix Multiplication MATLAB

AI Thread Summary
The discussion focuses on implementing a divide and conquer algorithm for matrix multiplication in MATLAB, specifically comparing the computational times of classic matrix multiplication, divide and conquer, and Strassen’s method for varying matrix sizes. The user has successfully implemented the algorithm for 2x2 and 4x4 matrices but struggles with larger matrices, particularly 20x20, and seeks advice on efficient methods for splitting matrices. There is an acknowledgment that while divide and conquer is theoretically similar to the classic method, the emphasis is on practical computational times. The user requests assistance to facilitate measuring these times effectively. Overall, the thread highlights challenges in scaling the algorithm and the need for practical solutions.
Evales
Messages
53
Reaction score
0
Problem Statement
We are asked to use the following divide and conquer algorithm to get the solution for the multiplication of some matrix A and some matrix B. (See below)

Consider the matrix sizes. Comment the total computational time used on the following three algorithms, when different array sizes (say from 4 to 20) are used. Are they similar? Explain your finding.
- Classic matrix multiplication
- Divide and Conquer
- Strassen’s matrix method

We are using matlab.

Attempt at solutions
I have been able to get this divide and conquer code working for a 2x2 matrix and a 4x4 matrix.
2x2 was easy,
4x4 I used the reshape command and horizontal concatenation of parts of the reshaped matrix to build the parts of the 2x2 matrices and then used my previous 2x2 method.

But there is no way I'm going to do that for a 20x20 matrix, let alone all the matrices in between. I have tried looking for methods of splitting matrices evenly online but I keep coming up with very specific methods that don't work if you change the value of 'n'.

Is there anything anyone can suggest that will help me do this so that I can measure the computational time?

PS. As an aside I know that technically Divide and Conquer = Classic method. However our course focuses a lot on actual computational times, rather than just the theoretical times.

Any help is much appreciated.
 

Attachments

  • Screen Shot 2013-04-12 at 12.15.30 PM.png
    Screen Shot 2013-04-12 at 12.15.30 PM.png
    23.9 KB · Views: 961
Last edited:
Physics news on Phys.org
If there is any reason in particular that people find it difficult to answer my question, please let me know. I would be more than happy to provide additional information, and I would hugely grateful to anyone who could offer to help.
 
Back
Top