Opened 7 years ago
#11235 new Bugs
Variance error when used with std::complex
Reported by: | Owned by: | Eric Niebler | |
---|---|---|---|
Milestone: | To Be Determined | Component: | accumulator |
Version: | Boost 1.58.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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"
Note:
See TracTickets
for help on using tickets.