Version: v0.0.0-...-b314203 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2016 License: MIT Imports: 3 Imported by: 1



提供了一些其余的工具,包括sliding window 以及由unixtime判断北京时间的函数



This section is empty.


This section is empty.


func DayInBJ

func DayInBJ(t time.Time) int64

DayInBJ 时间对应的北京时间日期序号

func Prod

func Prod(values *SlidingWindow) (float64, error)

func StartOfBJTime

func StartOfBJTime(t time.Time) time.Time

StartOfBJTime 获取当天北京时间零点

func StartOfBJTimeI

func StartOfBJTimeI(day int64) time.Time

StartOfBJTimeI 从北京时间日期序号获得时间零点


type Item

type Item struct {
	Key string
	Val float64

type MapSorter

type MapSorter []Item

func NewMapSorter

func NewMapSorter(m map[string]float64) MapSorter

func (MapSorter) Len

func (ms MapSorter) Len() int

func (MapSorter) Less

func (ms MapSorter) Less(i, j int) bool


func (MapSorter) Swap

func (ms MapSorter) Swap(i, j int)

type SlidingWindow

type SlidingWindow struct {
	// contains filtered or unexported fields

func AboveValue

func AboveValue(Ra *SlidingWindow, v float64) (*SlidingWindow, error)

func Abs

func Abs(values *SlidingWindow) (*SlidingWindow, error)

func Add

func Add(x float64, values *SlidingWindow) (*SlidingWindow, error)

func Add2

func Add2(values1 *SlidingWindow, values2 *SlidingWindow) (*SlidingWindow, error)

func CreateList

func CreateList(value float64, length int) (*SlidingWindow, error)

func ElementMulti

func ElementMulti(values1 *SlidingWindow, values2 *SlidingWindow) (*SlidingWindow, error)

func Log

func Log(values *SlidingWindow) (*SlidingWindow, error)

func Multi

func Multi(x float64, values *SlidingWindow) (*SlidingWindow, error)

func Negative

func Negative(values *SlidingWindow) (*SlidingWindow, error)

func NewSlidingWindow

func NewSlidingWindow(size int) (*SlidingWindow, error)

func PosNegValues

func PosNegValues(values *SlidingWindow) (positivevalues, negativevalues *SlidingWindow, err error)

find out positive and negtive values

func Power

func Power(values *SlidingWindow, x float64) (*SlidingWindow, error)

func Sub

func Sub(values1 *SlidingWindow, values2 *SlidingWindow) (*SlidingWindow, error)

func (*SlidingWindow) Add

func (w *SlidingWindow) Add(value float64)

func (*SlidingWindow) Average

func (w *SlidingWindow) Average() (average float64)

func (*SlidingWindow) Count

func (w *SlidingWindow) Count() int

func (*SlidingWindow) Data

func (w *SlidingWindow) Data() []float64

func (*SlidingWindow) DiffAbsAve

func (w *SlidingWindow) DiffAbsAve() (diffAbsAverage float64)

func (*SlidingWindow) First

func (w *SlidingWindow) First() (value float64)

func (*SlidingWindow) Max

func (w *SlidingWindow) Max() (value float64, position int)

func (*SlidingWindow) Min

func (w *SlidingWindow) Min() (value float64, position int)

func (*SlidingWindow) RefData

func (w *SlidingWindow) RefData(ref int) (value float64)

func (*SlidingWindow) StdDev

func (w *SlidingWindow) StdDev() (stddev float64)

func (*SlidingWindow) Sum

func (w *SlidingWindow) Sum() (total float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL