6 |
|
|
7 |
|
model = nlmodel; |
8 |
|
//set the dimension |
9 |
< |
|
9 |
> |
|
10 |
|
#ifndef IS_MPI |
11 |
|
dim = model->getDim(); |
12 |
|
#else |
13 |
< |
|
13 |
> |
dim = model->getDim(); |
14 |
|
#endif |
15 |
|
prevGrad.resize(dim); |
16 |
|
gradient.resize(dim); |
65 |
|
|
66 |
|
maxIteration = paramSet->getMaxIteration(); |
67 |
|
|
68 |
< |
for(currentIter = 0;currentIter < maxIteration; currentIter++){ |
68 |
> |
for(currentIter = 1;currentIter <= maxIteration; currentIter++){ |
69 |
|
|
70 |
|
// perform line search to minimize f(x + lamda * direction) where stepSize > 0 |
71 |
|
lsMinimizer->minimize(direction, 0.0, 1.0); |
133 |
|
|
134 |
|
//test absolute gradient tolerance |
135 |
|
|
136 |
< |
if (sqrt(dotProduct(gradient, gradient)) < paramSet->getGradTol()) |
136 |
> |
if (sqrt(dotProduct(gradient, gradient)) < paramSet->getGTol()) |
137 |
|
return 1; |
138 |
|
else |
139 |
|
return -1; |