Revision 692 branches/merge-trunk-davef/src/df1b2-separable/df1b2lp6.cpp

df1b2lp6.cpp (revision 692)
25 25
double calculate_importance_sample_shess(const dvector& x,const dvector& u0,
26 26
  const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint,
27 27
  const dmatrix& _Hessadjoint,function_minimizer * pmin);
28
dvector evaluate_quadprior(const dvector& x,int usize,
29
  function_minimizer * pfmin);
28 30

  
29 31
int use_dd_nr=0;
30 32
int admb_ssflag=0;
31 33
dvector solve(const dmatrix & st,const dmatrix & Hess,
32 34
  const dvector& grad);
35
dvector return_choleski_decomp_solve(dcompressed_triplet & st,dvector& eps);
33 36

  
34 37
#if defined(USE_DD_STUFF)
35 38
#  if defined(__MSVC32__)
......
94 97
      cout << "Newton raphson " << ii << "  ";
95 98
    if (quadratic_prior::get_num_quadratic_prior()>0)
96 99
    {
97
      quadratic_prior::get_cHessian_contribution(Hess,xsize);
98
      quadratic_prior::get_cgradient_contribution(grad,xsize);
100
      if (sparse_hessian_flag==0)
101
      {
102
        quadratic_prior::get_cHessian_contribution(Hess,xsize);
103
        quadratic_prior::get_cgradient_contribution(grad,xsize);
104
      }
105
      else
106
      {
107
        quadratic_prior::get_cHessian_contribution(sparse_triplet2,xsize,
108
          *sparse_iterator,sparse_count);
109

  
110
        quadratic_prior::get_cgradient_contribution(grad,xsize);
111

  
112
      }
99 113
    }
100 114

  
101 115
    int ierr=0;
......
135 149
            ad_exit(1);
136 150
#endif
137 151
          }
152

  
138 153
          maxg=fabs(evaluate_function(uhat,pfmin));
139
          if (f_from_1< pfmin->lapprox->fmc1.fbest)
154
          if (f_from_1< fmc1.fbest)
140 155
          {
141
            uhat=banded_calculations_trust_region_approach(uhat,pfmin);
142
            maxg=fabs(evaluate_function(uhat,pfmin));
156
            //uhat=banded_calculations_trust_region_approach(uhat,pfmin);
157
            //maxg=fabs(evaluate_function(uhat,pfmin));
143 158
          }
144 159
        }
145 160
      }
......
207 222
        if (sparse_hessian_flag)
208 223
        {
209 224
          //step=-solve(*sparse_triplet,Hess,grad,*sparse_symbolic);
225
          //dmatrix S=make_sdmatrix(*sparse_triplet2);
226
          int ierrx=22;
227
          //dvector temp1= choleski_solve_error(S,grad,ierrx);
228
          //dvector temp2=return_choleski_decomp_solve(*sparse_triplet2,grad);
210 229
          dvector temp=solve(*sparse_triplet2,grad,*sparse_symbolic2,ierr);
230
          //cout << norm2(temp2-temp) << endl;
231
          //cout << norm2(temp-temp1) << endl;
211 232
          if (ierr)
212 233
          {
213 234
            step=-temp;
......
313 334
    {
314 335
      uhat=get_uhat_quasi_newton_qd(x,pfmin);
315 336
    }
337
    return fmc1.fbest;
316 338
  }
317 339
  else
318 340
  {
319
    uhat=get_uhat_lm_newton(x,pfmin);
320
    //uhat=get_uhat_lm_newton2(x,pfmin);
321
    //maxg=objective_function_value::gmax;
341
    uhat=get_uhat_lm_newton2(x,pfmin);
342
    return fmc2.fbest;
322 343
  }
323
  return fmc1.fbest;
324 344
}
325 345

  
326 346
/**
......
408 428
    }
409 429
    while(no_converge_flag);
410 430

  
411
    /* If we are in mcmc phase we just need to calcualte the
431
    /* If we are in mcmc phase we just need to calculate the
412 432
       ln_det(Hess) and return
413 433
    */
414 434
    hs_symbolic & ssymb=*(pmin->lapprox->sparse_symbolic2);
......
513 533
        f=1.e+30;
514 534
      }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff