Changeset 18571
- Timestamp:
- 10/03/14 14:06:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp
r18128 r18571 81 81 if(VerboseControl())_printf0_(" Computing initial solution\n"); 82 82 _printf0_("\n"); 83 _printf0_("Cost function f(x) | List of contributions\n");84 _printf0_("_____________________________________________ \n");83 _printf0_("Cost function f(x) | Gradient norm |g(x)| | List of contributions\n"); 84 _printf0_("____________________________________________________________________\n"); 85 85 indic = 0; //no adjoint required 86 86 simul(&indic,&n,X,&f,G,izs,rzs,(void*)femmodel); … … 162 162 _printf0_("f(x) = "<<setw(12)<<setprecision(7)<<*pf<<" | "); 163 163 164 /*Retrieve objective functions independently*/ 165 for(int i=0;i<num_responses;i++) _printf0_(" "<<setw(12)<<setprecision(7)<<Jlist[i]); 166 _printf0_("\n"); 167 xDelete<IssmDouble>(Jlist); 164 168 165 169 166 if(indic==0){ 170 167 /*dry run, no gradient required*/ 168 169 /*Retrieve objective functions independently*/ 170 _printf0_(" N/A |\n"); 171 for(int i=0;i<num_responses;i++) _printf0_(" "<<setw(12)<<setprecision(7)<<Jlist[i]); 172 _printf0_("\n"); 173 174 xDelete<IssmDouble>(Jlist); 171 175 xDelete<IssmDouble>(XU); 172 176 xDelete<IssmDouble>(XL); … … 185 189 186 190 /*Constrain Gradient*/ 191 IssmDouble Gnorm = 0.; 187 192 for(long i=0;i<*n;i++){ 188 193 if(X[i]>=XU[i]) G[i]=0.; 189 194 if(X[i]<=XL[i]) G[i]=0.; 190 } 195 Gnorm += G[i]*G[i]; 196 } 197 Gnorm = sqrt(Gnorm); 198 199 /*Print info*/ 200 _printf0_(" "<<setw(12)<<setprecision(7)<<Gnorm<<" |"); 201 for(int i=0;i<num_responses;i++) _printf0_(" "<<setw(12)<<setprecision(7)<<Jlist[i]); 202 _printf0_("\n"); 191 203 192 204 /*Clean-up and return*/ 205 xDelete<IssmDouble>(Jlist); 193 206 xDelete<IssmDouble>(XU); 194 207 xDelete<IssmDouble>(XL);
Note:
See TracChangeset
for help on using the changeset viewer.