[Boost-bugs] [Boost C++ Libraries] #11235: Variance error when used with std::complex

Subject: [Boost-bugs] [Boost C++ Libraries] #11235: Variance error when used with std::complex
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-24 11:20:58


#11235: Variance error when used with std::complex
-------------------------------------------------+-------------------------
 Reporter: Martín Sanz Sabater <martin.sanz@…> | Owner:
     Type: Bugs | eric_niebler
Milestone: To Be Determined | Status: new
  Version: Boost 1.58.0 | Component: accumulator
 Keywords: | Severity: Problem
-------------------------------------------------+-------------------------
 The result of variance in complex numbers sequence must be real, but it is
 complex.

 It is solved changing the line (in "variance.hpp"):
         this->variance =
                     numeric::fdiv(this->variance * (cnt - 1), cnt)
                   + numeric::fdiv(tmp * tmp, cnt - 1);

 with this one:
         this->variance =
                     numeric::fdiv(this->variance * (cnt - 1), cnt)
                   + numeric::fdiv(std::pow(std::abs(tmp),2), cnt - 1);


 P.D: sorry, I don't know how to fix it in "lazy_variance"

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11235>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC