Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the time-complexity of the pseudo-inverse in pytorch (i.e. torch.pinverse)?

Let's say I have a matrix X with n, m == X.shape in PyTorch. What is the time complexity of calculating the pseudo-inverse with torch.pinverse?

In other words, what is the time complexity of

X_p = torch.pinverse(X)

?

Here is the documentation

like image 976
patapouf_ai Avatar asked Oct 28 '25 18:10

patapouf_ai


1 Answers

The PyTorch documentation states that pinverse is calculated using SVD (singular value decomposition). The complexity of SVD is O(n m^2), where m is the larger dimension of the matrix and n the smaller. Thus this is the complexity.

For more info, check out these pages on wikipedia:

  • https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse#Singular_value_decomposition_(SVD)
  • https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations#Matrix_algebra
like image 137
Maya Farber Brodsky Avatar answered Oct 31 '25 08:10

Maya Farber Brodsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!