3

I was trying to find the lower–upper (LU) factorization for a sparse matrix (size 159990 by 159990). Below I attach the three python code lines I have used for the LU decomposition

from scipy.sparse import csc_matrix, linalg as sla
interior_stiff = CSC_matrix(159990 by 159990)
LU = sla.splu(interior_stiff, options=dict(SymmetricMode=True))

Properties of this matrix include,

  1. Symmetric

  2. The diagonal elements are the largest among the corresponding matrix column.

  3. Non singular matrix

While running the code I was getting the following error in Spyder GUI,

  File "<ipython-input-1-7243a2294501>", line 1, in <module>
    runfile('C:/temp/new_LU/Run_1_using_LU.py', wdir='C:/temp/new_LU')
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)
  File "C:/temp/new_LU/Run_1_using_LU.py", line 574, in <module>
    LU= sla.splu(interior_stiff,options=dict(SymmetricMode=True))
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\dsolve\linsolve.py", line 261, in splu
    ilu=False, options=_options)
RuntimeError: Factor is exactly singular

Can anyone suggest a possible solution for this?

Any help will be appreciated.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Paul Thomas
  • 477
  • 1
  • 7
  • 15
  • Might [this](https://stackoverflow.com/questions/12125952/scipys-sparse-eigsh-for-small-eigenvalues) be relevant? – SwiftsNamesake Aug 14 '17 at 21:52
  • Thank you for the suggestion but which=LM option is available only for eigh() and not for splu(). So this cannot help me in this regard. – Paul Thomas Aug 14 '17 at 21:59
  • 2
    Issue resolved using "https://stackoverflow.com/questions/18754324/improving-a-badly-conditioned-matrix" – Paul Thomas Aug 16 '17 at 20:34

1 Answers1

0

The reason maybe is the machine accuracy. The eigenvalue is very small, but not zero. so it will become a singular matrix.

Daniel
  • 1
  • 2