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

df1b2lap.cpp (revision 692)
15 15
#  include <admodel.h>
16 16
#  include <df1b2fun.h>
17 17
#  include <adrndeff.h>
18
#include <fvar.hpp>
19

  
20
#define PI 3.14159265358979323846
21

  
18 22
        int fcount =0;
19
static int no_stuff=0;
23
 int no_stuff=0;
20 24
static int write_sparse_flag=0;
21 25
    static void trapper(void)
22 26
    {
......
79 83
    u=ubest;
80 84
  }
81 85
 
86
  dvariable pen=0.0;
82 87
  fmc1.dfn=1.e-2;
83
  dvariable pen=0.0;
84
  //cout << "starting  norm(u) = " << norm(u) << endl;
88
  gradient_structure::no_derivatives=1;
89
  if ( no_stuff==0 && quadratic_prior::get_num_quadratic_prior()>0)
90
  {
91
    quadratic_prior::calc_matrix_flag=1;
92
    quadratic_prior::matrix_mult_flag=0;
93
    quadratic_prior::get_M_calculations();
94
  }
95
  gradient_structure::no_derivatives=0;
85 96
  while (fmc1.ireturn>=0)
86 97
  {
87
   /*
88
    double nu=norm(value(u));
89
    if (nu>400)
90
    {
91
      cout << "U norm(u) = " << nu  << endl;
92
    }
93
    cout << "V norm(u) = " << nu
94
         << " f = " << f  << endl;
95
    */
96 98
    fmc1.fmin(f,u,g);
97
    //cout << "W norm(u) = " << norm(value(u)) << endl;
99
    
98 100
    if (fmc1.ireturn>0)
99 101
    {
100 102
      dvariable vf=0.0;
101 103
      pen=initial_params::reset(dvar_vector(u));
102 104
      *objective_function_value::pobjfun=0.0;
103 105
      pfmin->AD_uf_inner();
106
      if ( no_stuff==0 && quadratic_prior::get_num_quadratic_prior()>0)
107
      {
108
        quadratic_prior::calc_matrix_flag=0;
109
	quadratic_prior::matrix_mult_flag=1;
110
        quadratic_prior::get_M_calculations();
111
	quadratic_prior::matrix_mult_flag=0;
112
      }
104 113
      if (saddlepointflag)
105 114
      {
106 115
        *objective_function_value::pobjfun*=-1.0;
107 116
      }
108
      if ( no_stuff==0 && quadratic_prior::get_num_quadratic_prior()>0)
109
      {
110
        quadratic_prior::get_M_calculations();
111
      }
112 117
      vf+=*objective_function_value::pobjfun;
113 118
     
114
     /*  this is now done in the operator = function
115
      if (quadratic_prior::get_num_quadratic_prior()>0)
116
      {
117
        vf+= quadratic_prior::get_quadratic_priors();
118
      }
119
      */
120
      
121

  
122 119
      objective_function_value::fun_without_pen=value(vf);
123 120
      
124
      //cout << " pen = " << pen << endl;
125 121
      if (noboundepen_flag==0)
126 122
      {
127 123
        vf+=pen;
......
133 129
        ub=u;
134 130
      }
135 131
      gradcalc(usize,g);
136
      //cout << " f = " << setprecision(17) << f << " " << norm(g) 
137
       // << " " << norm(u) << endl;
138
     
139 132
    }
140 133
    u=ub;
141 134
  }
......
165 158
        pfmin->AD_uf_inner();
166 159
        if ( no_stuff==0 && quadratic_prior::get_num_quadratic_prior()>0)
167 160
        {
161
	  quadratic_prior::calc_matrix_flag=0;
162
	  quadratic_prior::matrix_mult_flag=1;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff