// Add an extra mask*multiplier term to the excitation. func (e *excitation) Add(mask *data.Slice, f script.ScalarFunction) { var mul func() float64 if f != nil { if Const(f) { val := f.Float() mul = func() float64 { return val } } else { mul = func() float64 { return f.Float() } } } e.AddGo(mask, mul) }
func (p *ScalarParam) setRegionsFunc(r1, r2 int, f script.ScalarFunction) { if Const(f) { p.setRegions(r1, r2, []float64{f.Float()}) } else { f := f.Fix() // fix values of all variables except t p.setFunc(r1, r2, func() []float64 { return []float64{f.Eval().(script.ScalarFunction).Float()} }) } }