wo80 / CSparse.NET

A concise library for solving sparse linear systems with direct methods.
GNU Lesser General Public License v2.1
58 stars 25 forks source link

Cholesky solver #16

Closed epsi1on closed 5 years ago

epsi1on commented 5 years ago

Hi, Thanks for great code. After that i've had problem with a particular matrix and cholesky solver. For that matrix cholesky solver gave me an array of double.NaN. i am not sure if my matrix was positive definite, but i was expecting that if it is not SPD, then i get an matrix should be positive definite error. is it true?

Thanks

wo80 commented 5 years ago

Hey there!

Please check if your input matrix has NaNs. I just tested, and Cholesky (and probably the other factorizations too) does not throw an exception in this case.

If your input matrix has no NaNs, please upload the matrix and I will have a look (use the MatrixMarketWriter, availalable in the latest version of CSparse).

So, in general: should the factorization methods check for NaNs, or should that be left to the user? What do you think?

epsi1on commented 5 years ago

So, in general: should the factorization methods check for NaNs, or should that be left to the user? What do you think?

maybe better to left to user.

epsi1on commented 5 years ago

this is the matrix. right hand side have no NaN. this is matrix in matrix market format in zip file: http://s000.tinyupload.com/index.php?file_id=03650530592839178017

wo80 commented 5 years ago

Ok, a lot of NaNs in there. So i guess something went wrong when generating the matrix!

epsi1on commented 5 years ago

ok, got the problem