<p>It looks like we can solve the issues by introducing a function <code>void Ratio(double ratio)</code> to set the ratio parameter and to set the scale parameter once the ratio is changed. </p>

<pre><code>void Ratio(double r)
{
    ratio = r;
    scale = 1.0 / (1.0 - ratio);    
}
</code></pre>

<p>To avoid passing through the input matrix twice if the deterministic and rescale is true, we should rewrite the block as <a href="https://github.com/rcurtin" class="user-mention">@rcurtin</a> suggested:</p>

<pre><code>if (deterministic)
{
  if (!rescale)
    output = input;
  else
    output = input * scale;
}
</code></pre>

<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/pull/463#issuecomment-155209995">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFGbCsAXiagvY8joHHkIrA3MzUgwuks5pEQ00gaJpZM4GSg7s.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/463#issuecomment-155209995"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>