pythonnumpytime-complexityfinanceirr

What is the complexity of numpy's irr function?


Given an array of length n, assuming there is a solution for the internal rate of return, what is the complexity of the numpy irr() function? irr() source code

I had a look at the code but wasn't able to calculate it myself.


Solution

  • The algorithm seems to have complexity O(n^3), since it's computing the eigenvalues of the companion matrix of your input. None of the other computations in the function have nearly as long of a time complexity.