Changeset 15396 for issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp
- Timestamp:
- 07/02/13 09:24:16 (12 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:ignore
-
old new 1 par 2 ad 3 proj-* 1 4 projects 2 5 autom4te.cache
-
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 14311,14313,14316-14506,14508-15387,15390-15392
- Property svn:ignore
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp
r13975 r15396 9 9 #endif 10 10 11 #include "./numerics.h"12 #include "../../classes/objects/objects.h"13 #include "../../io/io.h"14 #include "../../include/include.h"15 #include "../../shared/shared.h"16 11 #include <float.h> 12 13 #include "../Exceptions/exceptions.h" 14 #include "../io/io.h" 15 #include "../MemOps/MemOps.h" 16 #include "./Verbosity.h" 17 #include "./OptPars.h" 18 #include "./OptArgs.h" 19 #include "./types.h" 20 #include "./isnan.h" 17 21 18 22 void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){ … … 43 47 if (xIsNan<IssmDouble>(fx1)) _error_("Function evaluation returned NaN"); 44 48 cout<<setprecision(5); 45 if(VerboseControl()) _p printLine_("");46 if(VerboseControl()) _p printLine_(" Iteration x f(x) Tolerance");47 if(VerboseControl()) _p printLine_("");48 if(VerboseControl()) _p printLine_(" N/A "<<setw(12)<<x1<<" "<<setw(12)<<fx1<<" N/A");49 if(VerboseControl()) _printf0_("\n"); 50 if(VerboseControl()) _printf0_(" Iteration x f(x) Tolerance\n"); 51 if(VerboseControl()) _printf0_("\n"); 52 if(VerboseControl()) _printf0_(" N/A "<<setw(12)<<x1<<" "<<setw(12)<<fx1<<" N/A\n"); 49 53 50 54 //update tolerances … … 59 63 if (xIsNan<IssmDouble>(fx2)) _error_("Function evaluation returned NaN"); 60 64 if(VerboseControl()) 61 _p printLine_(" "<<setw(5)<<iter<<" "<<setw(12)<<x2<<" "<<setw(12)<<fx2<<" "<<(fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1)));65 _printf0_(" "<<setw(5)<<iter<<" "<<setw(12)<<x2<<" "<<setw(12)<<fx2<<" "<<(fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1)) << "\n"); 62 66 63 67 //Stop the optimization? 64 68 if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){ 65 if(VerboseControl()) _p printLine_(" " << "optimization terminated: the current x satisfies the termination criteria using 'tolx' of " << tolerance);69 if(VerboseControl()) _printf0_(" " << "optimization terminated: the current x satisfies the termination criteria using 'tolx' of " << tolerance << "\n"); 66 70 loop=false; 67 71 } 68 72 else if (iter>=maxiter){ 69 if(VerboseControl()) _p printLine_(" " << "exiting: Maximum number of iterations has been exceeded - increase 'maxiter'");73 if(VerboseControl()) _printf0_(" " << "exiting: Maximum number of iterations has been exceeded - increase 'maxiter'\n"); 70 74 loop=false; 71 75 }
Note:
See TracChangeset
for help on using the changeset viewer.