Changeset 6323 for issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp
- Timestamp:
- 10/15/10 16:13:34 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp
r5607 r6323 41 41 fx1= (*f)(x1,optargs); 42 42 if isnan(fx1) ISSMERROR("Function evaluation returned NaN"); 43 _printf_("\n Iteration x f(x) Tolerance\n\n");44 _printf_(" %s %12.6g %12.6g %s"," N/A",x1,fx1," N/A\n");43 ISSMPRINTF(VerboseControl(),"\n Iteration x f(x) Tolerance\n\n"); 44 ISSMPRINTF(VerboseControl()," %s %12.6g %12.6g %s"," N/A",x1,fx1," N/A\n"); 45 45 46 46 //update tolerances … … 54 54 fx2 = (*f)(x2,optargs); 55 55 if isnan(fx2) ISSMERROR("Function evaluation returned NaN"); 56 _printf_(" %5i %12.6g %12.6g %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1));56 ISSMPRINTF(VerboseControl()," %5i %12.6g %12.6g %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1)); 57 57 58 58 //Stop the optimization? 59 59 if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){ 60 _printf_(" %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance);60 ISSMPRINTF(VerboseControl()," %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance); 61 61 loop=false; 62 62 } 63 63 else if (iter>=maxiter){ 64 _printf_(" %s\n","exiting: Maximum number of iterations has been exceeded - increase 'maxiter'\n");64 ISSMPRINTF(VerboseControl()," %s\n","exiting: Maximum number of iterations has been exceeded - increase 'maxiter'\n"); 65 65 loop=false; 66 66 }
Note:
See TracChangeset
for help on using the changeset viewer.