简体   繁体   中英

Eigen sparse matrix determinant is zero

I am trying to compute if a sparse matrix I am operating on is positive definite. For this I am trying to use the sylvester criterion, meaning that the leading minors are positive.

To calculate the determinant of the matrix I am constructing a sparseLU solver of each block of the matrix, which can then give me the determinant of the matrix. But starting from a certain dimension (around 130*130) I am getting the result that all determinants are 0. This is not some special dimension in my problem (the matrix has blocks of 32*32) so I am believing this issue is related to some truncation algorithm applied by Eigen with determinants simply falling below some thresholds.

My search for such a mechanism has resulted in no decent results. My matrix has dimensions of around 16k*16k and all non-zero elements are on the on the 96 elements near the diagonal.

Is any truncation mechanism implemented in Eigen and can I control its thresholds somehow?

This is very likely due to underflow, ie, the determinant is calculated as a product of lots of numbers smaller than 1.0 . If you calculate the product of 130 values around 0.5 you are near the border of what can be represented with single precision floats.

You can use the methods logAbsDeterminant and signDeterminant to get meaningful results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM