- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Easy way to remember Strassen's Matrix Equation in C++
It is a matrix multiplication algorithm is based on divide and conquer method. It is used to multiply two matrices of the same size,
Finding multiplication of two matrices−
The strassen’s Algorithm reduces overhead for multiplication by simplifying the multiplication.
Here is the multiplication made using the strassen’s Algorithm:
M1 = a*(f - h)
M2 = (a + b)*h
M3 = (c + d)*e
M4 = d*(g - e)
M5 = (a + d)*(e + h)
M6 = (b - d)*(g + h)
M7 = (a - c)*(e + f)
This can be easily remembered and the algorithm code can be decoded. For this we have a few rules, first remember these 6 things−
- Use AHED for the first 4 values of M.
- Use Diagonal multiplication for the 5th value of M.
- Use last CR (last col from mat 1 and last row form mat 2) for 6th value of M.
- Use first CR(first col from mat 1 and first row form mat 2) for 7th value of M.
- While considering elements of row add them and in case of columns subtract them.
- The update values after that using adjacent values.
Using these ways we can easily remember the values.
- What's an easy way to read a random line from a file in the Unix command line?
- Easy way to re-order columns in MySQL?
- What's the best way to trim std::string in C++?
- What's the simplest way to print a Java array?
- What's the best way to do this? VBA, etc
- What's the best way to ensure a happy marriage?
- Snagit Tool: Taking Better Screenshots the Easy Way
- How to use pip to install python modules in easy way?
- What's the canonical way to check for type in python?
- How will you explain Python namespaces in easy way?
- What is the easy way to make friends in a new school?
- The simplest way to get the user's current location on Android
- Pascal's Triangle in C++