<p>Hm, so we can't easily determine the amount of available RAM.  One way to do this is to attempt to allocate the memory we need for the transpose, then if that fails, use <code>inplace_trans()</code>.  Looking at <code>armadillo_bits/debug.hpp</code>, when an allocation fails, the error will be printed (unless <code>ARMA_PRINT_ERRORS</code> is not defined), and then a <code>std::bad_alloc</code> is thrown.  Maybe a solution is to try and catch the <code>bad_alloc</code>, and if that happens, then transpose inplace?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/203#issuecomment-75119669">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFEKFa3hLxU3D_VOFN-5q95e5641Gks5ntjIAgaJpZM4DM1po.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/203#issuecomment-75119669"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>