Dear ROOT experts:

I am trying to minimize an object function like this:

f(lambda) = Σ_{i=1~n}(2ln(Σ_{j=1~m}L_{ij}*lambda[j])+(fX2[i]+fY2[i])/(Σ_{j=1~m}L_{ij}*lambda[j])).

Where lambda is a 1000 dimension array and L, fX2, fY2 are parameters stored in TTree.

I defined a class named Likelihood_FCN with reloaded operator() as this:

```
double Likelihood_FCN::operator()(const double* lambda)
{
double result = 0;
int nentry = t_ml->GetEntries();
for(int i =0; i < nentry; i++)
{
t_ml->GetEntry(i);
double temp = 0;
for(int j=0; j < fNVoxel; j++)
{
int index = fIndex[j];
temp+=fLength[j]*lambda[index];
std::cout << i<<": Length, lambda: " << fLength[j] << "," << lambda[index] << std::endl;
}
//std::cout<<"temp: "<<temp <<std::endl;
result+=2*TMath::Log(temp)+(fScatt_Ang_X2+fScatt_Ang_Y2)/temp;
}
std::cout << result << std::endl;
return result;
}
```

And the minimizer is defined as below:

```
ROOT::Math::Minimizer* minim = ROOT::Math::Factory::CreateMinimizer("Minuit2","Migrad");
minim->SetMaxFunctionCalls(10000);
minim->SetMaxIterations(10000);
minim->SetTolerance(1);
minim->SetPrintLevel(3);
Likelihood_FCN lf = Likelihood_FCN("PoCA_Result.root","ML_Info","PoCA");
int nvariable = lf.GetNVariable();
ROOT::Math::Functor f(lf, nvariable);
double *init_value = lf.Init();
lf(init_value);
minim->SetFunction(f);
for(int i=0;i<nvariable;i++)
{
const string name = "x" + std::to_string(i);
minim->SetLowerLimitedVariable(i,name,init_value[i],0.1,2.3);
}
minim->Minimize();
```

Segmentation fault occurs when I set the minimization strategy other than “Combined”.

The minimization result is an array of -nan value.

Besides, the evaluations of the FCN during minimization are also -nan, which should not

occur unless all members of lambda is 0.

Could you give some advice on the -nan result ?

The related files are here:

MLEM.tar.gz (123.4 KB)

Best,

Zhi Yu

ROOT Version (6.10/02):

Platform, compiler (e.g. Ubuntu 14.04, gcc4.8):