ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df1b2f18.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include <df1b2fun.h>
12 
18 {
19  int ii=1;
20  for (int i=0;i<num_initial_df1b2params;i++)
21  {
22  (varsptr[i])->set_value(x,ii);
23  }
24 }
25 
30 void df1b2_init_vector::set_value(const dvector& x,const int& _ii)
31 {
32  ADUNCONST(int,ii)
33  int mmin=indexmin();
34  int mmax=indexmax();
35  for (int i=mmin;i<=mmax;i++)
36  {
37  //cout << x(ii) << " ";
38  (*this)(i) = (x(ii++));
39  }
40 }
41 
46 void df1b2_init_matrix::set_value(const dvector& x,const int& _ii)
47 {
48  ADUNCONST(int,ii)
49  int rmin=indexmin();
50  int rmax=indexmax();
51  for (int i=rmin;i<=rmax;i++)
52  {
53  int cmin=(*this)(i).indexmin();
54  int cmax=(*this)(i).indexmax();
55  for (int j=cmin;j<=cmax;j++)
56  {
57  (*this)(i,j) = (x(ii++));
58  }
59  }
60 }
61 
67  const int& _ii,double fmin,double fmax)
68 {
69  ADUNCONST(int,ii)
71  double fpen=0.0;
72  int mmin=v.indexmin();
73  int mmax=v.indexmax();
74  for (int i=mmin;i<=mmax;i++)
75  {
76  v(i)=boundp(x(ii++),fmin,fmax,fpen);
77  }
78 }
79 
84 void df1b2_init_number::set_value(const dvector& x,const int& _ii)
85 {
86  ADUNCONST(int,ii)
87  operator = (x(ii++));
88 }
89 
94 void set_value(const df1b2variable& _u,const dvector& x,const int& _ii,
95  double fmin,double fmax)
96 {
97  double fpen=0.0;
98  ADUNCONST(int,ii)
100  u=boundp(x(ii++),fmin,fmax,fpen);
101 }
102 
107 void set_value(const df1b2vector& _x,const dvector& v, const int& _ii,
108  double fmin,double fmax)
109 {
110  double fpen=0.0;
111  ADUNCONST(int,ii)
113  int min=x.indexmin();
114  int max=x.indexmax();
115  for (int i=min;i<=max;i++)
116  {
117  (x)(i)=boundp(v(ii++),fmin,fmax,fpen);
118  }
119 }
120 
126  const int& ii)
127 {
128  //double pen=0.0;
129  ::set_value(*this,x,ii,minb,maxb);
130 }
131 
137  const int& ii)
138 {
140  //df1b2variable m=mean(*this);
141  //pen+=1000.0*square(m);
142 }
143 
148 void df1b2_init_bounded_number::set_value(const dvector& x,const int& _ii)
149 {
150  ADUNCONST(int,ii)
151  //double pen=0.0;
152  ::set_value(*this,x,ii,minb,maxb);
153 }
static void reset_all(const dvector &)
Description not yet available.
Definition: df1b2f18.cpp:17
#define x
#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
int indexmin(void) const
Definition: df1b2fun.h:1054
void fmin(double f, const independent_variables &x, const dvector &g, const int &n, const dvector &w, const dvector &h, const fmm_control &fmc)
Description not yet available.
Definition: df1b2fun.h:953
void operator=(const df1b2variable &_x)
Description not yet available.
Definition: df1b2f15.cpp:303
int indexmin(void) const
Definition: df1b2fun.h:969
static initial_df1b2params ** varsptr
Definition: df1b2fun.h:1367
Description not yet available.
Definition: df1b2fun.h:1584
Description not yet available.
Definition: df1b2fun.h:266
static int num_initial_df1b2params
Definition: df1b2fun.h:1369
virtual void set_value(const dvector &x, const int &_ii)
Description not yet available.
Definition: df1b2f18.cpp:125
#define min(a, b)
Definition: cbivnorm.cpp:188
void set_value(const dvar_matrix &x, const dvar_vector &v, const int &_ii, double s)
Description not yet available.
Definition: set.cpp:235
int indexmax(void) const
Definition: df1b2fun.h:970
int indexmax(void) const
Definition: df1b2fun.h:1055
dvariable boundp(const prevariable &x, double fmin, double fmax, const prevariable &_fpen, double s)
Compute penalty for exceeding bounds on parameter; variable ojbects.
Definition: boundfun.cpp:89
Description not yet available.
#define max(a, b)
Definition: cbivnorm.cpp:189
virtual void set_value(const dvector &x, const int &_ii)
Description not yet available.
Definition: df1b2f18.cpp:46
virtual void set_value(const dvector &x, const int &_ii)
Description not yet available.
Definition: df1b2f18.cpp:136
virtual void set_value(const dvector &x, const int &_ii)
Description not yet available.
Definition: df1b2f18.cpp:30
virtual void set_value(const dvector &x, const int &_ii)
Description not yet available.
Definition: df1b2f18.cpp:84
virtual void set_value(const dvector &x, const int &_ii)
Description not yet available.
Definition: df1b2f18.cpp:148
virtual void set_value(const dvector &, const int &ii)=0