1

I have noticed that scipy.sparse.linalg.splu() does not allow me to decompose a sparse matrix A into the correct L and U matrix that I can call separately. The command ''merely'' allows me to decompose the matrix and reconstruct it later on using the permutation matrix. However, for my code I need to decompose a sparse matrix A into a sparse matrix L and U and then be able to call the L and U matrices separately (without permutation matrices etc.). This does not work when using the scipy.sparse.linalg.splu() command. I could use scipy.linalg.lu() but I cannot apply this to a matrix A in sparse format. Are there any other methods out there for obtaining the correct L and U decomposition matrices from a sparse matrix A? Thanks in advance.

gboffi
  • 22,939
  • 8
  • 54
  • 85
  • Please have a look at [this issue](https://github.com/scipy/scipy/issues/7700) and to [this proposed commit](https://github.com/kevinrichardgreen/scipy/commit/adfa5b8196b106127dd0fa65457263bb6a1f2d69) — do they help? – gboffi Dec 08 '18 at 13:47
  • @gboffi Oh my god, finally! Finally I've found a fix for this horrific problem. Thank you so much! The first link turned out to contain a simple fix to my problem. I'm not entirely sure what everything means due to inexperience but it'll do for now. Thanks again! – Charlie Shuffler Dec 08 '18 at 14:03
  • Be careful (i.e., check that the permutation is `range(...)`) because the issue is about `splu` _sometimes not respecting_ your `'natural'` option. I think the fix proposed in the commit has not yet been applied to Scipy. Glad to be helpful, ciao – gboffi Dec 08 '18 at 14:10
  • @gboffi Yeah the poster of the fix already mentioned it was more of a workaround, rather than an actual fix. It worked nicely for my application though. Thanks again! – Charlie Shuffler Dec 08 '18 at 14:11

0 Answers0