Operation | Dense Matrix | Sparse Matrix | NumPy Matrix |
---|---|---|---|
Access | O(1) | O(1) | O(1) |
Addition | O(mn) | O(k)* | O(mn) |
Multiplication | O(mnp)** | O(kp)*** | O(mnp) |
Transpose | O(mn) | O(k) | O(1)**** |
Implementation | Space Complexity | Additional Notes |
---|---|---|
Dense Matrix | O(mn) | All elements stored |
Sparse Matrix | O(k) | Only non-zero elements |
NumPy Matrix | O(mn) | Contiguous memory allocation |