ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
model12.cpp
Go to the documentation of this file.
1 
5 #include <admodel.h>
6 
14  const ofstream& _ofs,
15  int precision)
16 {
17  ofstream& ofs=(ofstream&)_ofs;
18  ofs << setw(precision+6) << setshowpoint();
19  for (int i=0;i<num_initial_params;i++)
20  {
21  (varsptr[i])->save_value(ofs,precision);
22  }
23 }
31  const ofstream& _ofs,
32  int precision)
33 {
34  ofstream& ofs=(ofstream&)_ofs;
35 #ifndef __ZTC__
36  ofs << setprecision(precision) << dvariable(*this) << endl;
37 #else
38  ofs << setw(precision+6) << setprecision(precision) << *this << endl;
39 #endif
40 }
48  const ofstream& _ofs,
49  int precision)
50 {
51  ofstream& ofs=(ofstream&)_ofs;
52  ofs << setw(precision+6) << setprecision(precision) << dvar_vector(*this) << endl;
53 }
61  const ofstream& _ofs,
62  int precision)
63 {
64  ofstream& ofs=(ofstream&)_ofs;
65  ofs << setw(precision+6) << setprecision(precision) << dvar_vector(*this) << endl;
66 }
74  const ofstream& _ofs,
75  int precision)
76 {
77  ofstream& ofs = (ofstream&)_ofs;
78  ofs << setw(precision+6) << setprecision(precision) << dvar_matrix(*this) << endl;
79 }
90  const ofstream& _ofs,
91  int precision,
92  const dvector& g,
93  int& offset)
94 {
95  ADUNCONST(ofstream,ofs)
96  ofs << label() << " "
97  << setw(precision+6) << setprecision(precision) << *this << " "
98  << setw(precision+6) << setprecision(precision) << g(offset++) << endl;
99 }
110  const ofstream& _ofs,
111  int precision,
112  const dvector& g,
113  int& offset)
114 {
115  ADUNCONST(ofstream,ofs)
116  int mmin=indexmin();
117  int mmax=indexmax();
118  for (int i=mmin;i<=mmax;i++)
119  {
120  ofs << label()
121  << "(" << i << ") "
122  << setw(precision+6) << setprecision(precision) << (*this)(i) << " "
123  << setw(precision+6) << setprecision(precision) << g(offset++) << endl;
124  }
125 }
136  const ofstream& _ofs,
137  int precision,
138  const dvector& g,
139  int& offset)
140 {
141  ADUNCONST(ofstream,ofs)
142  int mmin=indexmin();
143  int mmax=indexmax();
144  for (int i=mmin;i<=mmax;i++)
145  {
146  ofs << label()
147  << "(" << i << ") "
148  << setw(precision+6) << setprecision(precision) << (*this)(i) << " "
149  << setw(precision+6) << setprecision(precision) << g(offset++) << endl;
150  }
151 }
162  const ofstream& _ofs,
163  int precision,
164  const dvector& g)
165 {
166  ADUNCONST(ofstream,ofs)
167  int offset = 1;
168  ofs <<"ParName"<< " "<< "Value"<< " " <<"Gradient"<< endl;
169  for (int i = 0; i < initial_params::num_initial_params; i++)
170  {
172  {
173  // ofs << i+1 <<" ";
174  (initial_params::varsptr[i])->save_value(ofs, 6, g, offset);
175  }
176  }
177 }
188  const ofstream& _ofs,
189  int precision,
190  const dvector& g,
191  int& offset)
192 {
193  ADUNCONST(ofstream,ofs)
194  int rmin=indexmin();
195  int rmax=indexmax();
196  for (int i=rmin;i<=rmax;i++)
197  {
198  int cmin=(*this)(i).indexmin();
199  int cmax=(*this)(i).indexmax();
200  for (int j=cmin;j<=cmax;j++)
201  {
202  ofs << label()
203  << "(" << i << "," << j << ") "
204  << setw(precision+6) << setprecision(precision) << (*this)(i,j) << " "
205  << setw(precision+6) << setprecision(precision) << g(offset++) << endl;
206  }
207  }
208 }
dvar_vector()
Default constructor.
Definition: fvar_arr.cpp:150
int withinbound(int lb, int n, int ub)
Definition: model.cpp:45
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
Definition: fvar.hpp:140
Vector of double precision numbers.
Definition: dvector.h:50
virtual void save_value(ofstream &ofs)
Definition: model.cpp:736
virtual void save_value(const ofstream &ofs, int prec)
Write values of param_init_matrix into output stream _ofs.
Definition: model12.cpp:60
dvariable()
Default constructor.
Definition: fvar.hpp:1526
virtual const char * label(void)
Definition: model11.cpp:258
virtual void save_value(ofstream &ofs)
Definition: model.cpp:1030
prnstream & endl(prnstream &)
static int current_phase
Definition: admodel.h:842
preshowpoint setshowpoint(void)
Description not yet available.
Definition: admanip.cpp:38
virtual void save_value(const ofstream &ofs, int prec)
Write values of param_init_number into output stream _ofs.
Definition: model12.cpp:30
Description not yet available.
static int num_initial_params
Definition: admodel.h:836
virtual const char * label(void)
Definition: model11.cpp:252
int indexmin() const
Definition: fvar.hpp:2287
int indexmax(void) const
Definition: fvar.hpp:2572
dvar_matrix()
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: fvar_mat.cpp:15
virtual void save_value(ofstream &ofs)=0
int phase_start
Definition: admodel.h:848
virtual const char * label(void)
Definition: model11.cpp:234
static void save(void)
Definition: model.cpp:382
virtual const char * label(void)
Definition: model11.cpp:246
int indexmin(void) const
Definition: fvar.hpp:2568
int indexmax() const
Definition: fvar.hpp:2292
static void save_all(const ofstream &_ofs, int prec, const dvector &g)
Write all values of g into output stream _ofs.
Definition: model12.cpp:161
static adlist_ptr varsptr
Definition: admodel.h:838