Rank Revealing QR decomposition: obtaining rank

55 views
Skip to first unread message

Hugo Ferreira

unread,
Feb 27, 2017, 12:51:00 PM2/27/17
to Scala Breeze
Hello,

I am trying to use RR QR decomposition to determine collinearity.
I have seen that we can obtain the rank via SVD, however I would
like to use a RR QR with pivoting that will also allow me to identify
the collinear columns (avoid repeated calculation with SVD).

Does Breeze have a RR QR algorithm with pivoting? If so, does
it provide access to the rank? If not, can we calculate it based on
the R matrix?

TIA,
HF

David Hall

unread,
Feb 27, 2017, 3:00:58 PM2/27/17
to scala-...@googlegroups.com
Breeze has a QR with pivoting (qrp) which can (apparently? maybe?) be used to derive the rank. It's supposed to be like [q, r, p] = qr(m) in matlab. Though I honestly don't really know enough to say more. All I know is what I read at this google books link, and that we have qrp. :)


--
You received this message because you are subscribed to the Google Groups "Scala Breeze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-breeze+unsubscribe@googlegroups.com.
To post to this group, send email to scala-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-breeze/c6886f9d-8349-431a-8aa9-2b288e13bcf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hugo Ferreira

unread,
Mar 1, 2017, 1:04:45 PM3/1/17
to Scala Breeze
Hi David,

Appreciate the feedback.

The issue I have is actually finding out how to determine the rank.

I have found 2 methods - one that uses a matrix norm [2] (apache math commons project)
and another that simply checks for non zero diagonal elements in the R matrix
(no.uib.cipr.matrix.QRP, see [1]). The latter uses LAPACK (see
"com.github.fommil.netlib.LAPACK" in [3])

My understanding is that Breeze is using netlib-java. Can you tell me if you are
using DGEQP3? If so I may be able to use the code snippet below taken from [1].
Does this make sense? If this is doable maybe it can also be included into the Beeze code.

Please note that I am not knowledgeable about matrix or any other numeric computation methods, hence the questions.

TIA,
HF
 

1. https://github.com/fommil/matrix-toolkits-java/blob/master/src/main/java/no/uib/cipr/matrix/QRP.java
2. https://en.wikipedia.org/wiki/Matrix_norm#Frobenius_norm
3. https://github.com/fommil/netlib-java

       
 /*
         * Calculate the rank based on a precision EPS
         */

       
final double EPS = 1e-12;
       
for (rank = 0; rank < k; rank++) {
           
if (Math.abs(R.get(rank, rank)) < EPS)
               
break;
       
}



On Monday, 27 February 2017 20:00:58 UTC, David Hall wrote:
Breeze has a QR with pivoting (qrp) which can (apparently? maybe?) be used to derive the rank. It's supposed to be like [q, r, p] = qr(m) in matlab. Though I honestly don't really know enough to say more. All I know is what I read at this google books link, and that we have qrp. :)

On Mon, Feb 27, 2017 at 5:14 AM, Hugo Ferreira <hugo6f...@gmail.com> wrote:
Hello,

I am trying to use RR QR decomposition to determine collinearity.
I have seen that we can obtain the rank via SVD, however I would
like to use a RR QR with pivoting that will also allow me to identify
the collinear columns (avoid repeated calculation with SVD).

Does Breeze have a RR QR algorithm with pivoting? If so, does
it provide access to the rank? If not, can we calculate it based on
the R matrix?

TIA,
HF

--
You received this message because you are subscribed to the Google Groups "Scala Breeze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-breeze...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages