proxygen
folly::TDigest::Centroid Class Reference

#include <TDigest.h>

Public Member Functions

 Centroid (double mean=0.0, double weight=1.0)
 
double mean () const
 
double weight () const
 
double add (double sum, double weight)
 
bool operator< (const Centroid &other) const
 

Private Attributes

double mean_
 
double weight_
 

Detailed Description

Definition at line 52 of file TDigest.h.

Constructor & Destructor Documentation

folly::TDigest::Centroid::Centroid ( double  mean = 0.0,
double  weight = 1.0 
)
inlineexplicit

Definition at line 54 of file TDigest.h.

References weight().

55  : mean_(mean), weight_(weight) {
56  DCHECK_GT(weight, 0);
57  }
double weight() const
Definition: TDigest.h:63
double mean() const
Definition: TDigest.h:59

Member Function Documentation

double folly::TDigest::Centroid::add ( double  sum,
double  weight 
)
inline

Definition at line 369 of file TDigest.cpp.

References folly::TDigest::sum().

Referenced by folly::TDigest::merge(), and weight().

369  {
370  sum += (mean_ * weight_);
371  weight_ += weight;
372  mean_ = sum / weight_;
373  return sum;
374 }
double weight() const
Definition: TDigest.h:63
double sum() const
Definition: TDigest.h:114
double folly::TDigest::Centroid::mean ( ) const
inline

Definition at line 59 of file TDigest.h.

References mean_.

Referenced by folly::TDigest::merge(), and operator<().

59  {
60  return mean_;
61  }
bool folly::TDigest::Centroid::operator< ( const Centroid other) const
inline

Definition at line 72 of file TDigest.h.

References mean().

72  {
73  return mean() < other.mean();
74  }
double mean() const
Definition: TDigest.h:59
double folly::TDigest::Centroid::weight ( ) const
inline

Definition at line 63 of file TDigest.h.

References add(), folly::TDigest::sum(), and weight_.

Referenced by Centroid(), and folly::TDigest::merge().

63  {
64  return weight_;
65  }

Member Data Documentation

double folly::TDigest::Centroid::mean_
private

Definition at line 77 of file TDigest.h.

Referenced by mean().

double folly::TDigest::Centroid::weight_
private

Definition at line 78 of file TDigest.h.

Referenced by weight().


The documentation for this class was generated from the following files: