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

quadpri.cpp (revision 692)
2 2
 * $Id$
3 3
 *
4 4
 * Author: David Fournier
5
 * Copyright (c) 2008-2012 Regents of the University of California 
5
 * Copyright (c) 2008-2011 Regents of the University of California 
6 6
 */
7 7
/**
8 8
 * \file
......
17 17
int quadratic_prior::num_quadratic_prior=0;
18 18
const int quadratic_prior::max_num_quadratic_prior=100;
19 19

  
20
static void NOT_IMPLEMENTED(void)
21
{
22
  cerr << "not implemented" << endl;
23
  ad_exit(1);
24
}
20 25
/**
21 26
 * Description not yet available.
22 27
 * \param
......
32 37
   }
33 38
 }
34 39

  
40
 void quadratic_prior::cleanup(void)
41
 {
42
   for (int i=0;i<num_quadratic_prior;i++)
43
   {
44
     if (ptr[i])
45
     {
46
       ptr[i]->deallocate();
47
     }
48
   }
49
 }
50

  
35 51
/**
36 52
 * Description not yet available.
37 53
 * \param
......
48 64
  dvariable vf=0.0;
49 65
  initial_params::reset(dvar_vector(u));
50 66
  //vf=0.0;
51
  dvar_matrix Hess_all(1,usize,1,usize);
67
  dvar_matrix Hess_all;
68
  dvar_compressed_triplet S_Hess_all;
69

  
70
  if (pfmin->lapprox->sparse_hessian_flag==0)
71
  {
72
    if (allocated(Hess_all))
73
      Hess_all.deallocate();
74

  
75
    Hess_all.allocate(1,usize,1,usize);
76
  }
77
  else
78
  {
79
    if (pfmin->lapprox->sparse_triplet2==0)
80
    {
81
      cerr << "need to deal with 0 ptr here" << endl;
82
      ad_exit(1);
83
    }
84
    int us=pfmin->lapprox->sparse_triplet2->get_n();
85
    int mmin=pfmin->lapprox->sparse_triplet2->indexmin();
86
    int mmax=pfmin->lapprox->sparse_triplet2->indexmax();
87
    if (allocated(S_Hess_all))
88
      S_Hess_all.deallocate();
89

  
90
    S_Hess_all.allocate(mmin,mmax,us,us);
91

  
92
  }
93
  
94
 
52 95
  *objective_function_value::pobjfun=0.0;
53 96
  // so that dvar_matrix Hessian contributions are calculated
54 97
  laplace_approximation_calculator::where_are_we_flag=3; 
55
  pfmin->AD_uf_inner();
98
  cout << "need to fix this" << endl;
99
  sleep(1);
100
  //pfmin->AD_uf_inner();
56 101
  if ( quadratic_prior::get_num_quadratic_prior()>0)
57 102
  {
58 103
    quadratic_prior::get_M_calculations();
......
60 105
  laplace_approximation_calculator::where_are_we_flag=0; 
61 106

  
62 107
  *objective_function_value::pobjfun=0.0;
63
  Hess_all=pfmin->lapprox->Hess;
108
  if (pfmin->lapprox->sparse_hessian_flag==0)
109
  {
110
    Hess_all=pfmin->lapprox->Hess;
111
  }
112
  else
113
  {
114
    S_Hess_all=*(pfmin->lapprox->sparse_triplet2);
115

  
116
  }
64 117
  for (int i=0;i<quadratic_prior::get_num_quadratic_prior();i++)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff