func (r *Rosenbrock) Evaluate(in, out Parameter) float32 {
	sum := float64(0)
	for i := 0; i < r.numOfCopies; i += 1 {
		scale := float32(i + 1)
		t0 := in.Get(2*i+1) - in.Get(2*i)*in.Get(2*i)
		t1 := 1.0 - in.Get(2*i)
		sum += float64(scale * (100.0*t0*t0 + t1*t1))
		out.Set(2*i+0, scale*(-400*t0*in.Get(2*i)-2*t1))
		out.Set(2*i+1, scale*200*t0)
	}
	r.count += 1
	return float32(sum)
}
// This implementation should only work with parameter that have indexes
// range from [0, 2*numOfCopies).
This implementation should only work with parameter that have indexes
range from [0, 2*numOfCopies).
// This implementation should only work with parameter that have indexes // range from [ 0 2 * numOfCopies ) .
func (r *Rosenbrock) Evaluate(in, out Parameter) float32 {
	sum := float64(0)
	for i := 0; i < r.numOfCopies; i += 1 {
		scale := float32(i + 1)
		t0 := in.Get(2*i+1) - in.Get(2*i)*in.Get(2*i)
		t1 := 1.0 - in.Get(2*i)
		sum += float64(scale * (100.0*t0*t0 + t1*t1))
		out.Set(2*i+0, scale*(-400*t0*in.Get(2*i)-2*t1))
		out.Set(2*i+1, scale*200*t0)
	}
	r.count += 1
	return float32(sum)
}
func ( r * Rosenbrock ) Evaluate ( in , out Parameter ) float32 { sum := float64 ( 0 ) for i := 0 ; i < r . numOfCopies ; i += 1 { scale := float32 ( i + 1 ) t0 := in . Get ( 2 * i + 1 ) - in . Get ( 2 * i ) * in . Get ( 2 * i ) t1 := 1.0 - in . Get ( 2 * i ) sum += float64 ( scale * ( 100.0 * t0 * t0 + t1 * t1 ) ) out . Set ( 2 * i + 0 , scale * ( - 400 * t0 * in . Get ( 2 * i ) - 2 * t1 ) ) out . Set ( 2 * i + 1 , scale * 200 * t0 ) } r . count += 1 return float32 ( sum ) }
This implementation should only work with parameter that have indexes
range from [0, 2*numOfCopies).
This implementation should only work with parameter that have indexes range from [ 0 2 * numOfCopies ) .