Changeset 17897
- Timestamp:
- 04/30/14 14:41:58 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp
r17896 r17897 48 48 long indic = 4; /*compute f and g*/ 49 49 long reverse = 0; /*reverse or direct mode*/ 50 long ndz = 20000; /*Dimension of the working area*/51 double dz[20000]; /*Working array*/52 50 long iz[5]; /*Integer m1qn3 working array of size 5*/ 53 long niter = 200; /*Maximum number of iterations*/54 long nsim = 200; /*Maximum number of function calls*/55 51 long io = 6; /*Channel number for the output*/ 56 52 … … 58 54 double dxmin = 1.e-10; /*Resolution for the solution x*/ 59 55 double epsrel = 1.e-5; /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/ 56 long niter = 200; /*Maximum number of iterations*/ 57 long nsim = 200; /*Maximum number of function calls*/ 60 58 61 59 /*Get problem dimension and initialize gradient and initial guess*/ … … 65 63 for(int i=0;i<n;i++) x[i]=5.; 66 64 dzs[0] = 10; //c = 10 function parameter 65 66 /*Allocate m1qn3 working arrays (see doc)*/ 67 long m = 100; 68 long ndz = 4*n+m*(2*n+1); 69 double* dz = xNew<double>(ndz); 67 70 68 71 if(VerboseControl())_printf0_(" Computing initial solution\n"); … … 76 79 77 80 switch(int(omode)){ 78 case 0: _printf0_(" Stop requiered\n"); break;79 case 1: _printf0_(" Stop on epsg (gradient too small)\n"); break;80 case 2: _printf0_(" Bad initialization\n"); break;81 case 3: _printf0_(" Line search failure\n"); break;82 case 4: _printf0_(" Maximum number of iterations exceeded\n");break;83 case 5: _printf0_(" Maximum number of function calls exceeded\n"); break;84 case 6: _printf0_(" stoped on dxmin during line search\n"); break;85 case 7: _printf0_(" <g,d> > 0 or <y,s> <0\n"); break;86 default: _printf0_(" Unknown end condition\n");81 case 0: _printf0_(" Stop requested (indic = 0)\n"); break; 82 case 1: _printf0_(" Convergence reached (gradient satisfies stopping criterion)\n"); break; 83 case 2: _printf0_(" Bad initialization\n"); break; 84 case 3: _printf0_(" Line search failure\n"); break; 85 case 4: _printf0_(" Maximum number of iterations exceeded\n");break; 86 case 5: _printf0_(" Maximum number of function calls exceeded\n"); break; 87 case 6: _printf0_(" stopped on dxmin during line search\n"); break; 88 case 7: _printf0_(" <g,d> > 0 or <y,s> <0\n"); break; 89 default: _printf0_(" Unknown end condition\n"); 87 90 } 88 91 … … 93 96 xDelete<double>(g); 94 97 xDelete<double>(x); 98 xDelete<double>(dz); 95 99 } 96 100 #else
Note:
See TracChangeset
for help on using the changeset viewer.