Divide and Conquer, Matrix Multiplication MATLAB

Click For Summary
SUMMARY

The discussion focuses on implementing matrix multiplication using the divide and conquer algorithm in MATLAB, specifically comparing the computational times of classic matrix multiplication, divide and conquer, and Strassen’s method for matrix sizes ranging from 4 to 20. The user successfully implemented the divide and conquer method for 2x2 and 4x4 matrices but struggles with larger matrices due to the complexity of splitting them evenly. The user seeks guidance on efficient methods for handling larger matrices to measure computational time accurately.

PREREQUISITES
  • Understanding of matrix multiplication algorithms
  • Familiarity with MATLAB programming
  • Knowledge of the reshape command in MATLAB
  • Concept of computational complexity in algorithms
NEXT STEPS
  • Research efficient matrix splitting techniques for divide and conquer in MATLAB
  • Explore the implementation of Strassen’s matrix multiplication method
  • Learn about measuring computational time in MATLAB using the 'tic' and 'toc' functions
  • Investigate optimization techniques for matrix operations in MATLAB
USEFUL FOR

Students and professionals in computer science, particularly those focusing on algorithms, MATLAB programming, and performance optimization in matrix computations.

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: 984
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.
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 18 ·
Replies
18
Views
2K
Replies
4
Views
6K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K