ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df13fun.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(__DF12FUN__)
46 # define __DF12FUN__
47 #ifndef FVAR_HPP
48 # include <fvar.hpp>
49 #endif
50 //class df1b2variable;
51 
57  {
58  double v[4];
59  public:
60  static prevariable * ind_var[];
61  static int num_ind_var;
62  double * get_u(void) const {return (double*) (&(v[0]));}
63  double * get_u_x(void)const {return (double*) (&(v[1]));}
64  double * get_u_y(void)const {return (double*) (&(v[2]));}
65  double * get_u_z(void)const {return (double*) (&(v[3]));}
77  df1_three_variable(void);
79  void initialize(void);
80  };
81 
82  inline double value(const df1_three_variable& x)
83  { return double(*x.get_u()); }
84 
90  {
91  public:
93  void deallocate(void);
95  init_df1_three_variable(double );
96  };
97 
103  {
108  public:
109  int indexmin(void) const { return int(index_min); }
110  int indexmax(void) const { return int(index_max); }
111  df1_three_vector(int min,int max);
112  df1_three_vector(void);
113  void allocate(void);
114  void allocate(int min,int max);
116  {
117  return (df1_three_variable&) (*(v+i));
118  }
120  {
121  return (df1_three_variable&) (*(v+i));
122  }
123  void initialize(void);
124  void deallocate(void);
127  };
128 
129 
130 
131  dvector value(const df1_three_vector& v);
133 
139  {
144  public:
145  int indexmin(void) const { return int(index_min); }
146  int indexmax(void) const { return int(index_max); }
147  df1_three_matrix(int rmin,int rmax,int cmin,int cmax);
149  {
150  return (df1_three_vector&) *(v+i);
151  }
153  {
154  return (df1_three_vector&) *(v+i);
155  }
156  df1_three_variable& operator () (int i,int j) const
157  {
158  return (df1_three_variable&) (*(v+i))(j);
159  }
160  void initialize(void);
161 //df1_three_variable& operator()(int i,int j) const { return *((v+i)->(v+j)); }
162  void deallocate(void);
165  };
166 
167  dmatrix value(const df1_three_matrix& v);
168 
172 
173 /*
174  df1_three_variable operator F(const df1_three_variable& x)
175  {
176  df1_three_variable z;
177 
178  *z.get_u() = ::F(*x.get_u());
179 
180  *z.get_udot() = ::D1F(*x.get_u())* *x.get_udot();
181 
182  *z.get_udot2() = ::D2F(*x.get_u())* square(*x.get_udot())
183  + ::D1F(*x.get_u())* *x.get_udot2();
184 
185  *z.get_udot3() = ::D3F(*x.get_u()) * cube(*x.get_udot())
186  + 3.0 * ::D2F(*x.get_u()) * *x.get_udot() * *x.get_udot2()
187  + ::D1F(*x.get_u()) * *x.get_udot3();
188  return z;
189  }
190 
191 */
192 
203  const df1_three_variable& y);
204 
209  const df1_three_variable& y);
211  const df1_three_variable& y);
213  double y);
215  const df1_three_variable& y);
216 
217  df1_three_variable operator / (const double x,const df1_three_variable& y);
218 
220  const double y);
221 
222  df1_three_variable operator + (const double x,
223  const df1_three_variable& y);
224 
226  const double y);
227 
229  const df1_three_variable& y);
232 
234  const df1_three_variable& y);
236  const df1_three_variable& y);
238  const df1_three_variable& y);
240  const df1_three_variable& y);
241 
242 
245 
247  const df1_three_variable& a);
248 
249 
251 #endif // __DF12FUN__
252 
Base class for dvariable.
Definition: fvar.hpp:1315
d3_array tan(const d3_array &arr3)
Returns d3_array results with computed tan from elements in arr3.
Definition: d3arr2a.cpp:73
df1_three_variable & operator+=(const df1_three_variable &v)
Description not yet available.
Definition: df13fun.cpp:316
Description not yet available.
Definition: df13fun.h:56
mat_shapex * shape
Definition: df13fun.h:142
void initialize(void)
Description not yet available.
Definition: df13fun.cpp:107
Description not yet available.
Definition: fvar.hpp:2030
void deallocate(void)
Description not yet available.
Definition: df13fun.cpp:826
double gammln(double xx)
Log gamma function.
Definition: combc.cpp:52
df1_three_vector * v
Definition: df13fun.h:143
double * get_u_z(void) const
Definition: df13fun.h:65
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
int indexmax(void) const
Definition: df13fun.h:146
~df1_three_matrix()
Destructor.
Definition: df13fun.cpp:211
double cumd_gamma(double x, double a)
Definition: cgamdev.cpp:38
df1_three_variable & operator-=(const df1_three_variable &v)
Description not yet available.
Definition: df13fun.cpp:286
Description not yet available.
Definition: df13fun.h:89
df1_three_matrix(int rmin, int rmax, int cmin, int cmax)
Allocate matrix of df1_three_variable with dimension [min to max] x [cmin to cmax].
Definition: df13fun.cpp:259
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
d3_array sin(const d3_array &arr3)
Returns d3_array results with computed sin from elements in arr3.
Definition: d3arr2a.cpp:43
df1_two_variable fabs(const df1_two_variable &x)
Definition: df12fun.cpp:891
double * get_u(void) const
Definition: df13fun.h:62
double * get_u_y(void) const
Definition: df13fun.h:64
d3_array cube(const d3_array &m)
Description not yet available.
Definition: d3arr5.cpp:17
df1_three_variable * v
Definition: df13fun.h:107
double * get_u_x(void) const
Definition: df13fun.h:63
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
void initialize(void)
Description not yet available.
Definition: df13fun.cpp:23
df1_three_variable & operator[](int i) const
Definition: df13fun.h:119
df1_three_vector(void)
Description not yet available.
Definition: df13fun.cpp:121
~df1_three_vector()
Destructor.
Definition: df13fun.cpp:63
df1_three_variable & my_diveq(const df1_three_variable &v)
Description not yet available.
Definition: df13fun.cpp:388
void deallocate(void)
Deallocate df1_three_vector, then set as empty.
Definition: df13fun.cpp:68
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
int indexmax(void) const
Definition: df13fun.h:110
#define min(a, b)
Definition: cbivnorm.cpp:188
dmatrix second_derivatives(const df1_one_matrix &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
Description not yet available.
Definition: df13fun.h:102
dvector first_derivatives(const df1_one_vector &v)
Description not yet available.
Definition: df11fun.cpp:399
Description not yet available.
Definition: fvar.hpp:2819
Description not yet available.
Definition: df13fun.h:138
df1_three_variable & operator/=(const df1_three_variable &v)
Description not yet available.
Definition: df13fun.cpp:399
df1_three_variable & operator()(int i) const
Definition: df13fun.h:115
df1_three_variable & operator=(const df1_three_variable &v)
Description not yet available.
Definition: df13fun.cpp:616
df1_three_variable(void)
Default constructor.
Definition: df13fun.cpp:33
df1_three_vector & operator[](int i) const
Definition: df13fun.h:152
Holds &quot;shape&quot; information for vector objects.
Definition: vector_shapex.h:46
init_df1_three_variable(const prevariable &)
Description not yet available.
Definition: df13fun.cpp:835
d3_array cos(const d3_array &arr3)
Returns d3_array results with computed cos from elements in arr3.
Definition: d3arr2a.cpp:58
~init_df1_three_variable()
Destructor.
Definition: df13fun.cpp:817
int indexmin(void) const
Definition: df13fun.h:109
double v[4]
Definition: df13fun.h:58
void initialize(void)
Description not yet available.
Definition: df13fun.cpp:241
int indexmin(void) const
Definition: df13fun.h:145
static int num_ind_var
Definition: df13fun.h:61
d3_array operator/(const d3_array &m, const double d)
Author: David Fournier.
Definition: d3arr2b.cpp:14
df1_three_vector & operator()(int i) const
Definition: df13fun.h:148
dmatrix third_derivatives(const df1_one_matrix &v)
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
void allocate(void)
Description not yet available.
Definition: df13fun.cpp:164
void deallocate(void)
Deallocate df1_three_vector, then set as empty.
Definition: df13fun.cpp:216
#define max(a, b)
Definition: cbivnorm.cpp:189
static prevariable * ind_var[]
Definition: df13fun.h:60
df1_three_variable & operator*=(const df1_three_variable &v)
Description not yet available.
Definition: df13fun.cpp:349
vector_shapex * shape
Definition: df13fun.h:106
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