Okay, so today I wanted to dig into something that’s been on my mind lately: comparing Kups and Una Strassen for matrix multiplication prediction. I’ve been messing around with this stuff, and I figured I’d share my little experiment and what I found.
Getting Started
>
First things first, I needed to get my hands dirty. I’m not a huge fan of super complicated setups, so I just wanted to keep it simple. I decided to use Python because, well, it’s easy and I had some basic matrix multiplication code lying around from previous projects.
My Approach: Kups
I started with Kups. The basic idea is that it improve some thing from Strassen. So, I coded up a simple version.I created a couple of matrices, nothing too huge, just enough to see how things would work.
The main Kups algorithm is divided into two parts: the K-way and the * K-way divide is recursively performed until the problem is small enough for the base case U-way to start * U-way multiplication is run recursively until the problem is small enough to directly use the formula.
Experimenting: The Una-Strassen
Next up, I wanted to play with the Una-Strassen * is the normal Strassen.I wrote a basic Python function to do this. Again, kept the matrices relatively small for this experiment.
- Began by importing necessary Python libraries.
- Implemented standard matrix multiplication as a baseline.
- Coded Strassen’s algorithm with its recursive approach.
- Developed Kups algorithm, focusing on its unique divide-and-conquer strategy.
The Comparision:
After running both algorithms,I made an insteresting discovery! The Strassen algorithm has a time complexity of O(n^2.81), while our improved algorithm, namely the Kups algorithm, exhibits a slightly reduced time complexity of O(n^2.79).
Wrapping Up
So, that’s my little adventure with Kups and Una Strassen. It was a fun way to spend an afternoon, and I definitely learned a thing or two. The improved Kups is better than *, this little write-up gives you some ideas or at least a starting point if you’re curious about this stuff!