ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df33fun.h
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  *
7  * ADModelbuilder and associated libraries and documentations are
8  * provided under the general terms of the "BSD" license.
9  *
10  * License:
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are
14  * met:
15  *
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution.
22  *
23  * 3. Neither the name of the University of California, Otter Research,
24  * nor the ADMB Foundation nor the names of its contributors may be used
25  * to endorse or promote products derived from this software without
26  * specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  */
45 #if !defined(__DF33FUN__)
46 # define __DF33FUN__
47 class df1b2variable;
48 
54 {
55  double v[20];
56 public:
58  static int num_ind_var;
59  static int num_local_ind_var;
60 
63 
64  double* get_u() const { return (double*)(&(v[0])); }
65  double* get_u_x() const { return (double*)(&(v[1])); }
66  double* get_u_y() const { return (double*)(&(v[2])); }
67  double* get_u_z() const { return (double*)(&(v[3])); }
68  double* get_u_xx() const { return (double*)(&(v[4])); }
69  double* get_u_xy() const { return (double*)(&(v[5])); }
70  double* get_u_xz() const { return (double*)(&(v[6])); }
71  double* get_u_yy() const { return (double*)(&(v[7])); }
72  double* get_u_yz() const { return (double*)(&(v[8])); }
73  double* get_u_zz() const { return (double*)(&(v[9])); }
74  double* get_u_xxx() const { return (double*)(&(v[10])); }
75  double* get_u_xxy() const { return (double*)(&(v[11])); }
76  double* get_u_xxz() const { return (double*)(&(v[12])); }
77  double* get_u_xyy() const { return (double*)(&(v[13])); }
78  double* get_u_xyz() const { return (double*)(&(v[14])); }
79  double* get_u_xzz() const { return (double*)(&(v[15])); }
80  double* get_u_yyy() const { return (double*)(&(v[16])); }
81  double* get_u_yyz() const { return (double*)(&(v[17])); }
82  double* get_u_yzz() const { return (double*)(&(v[18])); }
83  double* get_u_zzz() const { return (double*)(&(v[19])); }
84 
94 
95  void initialize();
96 };
97 
102  inline double value(const df3_three_variable& x)
103  { return double(*x.get_u()); }
104 
110  {
111  public:
113  init_df3_three_variable(double );
115  };
116 
122 {
127 
128 public:
131  df3_three_vector(int min,int max);
133 
134  int indexmin() const { return index_min; }
135  int indexmax() const { return index_max; }
136  void allocate();
137  void allocate(int min,int max);
139  {
140  return *(v + i);
141  }
143  {
144  return *(v + i);
145  }
146  void initialize();
147  void deallocate();
148 };
149 
150  dvector value(const df3_three_vector& v);
151 
153 
155 
157 
163  {
168  public:
169  int indexmin(void) const { return int(index_min); }
170  int indexmax(void) const { return int(index_max); }
171  df3_three_matrix(int rmin,int rmax,int cmin,int cmax);
173  {
174  return (df3_three_vector&) *(v+i);
175  }
177  {
178  return (df3_three_vector&) *(v+i);
179  }
180  df3_three_variable& operator () (int i,int j) const
181  {
182  return (df3_three_variable&) (*(v+i))(j);
183  }
184  void initialize(void);
185  //df3_three_variable& operator () (int i,int j) const
186  // { return *((v+i)->(v+j)); }
187  void deallocate(void);
190  };
191 
192  dmatrix value(const df3_three_matrix& v);
193 
197 
198 /*
199  df3_three_variable operator F(const df3_three_variable& x)
200  {
201  df3_three_variable z;
202 
203  *z.get_u() = ::F(*x.get_u());
204 
205  *z.get_udot() = ::D1F(*x.get_u())* *x.get_udot();
206 
207  *z.get_udot2() = ::D2F(*x.get_u())* square(*x.get_udot())
208  + ::D1F(*x.get_u())* *x.get_udot2();
209 
210  *z.get_udot3() = ::D3F(*x.get_u()) * cube(*x.get_udot())
211  + 3.0 * ::D2F(*x.get_u()) * *x.get_udot() * *x.get_udot2()
212  + ::D1F(*x.get_u()) * *x.get_udot3();
213  return z;
214  }
215 
216 */
217 
228  const df3_three_variable& y);
229 
234  const df3_three_variable& y);
236  const df3_three_variable& y);
238  double y);
240  const df3_three_variable& y);
241 
242  df3_three_variable operator / (const double x,const df3_three_variable& y);
243 
245  const double y);
246 
247  df3_three_variable operator + (const double x,
248  const df3_three_variable& y);
249 
251  const double y);
252 
254  const df3_three_variable& y);
257 
259  const df3_three_variable& y);
260 
263 
265  const df3_three_variable& a);
266 
268 #endif // __DF32FUN__
void initialize()
Description not yet available.
Definition: df33fun.cpp:165
df3_three_variable & operator+=(const df3_three_variable &v)
Add values of v to df3_three_variable.
Definition: df33fun.cpp:403
d3_array tan(const d3_array &arr3)
Returns d3_array results with computed tan from elements in arr3.
Definition: d3arr2a.cpp:73
double * get_u_x() const
Definition: df33fun.h:65
df3_three_variable & operator()(int i) const
Definition: df33fun.h:138
mat_shapex * shape
Definition: df33fun.h:166
int indexmax() const
Definition: df33fun.h:135
Description not yet available.
Definition: fvar.hpp:2030
df3_three_variable & operator-=(const df3_three_variable &v)
Subtract values from _v in df3_three_variable.
Definition: df33fun.cpp:335
double gammln(double xx)
Log gamma function.
Definition: combc.cpp:52
d3_array operator-(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements addition of a(i, j, k) + b(i, j, k).
Definition: d3arr2a.cpp:152
#define x
Vector of double precision numbers.
Definition: dvector.h:50
double * get_u_xxy() const
Definition: df33fun.h:75
df3_three_vector & operator()(int i) const
Definition: df33fun.h:172
df3_three_vector()
Default constructor.
Definition: df33fun.cpp:177
double cumd_gamma(double x, double a)
Definition: cgamdev.cpp:38
df3_three_variable & operator*=(const df3_three_variable &v)
Multiply df3_three_variable by var, then call set_derivatives.
Definition: df33fun.cpp:459
Description not yet available.
Definition: df33fun.h:121
double * get_u_zz() const
Definition: df33fun.h:73
int indexmin() const
Definition: df33fun.h:134
double * get_u_yzz() const
Definition: df33fun.h:82
d3_array operator+(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements addition of a(i, j, k) + b(i, j, k).
Definition: d3arr2a.cpp:132
df1_one_variable atan(const df1_one_variable &x)
Definition: df11fun.cpp:312
df3_three_variable * v
Definition: df33fun.h:126
d3_array sin(const d3_array &arr3)
Returns d3_array results with computed sin from elements in arr3.
Definition: d3arr2a.cpp:43
Description not yet available.
Definition: df33fun.h:162
double * get_u_xyy() const
Definition: df33fun.h:77
df1_two_variable fabs(const df1_two_variable &x)
Definition: df12fun.cpp:891
double * get_u_xz() const
Definition: df33fun.h:70
d3_array cube(const d3_array &m)
Description not yet available.
Definition: d3arr5.cpp:17
void deallocate(void)
Deallocate df3_three_matrix, then set to empty.
Definition: df33fun.cpp:268
void deallocate()
Free allocated memory.
Definition: df33fun.cpp:123
Description not yet available.
Definition: df1b2fun.h:266
df1_one_matrix choleski_decomp(const df1_one_matrix &MM)
Definition: df11fun.cpp:606
dmatrix operator*(const d3_array &t, const dvector &v)
Description not yet available.
Definition: d3arr12.cpp:17
df3_three_variable & operator=(const df3_three_variable &v)
Assignment operator sets values from _v to df3_three_variable.
Definition: df33fun.cpp:969
void allocate()
Does not allocate, but initializes member variables and pointers to NULL.
Definition: df33fun.cpp:216
void initialize()
Intialize values in v to zero.
Definition: df33fun.cpp:106
init_df3_three_variable(const df1b2variable &)
Construct init_df3_three_variable from df1b2variable.
Definition: df33fun.cpp:1443
df3_three_variable()
Default constructor.
Definition: df33fun.cpp:16
df3_three_variable & operator[](int i) const
Definition: df33fun.h:142
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
double * get_u_yz() const
Definition: df33fun.h:72
#define min(a, b)
Definition: cbivnorm.cpp:188
double v[20]
Definition: df33fun.h:55
Description not yet available.
Definition: df33fun.h:53
dmatrix second_derivatives(const df1_one_matrix &v)
double * get_u_xx() const
Definition: df33fun.h:68
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
static df1b2variable * ind_var[]
Definition: df33fun.h:57
void initialize(void)
Initialize values.
Definition: df33fun.cpp:292
dvector first_derivatives(const df1_one_vector &v)
Description not yet available.
Definition: df11fun.cpp:399
Description not yet available.
Definition: fvar.hpp:2819
double * get_u_xy() const
Definition: df33fun.h:69
df3_three_variable & operator/=(const df3_three_variable &v)
Divide df3_three_variable by var, then call set_derivatives.
Definition: df33fun.cpp:469
double * get_u_z() const
Definition: df33fun.h:67
int indexmin(void) const
Definition: df33fun.h:169
int indexmax(void) const
Definition: df33fun.h:170
Holds "shape" information for vector objects.
Definition: vector_shapex.h:46
d3_array cos(const d3_array &arr3)
Returns d3_array results with computed cos from elements in arr3.
Definition: d3arr2a.cpp:58
~df3_three_vector()
Destructor.
Definition: df33fun.cpp:116
Description not yet available.
Definition: df33fun.h:109
double * get_u_yy() const
Definition: df33fun.h:71
double * get_u_yyy() const
Definition: df33fun.h:80
double * get_u_y() const
Definition: df33fun.h:66
df3_three_vector & operator[](int i) const
Definition: df33fun.h:176
double * get_u() const
Definition: df33fun.h:64
double * get_u_xzz() const
Definition: df33fun.h:79
vector_shapex * shape
Definition: df33fun.h:125
static int num_local_ind_var
Definition: df33fun.h:59
double * get_u_zzz() const
Definition: df33fun.h:83
df3_three_matrix(int rmin, int rmax, int cmin, int cmax)
Construct matrix of df3_three_variable with dimensions [rmin to rmax] x [cmin to cmax].
Definition: df33fun.cpp:310
d3_array operator/(const d3_array &m, const double d)
Author: David Fournier.
Definition: d3arr2b.cpp:14
double * get_u_xyz() const
Definition: df33fun.h:78
double * get_u_xxz() const
Definition: df33fun.h:76
dmatrix third_derivatives(const df1_one_matrix &v)
~init_df3_three_variable()
Destructor.
Definition: df33fun.cpp:1425
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
double * get_u_xxx() const
Definition: df33fun.h:74
df3_three_vector * v
Definition: df33fun.h:167
static int num_ind_var
Definition: df33fun.h:58
#define max(a, b)
Definition: cbivnorm.cpp:189
double * get_u_yyz() const
Definition: df33fun.h:81
~df3_three_matrix()
Destructor.
Definition: df33fun.cpp:263
double square(const double value)
Return square of value; constant object.
Definition: d3arr4.cpp:16
df1_one_variable inv(const df1_one_variable &x)
Definition: df11fun.cpp:384
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13
d3_array pow(const d3_array &m, int e)
Description not yet available.
Definition: d3arr6.cpp:17