@@ -275,7 +275,7 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
275275
276276// c Test for convergence.
277277
278- if (f <= ftest && abs (g) <= gtol * (-ginit)) {
278+ if (f <= ftest && std:: abs (g) <= gtol * (-ginit)) {
279279 strcpy (task, " CONVERGENCE" );
280280 // strcpy(task, "CONVERGENCE", 11);
281281 }
@@ -320,9 +320,9 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
320320 }
321321// c Decide if a bisection step is needed.
322322 if (brackt) {
323- if (abs (sty - stx) >= p66 * width1) stp = stx + p5 * (sty - stx);
323+ if (std:: abs (sty - stx) >= p66 * width1) stp = stx + p5 * (sty - stx);
324324 width1 = width;
325- width = abs (sty-stx);
325+ width = std:: abs (sty-stx);
326326 }
327327// c Set the minimum and maximum steps allowed for stp.
328328
@@ -475,7 +475,7 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
475475
476476 double gamma, p, q, r, s, sgnd, stpc, stpf, stpq, theta;
477477
478- sgnd = dp*(dx/abs (dx));
478+ sgnd = dp*(dx/std:: abs (dx));
479479
480480// c First case: A higher function value. The minimum is bracketed.
481481// c If the cubic step is closer to stx than the quadratic step, the
@@ -484,16 +484,16 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
484484
485485 if (fp > fx) {
486486 theta = three*(fx-fp)/(stp-stx) + dx + dp;
487- double temps = std::max (abs (theta),abs (dx)); // get max(abs(theta),abs(dx),abs(dp))
488- s = std::max (temps,abs (dp));
487+ double temps = std::max (std:: abs (theta),std:: abs (dx)); // get max(std:: abs(theta),std:: abs(dx),std:: abs(dp))
488+ s = std::max (temps,std:: abs (dp));
489489 gamma = s*sqrt (pow (theta/s, 2 )-(dx/s)*(dp/s));
490490 if (stp < stx) gamma = -gamma;
491491 p = (gamma-dx) + theta;
492492 q = ((gamma-dx)+gamma) + dp;
493493 r = p/q;
494494 stpc = stx + r*(stp-stx);
495495 stpq = stx + ((dx/((fx-fp)/(stp-stx)+dx))/two)*(stp-stx);
496- if (abs (stpc-stx) < abs (stpq-stx)) {
496+ if (std:: abs (stpc-stx) < std:: abs (stpq-stx)) {
497497 stpf = stpc;
498498 }
499499 else {
@@ -509,16 +509,16 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
509509
510510 else if (sgnd < zero) {
511511 theta = three*(fx-fp)/(stp-stx) + dx + dp;
512- double temps = std::max (abs (theta),abs (dx)); // get max(abs(theta),abs(dx),abs(dp))
513- s = std::max (temps,abs (dp));
512+ double temps = std::max (std:: abs (theta),std:: abs (dx)); // get max(std:: abs(theta),std:: abs(dx),std:: abs(dp))
513+ s = std::max (temps,std:: abs (dp));
514514 gamma = s*sqrt (pow (theta/s, 2 )-(dx/s)*(dp/s));
515515 if (stp > stx) gamma = -gamma;
516516 p = (gamma-dp) + theta;
517517 q = ((gamma-dp)+gamma) + dx;
518518 r = p/q;
519519 stpc = stp + r*(stx-stp);
520520 stpq = stp + (dp/(dp-dx))*(stx-stp);
521- if (abs (stpc-stp) > abs (stpq-stp)) {
521+ if (std:: abs (stpc-stp) > std:: abs (stpq-stp)) {
522522 stpf = stpc;
523523 }
524524 else {
@@ -530,14 +530,14 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
530530// c Third case: A lower function value, derivatives of the same sign,
531531// c and the magnitude of the derivative decreases.
532532
533- else if (abs (dp) < abs (dx)) {
533+ else if (std:: abs (dp) < std:: abs (dx)) {
534534// c The cubic step is computed only if the cubic tends to infinity
535535// c in the direction of the step or if the minimum of the cubic
536536// c is beyond stp. Otherwise the cubic step is defined to be the
537537// c secant step.
538538 theta = three*(fx-fp)/(stp-stx) + dx + dp;
539- double temps = std::max (abs (theta),abs (dx)); // get max(abs(theta),abs(dx),abs(dp))
540- s = std::max (temps,abs (dp));
539+ double temps = std::max (std:: abs (theta),std:: abs (dx)); // get max(std:: abs(theta),std:: abs(dx),std:: abs(dp))
540+ s = std::max (temps,std:: abs (dp));
541541// c The case gamma = 0 only arises if the cubic does not tend
542542// c to infinity in the direction of the step.
543543 gamma = s*sqrt (std::max (zero,pow (theta/s, 2 )-(dx/s)*(dp/s)));
@@ -560,7 +560,7 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
560560// c A minimizer has been bracketed. If the cubic step is
561561// c closer to stp than the secant step, the cubic step is
562562// c taken, otherwise the secant step is taken.
563- if (abs (stpc-stp) < abs (stpq-stp)) {
563+ if (std:: abs (stpc-stp) < std:: abs (stpq-stp)) {
564564 stpf = stpc;
565565 }
566566 else {
@@ -577,7 +577,7 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
577577// c A minimizer has not been bracketed. If the cubic step is
578578// c farther from stp than the secant step, the cubic step is
579579// c taken, otherwise the secant step is taken.
580- if (abs (stpc-stp) > abs (stpq-stp)) {
580+ if (std:: abs (stpc-stp) > std:: abs (stpq-stp)) {
581581 stpf = stpc;
582582 }
583583 else {
@@ -594,8 +594,8 @@ int dcsrch(double &stp, double &f, double &g, double &ftol, double >ol, double
594594 else {
595595 if (brackt) {
596596 theta = three*(fp-fy)/(sty-stp) + dy + dp;
597- double temps = std::max (abs (theta),abs (dy)); // get max(abs(theta),abs(dy),abs(dp))
598- s = std::max (temps,abs (dp));
597+ double temps = std::max (std:: abs (theta),std:: abs (dy)); // get max(std:: abs(theta),std:: abs(dy),std:: abs(dp))
598+ s = std::max (temps,std:: abs (dp));
599599 gamma = s*sqrt (pow (theta/s,2 )-(dy/s)*(dp/s));
600600 if (stp > sty) gamma = -gamma;
601601 p = (gamma-dp) + theta;
0 commit comments