Documentation ¶
Overview ¶
Package movingmedian computes the median of a windowed stream of data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MovingMedian ¶
type MovingMedian struct {
// contains filtered or unexported fields
}
MovingMedian computes the moving median of a windowed stream of numbers.
func NewMovingMedian ¶
func NewMovingMedian(size int) MovingMedian
NewMovingMedian returns a MovingMedian with the given window size.
func (*MovingMedian) Median ¶
func (m *MovingMedian) Median() float64
Median returns the current value of the median from the window.
func (*MovingMedian) Push ¶
func (m *MovingMedian) Push(v float64)
Push adds an element to the stream, removing old data which has expired from the window. It runs in O(log windowSize).
Click to show internal directories.
Click to hide internal directories.