Skip to content
Advertisement

Why is ‘scipy.sparse.linalg.spilu’ less efficient than ‘scipy.linalg.lu’ for sparse matrix?

I posted this question on https://scicomp.stackexchange.com, but received no attention. As long as I get answer in one of them, I will inform in the other.


I have a matrix B which is sparse and try to utilize a function scipy.sparse.linalg.spilu specialized for sparse matrix to factorize B. Could you please explain why this function is significantly less efficient than the function scipy.linalg.lu for general matrix? Thank you so much!

JavaScript

The computation time is

JavaScript

Advertisement

Answer

JavaScript

Your matrix B is not sparse at all. More than half of the elements in B are non-zeros. Of course spilu would be less efficient when dealing with such a dense matrix.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement