
O(n³) naive matrix multiplication
Image: Michaelbetancourt, CC BY-SA 3.0, via Wikimedia Commons
O(n³) naive matrix multiplication
The naive approach to matrix multiplication requires n³ field operations for multiplying two n × n matrices, which is represented as Θ(n³) in big O notation. This straightforward method is often taught in schools but is not the most efficient for large matrices.
The discovery of Strassen's algorithm in 1969 marked a significant improvement over the naive method. Strassen's algorithm reduces the number of required field operations, demonstrating that faster algorithms can exist beyond the basic schoolbook approach.
As of January 2024, the best known asymptotic complexity for matrix multiplication algorithms is O(n².371339), surpassing Strassen's original algorithm. This improvement highlights the ongoing quest for more efficient algorithms in theoretical computer science.
Example
Multiplying two 2 × 2 matrices using naive method: [[1, 2], [3, 4]] and [[5, 6], [7, 8]] requires 4 field operations (1*5 + 2*7, 1*6 + 2*8, 3*5 + 4*7, 3*6 + 4*8).
Remember this
Understanding the time complexity of matrix multiplication is crucial for optimizing numerical algorithms and improving computational efficiency in various applications.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
Graph (abstract data type)
Time complexity of BFS and DFS: O(V + E)
Matrix multiplication algorithm
Ever wondered how computers speed up multiplying huge numbers?
Overlapping subproblems
Ever calculated a huge Fibonacci sequence by hand?
Kolmogorov complexity
Kolmogorov complexity is uncomputable
Binary search
How fast can you find a word in a dictionary?
tensor cores are
Why can computers crunch numbers faster than humans?
Swipe through 100 ML concepts daily
Open Pocket Polymath