private void Initialize(OptMultivariateFunction function, OptMultivariateGradient gradient, OptBoundVariable[] variables) { this.internalFunction = new SFUN(function, gradient, variables); this.MeOptVariable = null; this.MeOptBoundVariable = OptBoundVariable.GetClon(variables); this.CheckAndSetBounds(this.MeOptBoundVariable); this.MeExternalVariables = new double[this.MeOptBoundVariable.Length]; int numFreeVariable = 0; for (int i = 0; i < this.MeOptBoundVariable.Length; i++) { this.MeExternalVariables[i] = variables[i].InitialGuess; if (this.MeOptBoundVariable[i].Fixed == false) numFreeVariable++; } this.MeF = function(this.MeExternalVariables); this.MeNumFreeVariables = numFreeVariable; this.MeFreeVariables = new double[numFreeVariable]; this.MeGradientArray = new double[numFreeVariable]; int index = 0; for (int i = 0; i < this.MeOptBoundVariable.Length; i++) { if (this.MeOptBoundVariable[i].Fixed == false) { this.MeFreeVariables[index] = this.MeOptBoundVariable[i].InitialGuess; index++; } } //W - (REAL*8)(REAL*8) WORK VECTOR OF LENGTH AT LEAST 14*N //LW - (INTEGER) THE DECLARED DIMENSION OF W this.MeLW = 14 * this.MeNumFreeVariables; this.MeW = new double[this.MeLW]; this.MeMAXIT = Math.Max(1, this.MeNumFreeVariables / 2); }