0

Is there any way to get the pivot matrix in Eigen when doing QR decomposition? I use ColPivHouseholderQR which performs AP = QR and I don't get how can I have access to matrix P. Thanks in advance

I need to have the permutation/pivot and I don't know how to extract it in Eigen.

Hamed
  • 11
  • 3
  • 1
    The method is called [`colsPermutation`](https://eigen.tuxfamily.org/dox/classEigen_1_1ColPivHouseholderQR.html#a8c0fc317edca9c71e0744dc2cd855b71) – Homer512 Mar 27 '23 at 15:18
  • @Homer512 Thank you very much! This is what I was looking for (more or less). But are you aware of any method to give this permutation as a compact vector? I mean something like lapack's dgeqpf where the permutation/pivot is not given like a matrix (full of zero) but like a vector called JPVT: "if JPVT(i) = k, then the i-th column of A*P was the k-th column of A." – Hamed Mar 27 '23 at 20:34
  • The [`PermuationMatrix::indices`](https://eigen.tuxfamily.org/dox/classEigen_1_1PermutationBase.html#a16fa3afafdf703399d62c80f950802f1) method gives you something like an `Eigen::VectorXi` with the indices. Permutation matrices in Eigen are just index vectors in disguise. – Homer512 Mar 27 '23 at 20:48
  • @Homer512 Thanks a bunch! I could not fix it without your help :) – Hamed Mar 27 '23 at 21:34

0 Answers0