Class: TDigest::Centroid
- Inherits:
-
Object
- Object
- TDigest::Centroid
- Defined in:
- lib/tdigest/centroid.rb
Instance Attribute Summary collapse
-
#cumn ⇒ Object
Returns the value of attribute cumn.
-
#mean ⇒ Object
Returns the value of attribute mean.
-
#mean_cumn ⇒ Object
Returns the value of attribute mean_cumn.
-
#n ⇒ Object
Returns the value of attribute n.
Instance Method Summary collapse
- #as_json(_ = nil) ⇒ Object
-
#initialize(mean, n, cumn, mean_cumn = nil) ⇒ Centroid
constructor
A new instance of Centroid.
Constructor Details
#initialize(mean, n, cumn, mean_cumn = nil) ⇒ Centroid
Returns a new instance of Centroid.
6 7 8 9 10 11 |
# File 'lib/tdigest/centroid.rb', line 6 def initialize(mean, n, cumn, mean_cumn = nil) @mean = mean @n = n @cumn = cumn @mean_cumn = mean_cumn end |
Instance Attribute Details
#cumn ⇒ Object
Returns the value of attribute cumn.
5 6 7 |
# File 'lib/tdigest/centroid.rb', line 5 def cumn @cumn end |
#mean ⇒ Object
Returns the value of attribute mean.
5 6 7 |
# File 'lib/tdigest/centroid.rb', line 5 def mean @mean end |
#mean_cumn ⇒ Object
Returns the value of attribute mean_cumn.
5 6 7 |
# File 'lib/tdigest/centroid.rb', line 5 def mean_cumn @mean_cumn end |
#n ⇒ Object
Returns the value of attribute n.
5 6 7 |
# File 'lib/tdigest/centroid.rb', line 5 def n @n end |
Instance Method Details
#as_json(_ = nil) ⇒ Object
13 14 15 |
# File 'lib/tdigest/centroid.rb', line 13 def as_json(_ = nil) { m: mean, n: n } end |