Revision 747

trunk/src/df1b2-separable/df1b2f15.cpp (revision 747)
70 70
 * Description not yet available.
71 71
 * \param
72 72
 */
73
 double initial_df1b2params::get_scalefactor(void)
74
 {
75
   return scalefactor;
76
 }
77

  
78
/**
79
 * Set scale factor for parameter in RE model.
80
 * \param sf Scale factor 
81
 * The function minimizer will work internally with x*df, where x is the parameter in the model.
82
 */
83
 void initial_df1b2params::set_scalefactor(const double sf)
84
 {
85
   scalefactor=sf;
86
 }
87

  
88

  
89

  
90

  
73 91
int initial_df1b2params::set_index(void)
74 92
{
75 93
  int ii=1;
......
222 240
{
223 241
  ADUNCONST(init_df1b2vector,x)
224 242
  ADUNCONST(int,ii)
225
  operator = (x(ii++));
243
  if (scalefactor==0.0)
244
    operator = (x(ii++));
245
  else
246
    operator = (x(ii++)/scalefactor);
226 247
}
227 248

  
228 249
/**
......
311 332
{
312 333
  ADUNCONST(init_df1b2vector,x)
313 334
  ADUNCONST(int,ii)
314
  ::set_value(*this,x,ii,minb,maxb,pen);
335
  if (scalefactor==0.0)
336
    ::set_value(*this,x,ii,minb,maxb,pen);
337
  else
338
    ::set_value(*this,x,ii,minb,maxb,pen,scalefactor);
315 339
}
316 340

  
317 341
/**
......
346 370
  }
347 371
}
348 372

  
373
void set_value(const df1b2variable& _u,const init_df1b2vector& _x,
374
  const int& _ii,double fmin,double fmax,const df1b2variable& _fpen,
375
  double s)
376
{
377
  ADUNCONST(init_df1b2vector,x)
378
  ADUNCONST(int,ii)
379
  ADUNCONST(df1b2variable,u)
380
  ADUNCONST(df1b2variable,fpen)
381
  if (!initial_params::straight_through_flag)
382
  {
383
    u=boundp(x(ii++),fmin,fmax,fpen,s);
384
  }
385
  else
386
  {
387
    u=x(ii);
388
    value(u)=boundp(value(x(ii++)),fmin,fmax,s);
389
    double diff=fmax-fmin;
390
    //t=fmin + diff*ss;
391
    df1b2variable ss=(u-fmin)/diff;
392
#   ifdef USE_BARD_PEN
393
      const double l4=log(4.0);
394
      double pen=.000001/diff;
395
      fpen-=pen*(log(ss+1.e-40)+log((1.0-ss)+1.e-40)+l4);
396
#   else 
397
          XXXX
398
#   endif
399
  }
400
}
401

  
349 402
/**
350
 * Description not yet available.
351
 * \param
403
 * Bound model parameter
404
 * \param x Variable to bound
405
 * \param fmin  Lower value
406
 * \param fmax  Upper value
407
 * \param _fpen Penalty to apply    
352 408
 */
353 409
df1b2variable boundp(const df1b2variable& x, double fmin, double fmax,
354 410
  const df1b2variable& _fpen)
......
395 451
}
396 452

  
397 453
/**
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff