Delegate which calculates objective function is defined as
Code:
public delegate void ndimensional_fvec (double[] arg, double[] fi, object obj)
As you may see, it is possible to assign some array directly to
fi. But - because it is passed without "ref" - this assignment won't modify original array. This change will be visible within function only.
It was done on purpose because a) excessive memory allocations may cost too much (even in C#), so this design tries to reduce number of allocations, and b) in order to avoid corruption of the internal memory structures, i.e. to restrict access to the array - you can access its elements, but can't change array size.