ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f1b2vc2.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  {
20  dvector tmp(t1.indexmin(),t1.indexmax());
21 
22  for (int i=t1.indexmin(); i<=t1.indexmax(); i++)
23  {
24  tmp.elem(i)=value(t1(i));
25  }
26  return(tmp);
27  }
28 
34  {
36  int nrl=m.indexmin();
37  int nrh=m.indexmax();
38  ivector ncl(nrl,nrh);
39  ivector nch(nrl,nrh);
40  int i;
41  for (i=nrl;i<=nrh;i++)
42  {
43  ncl(i)=m(i).indexmin();
44  nch(i)=m(i).indexmax();
45  }
46  dmatrix tmp(nrl,nrh,ncl,nch);
47  for (i=nrl;i<=nrh;i++)
48  {
49  tmp(i)=value(m(i));
50  }
51  return tmp;
52  }
53 
59 {
61  int mmin=M.indexmin();
62  int mmax=M.indexmax();
63  for (int i=mmin;i<=mmax;i++)
64  {
65  (*this)(i)=M(i);
66  }
67  return *this;
68 }
69 
75 {
77  int mmin=M.indexmin();
78  int mmax=M.indexmax();
79  for (int i=mmin;i<=mmax;i++)
80  {
81  (*this)(i)=M(i);
82  }
83  return *this;
84 }
85 
91 {
92  int mmin=indexmin();
93  int mmax=indexmax();
94  for (int i=mmin;i<=mmax;i++)
95  {
96  int jmin=(*this)(i).indexmin();
97  int jmax=(*this)(i).indexmax();
98  for (int j=jmin;j<=jmax;j++)
99  {
100  (*this)(i,j)=M;
101  }
102  }
103  return *this;
104 }
105 
113 {
115  int mmin=indexmin();
116  int mmax=indexmax();
117  for (int i=mmin; i<=mmax; ++i)
118  {
119  int jmin=(*this)(i).indexmin();
120  int jmax=(*this)(i).indexmax();
121  for (int j=jmin; j<=jmax; ++j)
122  {
123  (*this)(i,j)=M;
124  }
125  }
126  return *this;
127 }
128 
134 {
136  int rmin=M.indexmin();
137  int rmax=M.indexmax();
138  df1b2matrix tmp(rmin,rmax);
139  for (int i=rmin;i<=rmax;i++)
140  {
141  int cmin=M(i).indexmin();
142  int cmax=M(i).indexmax();
143  // need special allocate so that = does not cause an assign.
144  tmp(i).noallocate(cmin,cmax);
145  for (int j=cmin;j<=cmax;j++)
146  {
147  tmp(i,j)=square(M(i,j));
148  }
149  }
150  return tmp;
151 }
152 
158 {
159  int rmin=indexmin();
160  int rmax=indexmax();
161  for (int i=rmin;i<=rmax;i++)
162  {
163  int cmin=(*this)(i).indexmin();
164  int cmax=(*this)(i).indexmax();
165  // need special allocate so that = does not cause an assign.
166  for (int j=cmin;j<=cmax;j++)
167  {
168  (*this)(i,j)=0.0;
169  }
170  }
171 }
172 
178 {
180  int rmin=M.indexmin();
181  int rmax=M.indexmax();
182  df1b2matrix tmp(rmin,rmax);
183  for (int i=rmin;i<=rmax;i++)
184  {
185  int cmin=M(i).indexmin();
186  int cmax=M(i).indexmax();
187  // need special allocate so that = does not cause an assign.
188  tmp(i).noallocate(cmin,cmax);
189  for (int j=cmin;j<=cmax;j++)
190  {
191  tmp(i,j)=mfexp(M(i,j));
192  }
193  }
194  return tmp;
195 }
196 
202 {
204  int rmin=M.indexmin();
205  int rmax=M.indexmax();
206  df1b2matrix tmp(rmin,rmax);
207  for (int i=rmin;i<=rmax;i++)
208  {
209  int cmin=M(i).indexmin();
210  int cmax=M(i).indexmax();
211  // need special allocate so that = does not cause an assign.
212  tmp(i).noallocate(cmin,cmax);
213  for (int j=cmin;j<=cmax;j++)
214  {
215  tmp(i,j)=log(M(i,j));
216  }
217  }
218  return tmp;
219 }
220 
226 {
228  int rmin=M.indexmin();
229  int rmax=M.indexmax();
230  df1b2matrix tmp(rmin,rmax);
231  for (int i=rmin;i<=rmax;i++)
232  {
233  int cmin=M(i).indexmin();
234  int cmax=M(i).indexmax();
235  // need special allocate so that = does not cause an assign.
236  tmp(i).noallocate(cmin,cmax);
237  for (int j=cmin;j<=cmax;j++)
238  {
239  tmp(i,j)=sin(M(i,j));
240  }
241  }
242  return tmp;
243 }
244 
250 {
252  int rmin=M.indexmin();
253  int rmax=M.indexmax();
254  df1b2matrix tmp(rmin,rmax);
255  for (int i=rmin;i<=rmax;i++)
256  {
257  int cmin=M(i).indexmin();
258  int cmax=M(i).indexmax();
259  // need special allocate so that = does not cause an assign.
260  tmp(i).noallocate(cmin,cmax);
261  for (int j=cmin;j<=cmax;j++)
262  {
263  tmp(i,j)=cos(M(i,j));
264  }
265  }
266  return tmp;
267 }
268 /*
269 df1b2matrix tan(const df1b2matrix& M)
270 {
271  int rmin=M.indexmin();
272  int rmax=M.indexmax();
273  df1b2matrix tmp(rmin,rmax);
274  for (int i=rmin;i<=rmax;i++)
275  {
276  int cmin=M(i).indexmin();
277  int cmax=M(i).indexmax();
278  // need special allocate so that = does not cause an assign.
279  tmp(i).noallocate(cmin,cmax);
280  for (int j=cmin;j<=cmax;j++)
281  {
282  tmp(i,j)=tan(M(i,j));
283  }
284  }
285  return tmp;
286 }
287 */
double & elem(int i)
Definition: dvector.h:152
#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
Description not yet available.
Definition: df1b2fun.h:953
d3_array sin(const d3_array &arr3)
Returns d3_array results with computed sin from elements in arr3.
Definition: d3arr2a.cpp:43
void initialize(void)
Description not yet available.
Definition: f1b2vc2.cpp:157
Description not yet available.
Definition: df1b2fun.h:266
df1b2matrix & operator=(const df3_one_matrix &)
Definition: df3fun.cpp:741
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
int indexmin() const
Definition: ivector.h:99
#define M
Definition: rngen.cpp:57
int indexmax() const
Definition: ivector.h:104
Description not yet available.
Definition: fvar.hpp:2819
d3_array cos(const d3_array &arr3)
Returns d3_array results with computed cos from elements in arr3.
Definition: d3arr2a.cpp:58
Description not yet available.
Definition: df1b2fun.h:1042
int indexmax(void) const
Definition: df1b2fun.h:1055
Description not yet available.
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
double square(const double value)
Return square of value; constant object.
Definition: d3arr4.cpp:16
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13