Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>(NOTE: This answer explains why R and RcppArmadillo return matrices with different dimensions, but not how to make RcppArmadillo return the 1000*20 matrix that R does. For that, perhaps take a look at the strategy used near the bottom of the <code>qr.Q()</code> function definition.) </p> <hr> <p>R's <code>qr()</code> function does not return Q directly. For that, you need to use <code>qr.Q()</code>, like this:</p> <pre><code>m &lt;- matrix(rnorm(10), ncol=2) qr.Q(qr(m)) # [,1] [,2] # [1,] -0.40909444 0.05243591 # [2,] 0.08334031 -0.07158896 # [3,] 0.38411959 -0.83459079 # [4,] -0.69953918 -0.53945738 # [5,] -0.43450340 0.06759767 </code></pre> <p>Notice that <code>qr.Q()</code> returns a matrix of the the same dimension as <code>m</code>, rather than a full 5*5 Q matrix. You can use the <code>complete=</code> argument to control this behavior, and get a Q matrix of full dimension:</p> <pre><code>qr.Q(qr(m), complete=TRUE) # [,1] [,2] [,3] [,4] [,5] # [1,] -0.40909444 0.05243591 0.3603937 -0.7158951 -0.43301590 # [2,] 0.08334031 -0.07158896 -0.8416121 -0.5231477 0.07703927 # [3,] 0.38411959 -0.83459079 0.2720003 -0.2389826 0.15752300 # [4,] -0.69953918 -0.53945738 -0.2552198 0.3453161 -0.18775072 # [5,] -0.43450340 0.06759767 0.1506125 -0.1935326 0.86400136 </code></pre> <p>In your case, it sounds like RcppArmadillo is returning the full 1000x1000 Q matrix (like <code>qr.Q(q(m, complete=FALSE))</code> would), rather than just its 1st 20 columns (like <code>qr.Q(q(m))</code> would).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload