title: RcppArmadillo expmat hangs for a 4x4 matrix
body: <p>I have a pathological 4x4 matrix that makes the <code>expmat</code> function in Armadillo hang. The pathological matrix is:</p>
  
  <pre><code>a&lt;-matrix(c(-2.5654e+060,4.6979e-018,2.5654e+060,7.2765e-035
              ,2.8913e+000, -3.6633e+001,3.3731e+001,1.0003e-002
              ,1.0656e-009,1.9037e-002, -1.9732e-001,1.7828e-001
              , 0e+000, 0e+000, 0e+000, 0e+000), nrow=4, byrow=T)
  </code></pre>
  
  <p>The .cpp file looks like this:</p>
  
  <pre><code># include &lt;RcppArmadillo.h&gt;
  // [[Rcpp::depends(RcppArmadillo)]]
  using namespace Rcpp;
  using namespace arma;
  
  // [[Rcpp::export]]
  mat exp_mat(mat x) {
    return(expmat(x));
  }
  </code></pre>
  
  <p>Feed the pathological matrix to this function would make it hang with a message:</p>
  
  <pre><code>warning: solve(): system seems singular; attempting approx solution
  </code></pre>
  
  <p>I know that this matrix is badly conditioned, but the <code>expm</code> function in R package "expm" can deal with it with no problem using its default algorithm. Is there anyway to get around this problem in RcppArmadillo? At least I want to avoid the hanging by dealing with the warning message.</p>
  
  <p>There is a similar question <a href="https://stackoverflow.com/questions/27591868/armadillo-c-expmat-stacks" title="here">here</a>, but I don't consider my question to be a duplicate since I just updated both Rcpp and RcppArmadillo right before posting. The problem in that other thread is supposed to have been fixed by Armadillo, so it seems there is something else going on here.</p>