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

df1b2lp9.cpp (revision 692)
1
/*
2
 * $Id$
3
 *
4
 * Author: David Fournier
5
 * Copyright (c) 2008-2012 Regents of the University of California 
6
 */
7
/**
8
 * \file
9
 * Description not yet available.
10
 */
11
#if defined(USE_LAPLACE)
12
#  include <admodel.h>
13
#  include <df1b2fun.h>
14
#  include <adrndeff.h>
15
        //int fcount =0;
16
  static int no_stuff=0;
17
              static void crap(void)
18
              {
19
              }
20
              static void crap(double ff,dvector& uuu,dvector& gg)
21
              {
22
                //cout << setprecision(10) << setw(19) << ff << " " 
23
                 //    << setw(19) << uuu   << "  "  << setw(19) << gg << endl;
24
              }
25

  
26
typedef fmm * pfmm;
27

  
28
/**
29
 * Description not yet available.
30
 * \param
31
 */
32
dvector laplace_approximation_calculator::get_uhat_quasi_newton_block_diagonal
33
  (const dvector& x,function_minimizer * pfmin)
34
{
35

  
36
  if (separable_function_difference)
37
  {
38
    delete separable_function_difference;
39
    separable_function_difference=0;
40
  }
41
  separable_function_difference = new dvector(1,num_separable_calls);
42
  
43
  fmm ** pfmc1 = new pfmm[num_separable_calls];
44
  pfmc1--;
45
  int i;
46
  ivector ishape(1,num_separable_calls);
47
  dvector gmax(1,num_separable_calls);
48

  
49
  for (i=1;i<=num_separable_calls;i++)
50
  {
51
    int m=(*derindex)(i).indexmax();
52
    ishape(i)=m;
53
    if (m>0)
54
    {
55
    pfmc1[i] = new fmm(m);
56
    pfmc1[i]->iprint=0;
57
    pfmc1[i]->crit=inner_crit;
58
    pfmc1[i]->ireturn=0;
59
    pfmc1[i]->itn=0;
60
    pfmc1[i]->ifn=0;
61
    pfmc1[i]->ialph=0;
62
    pfmc1[i]->ihang=0;
63
    pfmc1[i]->ihflag=0;
64
    pfmc1[i]->maxfn=100;
65
    pfmc1[i]->gmax=1.e+100;
66
    pfmc1[i]->use_control_c=0;
67
    }
68
    else
69
    {
70
      pfmc1[i]= (fmm *)(0);
71
    }
72
  }
73
  dmatrix gg(1,num_separable_calls,1,ishape);
74
  dmatrix ggb(1,num_separable_calls,1,ishape);
75
  dmatrix uu(1,num_separable_calls,1,ishape);
76
  dmatrix uub(1,num_separable_calls,1,ishape);
77
  dvector ff(1,num_separable_calls);
78
  dvector ffb(1,num_separable_calls);
79
  ivector icon(1,num_separable_calls);
80
  icon.initialize();
81
  ffb=1.e+100;
82

  
83
  double f=0.0;
84
  double fb=1.e+100;
85
  dvector g(1,usize);
86
  dvector ub(1,usize);
87
  independent_variables u(1,usize);
88
  gradcalc(0,g);
89
  fmc1.itn=0;
90
  fmc1.ifn=0;
91
  fmc1.ireturn=0;
92
  initial_params::xinit(u);    // get the initial values into the
93
  fmc1.ialph=0;
94
  fmc1.ihang=0;
95
  fmc1.ihflag=0;
96
  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff