Vector to minimizer

I have this code to minimize a function.I have a vector to store my functions.How can i pass this into the second part where i do the minimization inside a loop?
Thanks
double AdBudg(const double xx ){
const double y[10] = {1,2,3,4,5,6,7,8,9,10};
const double x[10] = {1,2,3,4,5,6,7,8,9,10};
const double a = xx[0];
const double b = xx[1];
const double c = xx[2];
vector<double
> AdBudgMin;

for(int i=0;i<9;i++){
	return *AdBudgMin[i] = (TMath::Power(y[i]-(a*(TMath::Power(x[i],b)/((TMath::Power(x[i],b))+c))),2));

}

}

int BLModel::NumericalMinimization()
{
ROOT::Math::Minimizer* min =
ROOT::Math::factory::CreateMinimizer(“GSLMultiMin”, “BFGS”);

min->SetMaxFunctionCalls(1000000);
min->SetMaxIterations(100000);
min->SetTolerance(0.001);



ROOT::Math::Functor f(&AdBudg,3); 
double step[2] = {0.01,0.01};
double variable[3] = {1,1,1};

min->SetFunction(f);

min->SetVariable(0,"a",variable[0], step[0]);
min->SetVariable(1,"b",variable[1], step[0]);
min->SetVariable(2,"c",variable[2], step[0]);

min->Minimize(); 

const double *xs = min->X();
qDebug() << "Minimum: f(" << xs[0] << "," << xs[1] << "," << xs[2] << "): " 
	<< AdBudg(xs);

return 0;

}

Hi,

The code for minimizing looks fine to me. I do not understand your function definition. The function must be a scalar function, returning a number.
Lorenzo

Hi,
i noticed that the minimizer always returns ZERO.

ROOT::Math::Minimizer* min =
ROOT::Math::factory::CreateMinimizer(“GSLMultiMin”, “BFGS”);

So there is no minimizer and the code breaks!

I can not understand what is going on.any ideas?

Hi,

I guess MathMore is not present in your ROOT distribution. To have it, you need first to instal GSL, then re-configure and re-build ROOT
Cheers,
Lorenzo