#8989 Grid statistics: Improve precision of p10/p90.

This commit is contained in:
Kristian Bendiksen
2022-06-13 09:46:42 +02:00
parent 34a05ec5f4
commit 226ac4f2b6
9 changed files with 176 additions and 2 deletions

View File

@@ -130,6 +130,40 @@ public:
double min;
};
class PercentilAccumulator
{
public:
PercentilAccumulator() {}
void addData( const std::vector<double>& values )
{
for ( double val : values )
{
addValue( val );
}
}
void addData( const std::vector<float>& values )
{
for ( float val : values )
{
addValue( val );
}
}
void addValue( double value ) { values.push_back( value ); }
void computep10p90( double& p10, double& p90 )
{
double mean = HUGE_VAL;
double p50 = HUGE_VAL;
RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean, RigStatisticsMath::PercentileStyle::SWITCHED );
}
std::vector<double> values;
};
class PosNegAccumulator
{
public: