[Python] Python Scipy.sparse RuntimeError: Factor is exactly singular

Discussão em 'Python' iniciado por Stack, Setembro 4, 2025.

  1. Stack

    Stack Membro Participativo

    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.

    Continue reading...

Compartilhe esta Página