Boost C++ Libraries: Ticket #11235: Variance error when used with std::complex
https://svn.boost.org/trac10/ticket/11235
<p>
The result of variance in complex numbers sequence must be real, but it is complex.
</p>
<p>
It is solved changing the line (in "variance.hpp"):
</p>
<blockquote>
<p>
this->variance =
</p>
<blockquote>
<p>
numeric::fdiv(this->variance * (cnt - 1), cnt)
</p>
</blockquote>
<p>
+ numeric::fdiv(tmp * tmp, cnt - 1);
</p>
</blockquote>
<p>
with this one:
</p>
<blockquote>
<p>
this->variance =
</p>
<blockquote>
<p>
numeric::fdiv(this->variance * (cnt - 1), cnt)
</p>
</blockquote>
<p>
+ numeric::fdiv(std::pow(std::abs(tmp),2), cnt - 1);
</p>
</blockquote>
<p>
P.D: sorry, I don't know how to fix it in "lazy_variance"
</p>
en-usBoost C++ Libraries/htdocs/site/boost.png
https://svn.boost.org/trac10/ticket/11235
Trac 1.4.3