Divide and Conquer, Matrix Multiplication MATLAB

In summary, the problem at hand is to find a solution for multiplying two matrices, A and B, using a divide and conquer algorithm. The focus of the conversation is on the computational time taken by three different algorithms - classic matrix multiplication, divide and conquer, and Strassen's matrix method, for matrix sizes ranging from 4 to 20. The speaker mentions using MATLAB and successfully implementing the divide and conquer algorithm for 2x2 and 4x4 matrices, but expresses difficulty in doing so for larger matrices. They have attempted to find methods for evenly splitting matrices online, but have not found a suitable solution. They also mention that while divide and conquer and classic method are technically the same, their course emphasizes on actual computational times rather
  • #1
Evales
54
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: 914
Last edited:
Physics news on Phys.org
  • #2
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.
 

Related to Divide and Conquer, Matrix Multiplication MATLAB

1. What is the concept of "Divide and Conquer" in matrix multiplication?

"Divide and Conquer" is a problem-solving strategy that involves breaking down a larger problem into smaller, more manageable subproblems, solving them separately, and then combining the solutions to solve the larger problem. In the context of matrix multiplication in MATLAB, it refers to dividing a large matrix multiplication task into smaller sub-tasks, solving them separately, and then combining the results to get the final solution.

2. How does "Divide and Conquer" improve matrix multiplication performance in MATLAB?

The "Divide and Conquer" strategy can improve matrix multiplication performance in MATLAB by reducing the number of operations needed to be performed. By breaking down a large matrix multiplication task into smaller sub-tasks, it can reduce the overall computational complexity and thus improve performance. Additionally, it can also help utilize parallel computing capabilities in MATLAB, further improving performance.

3. Can "Divide and Conquer" be used for all types of matrices in MATLAB?

Yes, "Divide and Conquer" can be used for all types of matrices in MATLAB. The strategy is not dependent on the specific properties of the matrices, but rather on the size of the matrices and the available computing resources.

4. Are there any drawbacks to using "Divide and Conquer" for matrix multiplication in MATLAB?

One potential drawback of using "Divide and Conquer" for matrix multiplication in MATLAB is the overhead involved in breaking down the problem and combining the results. This overhead may outweigh the performance improvement for smaller matrices. Additionally, the strategy may not be beneficial if the matrices are not large enough to justify the use of parallel computing.

5. Are there any other matrix multiplication strategies in MATLAB besides "Divide and Conquer"?

Yes, there are other matrix multiplication strategies in MATLAB, such as the straightforward approach of multiplying each element of one matrix by each element of the other matrix. Additionally, MATLAB also has built-in functions for optimized matrix multiplication, such as "mtimes" and "times". The choice of strategy depends on the specific problem and the available computing resources.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
18
Views
2K
  • Linear and Abstract Algebra
Replies
1
Views
840
  • Introductory Physics Homework Help
Replies
2
Views
364
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Replies
5
Views
939
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top