func (p *peer) allocateCoeffs() {
	p.c, p.errorModelWeights = make([]float64, p.Stages), make([]float64, p.Stages)
	p.b = util.MakeSquare(p.Stages)
	p.a0 = util.MakeSquare(p.Stages)
	p.cv = util.MakeSquare(p.Stages)
	p.pv = util.MakeSquare(p.Stages)
}
示例#2
0
func (p *peer) setupIntegration(t, tEnd float64, yT []float64, c *Config) (i integration) {
	i.n = uint(len(yT))

	// set default parameters if necessary
	if c.MaxStepSize <= 0.0 {
		c.MaxStepSize = tEnd - t
	}
	if c.MinStepSize <= 0.0 {
		c.MinStepSize = 1e-10
	}
	if c.MaxStepCount == 0 {
		c.MaxStepCount = 1000000
	}
	if c.AbsoluteTolerance <= 0.0 {
		c.AbsoluteTolerance = 1e-4
	}
	if c.RelativeTolerance <= 0.0 {
		c.RelativeTolerance = c.AbsoluteTolerance
	}

	i.Config = *c

	// allocate temp matrices
	i.errorFactors = make([]float64, i.n)
	i.pa = util.MakeSquare(p.Stages)

	i.yNew = util.MakeRectangular(p.Stages, i.n)
	i.yOld = util.MakeRectangular(p.Stages, i.n)
	i.fNew = util.MakeRectangular(p.Stages, i.n)
	i.fOld = util.MakeRectangular(p.Stages, i.n)

	copy(i.yOld[p.indexMinNode], yT)

	i.stepRatioMin = 0.2

	return
}
示例#3
0
func makeCoeffs(r *rk) {
	r.b, r.c, r.e = make([]float64, r.Stages), make([]float64, r.Stages), make([]float64, r.Stages)
	r.a = util.MakeSquare(r.Stages)
}