Documentation ¶
Index ¶
- Variables
- func RandomValues(count int) []float64
- func RandomValuesWithMax(count int, max float64) []float64
- func Range(start, end float64) []float64
- func RangeWithStep(start, end, step float64) []float64
- type Array
- type Buffer
- func (b *Buffer) Array() Array
- func (b *Buffer) Capacity() int
- func (b *Buffer) Clear()
- func (b *Buffer) Dequeue() float64
- func (b *Buffer) Each(mapfn func(int, float64))
- func (b *Buffer) Enqueue(value float64)
- func (b *Buffer) GetValue(index int) float64
- func (b *Buffer) Len() int
- func (b *Buffer) Peek() float64
- func (b *Buffer) PeekBack() float64
- func (b *Buffer) SetCapacity(capacity int)
- func (b *Buffer) String() string
- func (b *Buffer) TrimExcess()
- type Linear
- func (lg Linear) End() float64
- func (lg Linear) GetValue(index int) float64
- func (lg Linear) Len() int
- func (lg Linear) Start() float64
- func (lg Linear) Step() float64
- func (lg *Linear) WithEnd(end float64) *Linear
- func (lg *Linear) WithStart(start float64) *Linear
- func (lg *Linear) WithStep(step float64) *Linear
- type Provider
- type Random
- type Seq
- func (s Seq) Array() (output []float64)
- func (s Seq) Average() float64
- func (s Seq) Each(mapfn func(int, float64))
- func (s Seq) FoldLeft(mapfn func(i int, v0, v float64) float64) (v0 float64)
- func (s Seq) FoldRight(mapfn func(i int, v0, v float64) float64) (v0 float64)
- func (s Seq) Map(mapfn func(i int, v float64) float64) Seq
- func (s Seq) Max() float64
- func (s Seq) Median() (median float64)
- func (s Seq) Min() float64
- func (s Seq) MinMax() (min, max float64)
- func (s Seq) Normalize() Seq
- func (s Seq) Percentile(percent float64) (percentile float64)
- func (s Seq) Sort() Seq
- func (s Seq) StdDev() float64
- func (s Seq) Sum() (accum float64)
- func (s Seq) Variance() float64
Constants ¶
This section is empty.
Variables ¶
var Time timeSequence
Time is a utility singleton with helper functions for time seq generation.
Functions ¶
func RandomValues ¶
RandomValues returns an array of random values.
func RandomValuesWithMax ¶
RandomValuesWithMax returns an array of random values with a given average.
func Range ¶
Range returns the array values of a linear seq with a given start, end and optional step.
func RangeWithStep ¶
RangeWithStep returns the array values of a linear seq with a given start, end and optional step.
Types ¶
type Array ¶
type Array []float64
Array is a wrapper for an array of floats that implements `ValuesProvider`.
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a fifo datastructure that is backed by a pre-allocated array. Instead of allocating a whole new node object for each element, array elements are re-used (which saves GC churn). Enqueue can be O(n), Dequeue is generally O(1). Buffer implements `seq.Provider`
func NewBufferWithCapacity ¶
NewBufferWithCapacity creates a new ValueBuffer pre-allocated with the given capacity.
func (*Buffer) Len ¶
Len returns the length of the Buffer (as it is currently populated). Actual memory footprint may be different.
func (*Buffer) SetCapacity ¶
SetCapacity sets the capacity of the Buffer.
func (*Buffer) TrimExcess ¶
func (b *Buffer) TrimExcess()
TrimExcess resizes the capacity of the buffer to better fit the contents.
type Linear ¶
type Linear struct {
// contains filtered or unexported fields
}
Linear is a stepwise generator.
type Random ¶
type Random struct {
// contains filtered or unexported fields
}
Random is a random number seq generator.
type Seq ¶
type Seq struct {
Provider
}
Seq is a utility wrapper for seq providers.
func (Seq) Percentile ¶
Percentile finds the relative standing in a slice of floats. `percent` should be given on the interval [0,1.0).