title: Select Armadillo sub-matrix with non contiguous indices
body: <p>I am passing a python code to C++ where I find python expressions like this:</p>
  
  <pre><code>J11 = dS_dVa[array([pvpq]).T, pvpq].real
  </code></pre>
  
  <p>Here, <code>J11</code> and <code>dS_dVa</code> are Sparse matrices, and <code>pvpq</code> is an array of indices that can be in any growing order (ie. 1, 2, 5, 7, 9)</p>
  
  <p>Looking at the documentation <a href="http://arma.sourceforge.net/docs.html#submat" rel="nofollow noreferrer">here</a> I have inferred the following:</p>
  
  <pre><code>arma::Row&lt;int&gt; pvpq(calc-&gt;pqpv);
  
  arma::sp_mat J11 = arma::real(dS_dVa.submat(pvpq, pvpq));
  </code></pre>
  
  <p>where <code>calc-&gt;pqpv</code> is of type <code>std::vector&lt;int&gt;</code>.</p>
  
  <p>However the GCC compiler says:</p>
  
  <pre><code>engine.h:2436: error: no matching function for call to ‘arma::SpMat&lt;std::complex&lt;double&gt; &gt;::submat(arma::Row&lt;int&gt;&amp;, arma::Row&lt;int&gt;&amp;)’
           arma::sp_mat J11 = arma::real(dS_dVa.submat(pvpq, pvpq));
                                                                 ^
  </code></pre>
  
  <p>How do I fix this?</p>
  
  <p>Is it telling me that Sparse matrices do not have the <code>submat</code> method?</p>