Complexity of inverting a diagonal matrix What is the complexity of inverting a $n \times n$ diagonal matrix?
From what I learn in algebra, the inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal.
So is it correct to say that the complexity of inverting a diagonal matrix is $\mathcal{O}(n)$?
It's unclear what $n$ is in your question. If your matrix has dimensions $n \times n$ and your model of computation allows you to perform
basic arithmetic operations in constant time then, yes, computing the inverse matrix takes $O(n)$ time.