Safty check for matrix inversion

More
5 years 1 month ago #1925 by Guosheng Fu
Hello,

When umfpack direct solver fails to factorize the linear system (due to singularity), the code simply crashes.
Is there a safer way to proceed other than producing the following error message and exit the code?
Code:
netgen.libngpy._meshing.NgException: UmfpackInverse: Numeric factorization failed.
I noticed pardiso solver will still proceed with the factorization, but producing nan values.


Best,
Guosheng
More
5 years 1 month ago #1927 by mneunteufel
Hi Guosheng,

you can use the try - except syntax of Python

Code:
try: a.mat.Inverse(fes.FreeDofs(), inverse="umfpack") except: print("Singular matrix") #...

Then the code does not exit.

Best,
Michael
Time to create page: 0.100 seconds