This forum has been archived. All content is frozen. Please use KDE Discuss instead.

QR Decomposition and Sign of Determinant

Tags: None
(comma "," separated)
allanmulin
Registered Member
Posts
14
Karma
0
Hello, it seems that all QR decomposition in Eigen only provides the absolute value of the determinant of the decomposed matrix (the log of this value can also be queried). I understand that this simplifies considerably the calculation, since only the product of the diagonal entries of R is performed, neglecting the determinant of Q which is either +1 or -1.

However, I am facing a problem that requires the sign of the determinant (its absolute value is of no importance). This necessity can be found in continuation methods for non-linear problems.

So, how could I find efficiently (i.e. linear complexity O(n) if possible) the sign of the determinant of A, where AP=QR and P a permutation matrix?
allanmulin
Registered Member
Posts
14
Karma
0
Okay, I will answer my own question in case someone needs this in the future. This is basically the approach discussed in the link below translated to Eigen.

http://icl.cs.utk.edu/lapack-forum/view ... f=2&t=1741

The determinant of Q is given by: det(Q) = (-1)^k, where k is the number of Householder reflections used in the QR decomposition. Assume:

HouseholderQR<MatrixXd> QR(A);

The number k is then the number of non-zero Householder coefficients in the vector QR.hCoeffs().
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Thanks for sharing your finding. Patch welcome for adding true determinant() functions to the QR classes.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell