Beispiel #1
0
func newMeanVars(size int) []*meanvar.MeanVar {
	mvs := make([]*meanvar.MeanVar, size)
	for i := range mvs {
		mvs[i] = meanvar.New()
	}
	return mvs
}
Beispiel #2
0
// NewMeanVariances return a new MeanVariances of length maxl.
func NewMeanVariances(size int) *MeanVariances {
	mcc := MeanVariances{}
	for i := 0; i < size; i++ {
		mv := meanvar.New()
		mcc.meanvars = append(mcc.meanvars, mv)
	}
	return &mcc
}
Beispiel #3
0
func (cmd *cmdCr) collect(covsChan chan []Covariance) (covMVs, xMVs, yMVs []*meanvar.MeanVar) {
	covMVs = make([]*meanvar.MeanVar, cmd.maxl)
	xMVs = make([]*meanvar.MeanVar, cmd.maxl)
	yMVs = make([]*meanvar.MeanVar, cmd.maxl)
	for i := range covMVs {
		covMVs[i] = meanvar.New()
		xMVs[i] = meanvar.New()
		yMVs[i] = meanvar.New()
	}
	for covs := range covsChan {
		for i := range covs {
			n := covs[i].GetN()
			v := covs[i].GetResult()
			if n > 10 && !math.IsNaN(v) {
				covMVs[i].Increment(v)
				xMVs[i].Increment(covs[i].MeanX())
				yMVs[i].Increment(covs[i].MeanY())
			}
		}
	}
	return
}