<p>If you prefer single thread version(or mixed them according to the size of matrix), std::transform can make things easier</p>

<pre><code>std::transform(input.memptr(), input.memptr() + input.n_elems, 
output.memptr(), [=](T val){ return val &gt; threshold &gt; 1 : 0; });
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/666#issuecomment-224790383">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFGhzcVb_kx4rl6Z4aS8KC0wJCfMHks5qJ4U6gaJpZM4IsxhK">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFExCLHwGhCxCapz2L5aCh9fZHPHxks5qJ4U6gaJpZM4IsxhK.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/pull/666#issuecomment-224790383"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>