Revision 1935 trunk/src/nh99/xmodelm4.cpp

xmodelm4.cpp (revision 1935)
4 4
 * Author: David Fournier
5 5
 * Copyright (c) 2008-2012 Regents of the University of California
6 6
 */
7
#  include <admodel.h>
7
#include <admodel.h>
8
#include <df1b2fun.h>
9
#include <adrndeff.h>
10

  
8 11
int function_minimizer::random_effects_flag=0;
9 12
int function_minimizer::test_trust_flag=0;
10 13
int function_minimizer::negative_eigenvalue_flag=0;
11
#if defined(USE_LAPLACE)
12
#  include <df1b2fun.h>
13
#include <adrndeff.h>
14 14
//dvariable AD_uf_inner(const dvector& x,const dvar_vector& u);
15 15
void get_second_ders(int xs,int us,const init_df1b2vector y,dmatrix& Hess,
16 16
  dmatrix& Dux, df1b2_gradlist * f1b2gradlist,function_minimizer * pfmin);
......
36 36
void   random_effects_userfunction(double f,const dvector& x,
37 37
  const dvector& g);
38 38

  
39
void function_minimizer::AD_uf_outer(void){;}
40
void function_minimizer::AD_uf_inner(void){;}
39
void function_minimizer::AD_uf_outer(){}
40
void function_minimizer::AD_uf_inner(){}
41 41
//void function_minimizer::user_function(const init_df1b2vector& x,
42 42
 // df1b2variable& f){;}
43
void function_minimizer::user_function(void){;}
44

  
45
#else      // if !defined(USE_LAPLACE)
46

  
47

  
48
void function_minimizer::quasi_newton_block(int nvar,int _crit,
49
  independent_variables& x,const dvector& _g,const double& _f)
50
{
51
  double & f= (double&)_f;
52
  dvector & g= (dvector&)_g;
53
  // *********************************************************
54
  // block for quasi-newton minimization
55
  int itnold=0;
56
  fmm fmc(nvar);
57
  int on1;
58
  if ( (on1=option_match(ad_comm::argc,ad_comm::argv,"-nox"))>-1)
59
  {
60
    fmc.noprintx=1;
61
  }
62
  fmc.maxfn= maxfn;
63
  int nopt=0;
64
  if ( (on1=option_match(ad_comm::argc,ad_comm::argv,"-dd",nopt))>-1)
65
  {
66
    if (!nopt)
67
    {
68
      cerr << "Usage -iprint option needs integer  -- ignored" << endl;
69
      fmc.iprint=iprint;
70
    }
71
    else
72
    {
73
      int jj=atoi(ad_comm::argv[on1+1]);
74
      fmc.dcheck_flag=jj;
75
    }
76
  }
77
  nopt=0;
78
  if ( (on1=option_match(ad_comm::argc,ad_comm::argv,"-iprint",nopt))>-1)
79
  {
80
    if (!nopt)
81
    {
82
      cerr << "Usage -iprint option needs integer  -- ignored" << endl;
83
      fmc.iprint=iprint;
84
    }
85
    else
86
    {
87
      int jj=atoi(ad_comm::argv[on1+1]);
88
      fmc.iprint=jj;
89
    }
90
  }
91
  else
92
  {
93
    fmc.iprint= iprint;
94
  }
95
  fmc.crit = crit;
96
  fmc.imax = imax;
97
  fmc.dfn= dfn;
98
  fmc.scroll_flag= scroll_flag;
99
  fmc.min_improve=min_improve;
100
  gradient_structure::set_YES_DERIVATIVES();
101
  // set convergence criterion for this phase
102
  if (_crit)
103
  {
104
    fmc.crit = _crit;
105
  }
106
  if (!(!convergence_criteria))
107
  {
108
    int ind=min(convergence_criteria.indexmax(),
109
      initial_params::current_phase);
110
    fmc.crit=convergence_criteria(ind);
111
  }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff