ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df11fun.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  */
41 
42 #if !defined(__DF11FUN__)
43 # define __DF11FUN__
44 #include <fvar.hpp>
45 //class df1b2variable;
46 
48  {
49  double v[2];
50  public:
51  static prevariable * ind_var[];
52  static int num_ind_var;
53  double * get_u(void) const {return (double*) (&(v[0]));}
54  double * get_u_x(void)const {return (double*) (&(v[1]));}
55  double * get_udot(void)const {return (double*) (&(v[1]));}
64  df1_one_variable(void);
66  };
67 
68  inline double value(const df1_one_variable& x) { return double(*x.get_u()); }
69 
71  {
72  public:
74  void deallocate(void);
76  init_df1_one_variable(double );
77  };
78 
79 
80 
82  {
83  int index_min;
84  int index_max;
87  public:
88  int indexmin(void) const { return int(index_min); }
89  int indexmax(void) const { return int(index_max); }
90  df1_one_vector(int min,int max);
91  df1_one_vector(void);
92  void allocate(void);
93  void allocate(int min,int max);
95  {
96  return (df1_one_variable&) (*(v+i));
97  }
99  {
100  return (df1_one_variable&) (*(v+i));
101  }
102  void initialize(void);
103  void deallocate(void);
104  ~df1_one_vector();
105  df1_one_vector(const df1_one_vector& m2);
106  };
107 
108 
109 
110  dvector value(const df1_one_vector& v);
112 
114  {
119  public:
120  int indexmin(void) const { return int(index_min); }
121  int indexmax(void) const { return int(index_max); }
122  df1_one_matrix(int rmin,int rmax,int cmin,int cmax);
124  {
125  return (df1_one_vector&) *(v+i);
126  }
128  {
129  return (df1_one_vector&) *(v+i);
130  }
131  df1_one_variable& operator () (int i,int j) const
132  {
133  return (df1_one_variable&) (*(v+i))(j);
134  }
135  void initialize(void);
136 //df1_one_variable& operator()(int i,int j) const { return *((v+i)->(v+j)); }
137  void deallocate(void);
138  ~df1_one_matrix();
139  df1_one_matrix(const df1_one_matrix& m2);
140  };
141 
142  dmatrix value(const df1_one_matrix& v);
143 
147 
148 
158  const df1_one_variable& y);
159 
164  const df1_one_variable& y);
166  const df1_one_variable& y);
168  double y);
170  const df1_one_variable& y);
171 
172  df1_one_variable operator / (const double x,const df1_one_variable& y);
173 
175  const double y);
176 
177  df1_one_variable operator + (const double x,
178  const df1_one_variable& y);
179 
181  const double y);
182 
184  const df1_one_variable& y);
187 
189  const df1_one_variable& y);
191  const df1_one_variable& y);
193  const df1_one_variable& y);
195  const df1_one_variable& y);
196 
197 
200 
202  const df1_one_variable& a);
203 
204 
206 #endif // __DF11FUN__
207 
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_one_variable & operator/=(const df1_one_variable &v)
Description not yet available.
Definition: fvar.hpp:2030
~init_df1_one_variable()
Destructor.
Definition: df11fun.cpp:558
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
int indexmin(void) const
Definition: df11fun.h:120
~df1_one_vector()
Destructor.
Definition: df11fun.cpp:46
static prevariable * ind_var[]
Definition: df11fun.h:51
double cumd_gamma(double x, double a)
Definition: cgamdev.cpp:38
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
int index_max
Definition: df11fun.h:84
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
int indexmin(void) const
Definition: df11fun.h:88
d3_array cube(const d3_array &m)
Description not yet available.
Definition: d3arr5.cpp:17
df1_one_matrix(int rmin, int rmax, int cmin, int cmax)
Construct matrix of df1_one_variable with dimensions [rmin to rmax] x [cmin to cmax].
Definition: df11fun.cpp:214
df1_one_variable & operator*=(const df1_one_variable &v)
Definition: df11fun.cpp:260
void initialize(void)
Definition: df11fun.cpp:194
void initialize(void)
Definition: df11fun.cpp:81
int index_min
Definition: df11fun.h:83
double v[2]
Definition: df11fun.h:49
int indexmax(void) const
Definition: df11fun.h:121
df1_one_matrix choleski_decomp(const df1_one_matrix &MM)
Definition: df11fun.cpp:606
df1_one_variable & operator=(const df1_one_variable &v)
Definition: df11fun.cpp:430
double * get_udot(void) const
Definition: df11fun.h:55
dmatrix operator*(const d3_array &t, const dvector &v)
Description not yet available.
Definition: d3arr12.cpp:17
vector_shapex * shape
Definition: df11fun.h:85
df1_one_variable(void)
Default constructor.
Definition: df11fun.cpp:18
df1_one_variable & operator+=(const df1_one_variable &v)
Definition: df11fun.cpp:253
void deallocate(void)
Deallocate df1_one_matrix, then set to empty.
Definition: df11fun.cpp:172
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
df1_one_vector & operator()(int i) const
Definition: df11fun.h:123
#define min(a, b)
Definition: cbivnorm.cpp:188
df1_one_variable & operator()(int i) const
Definition: df11fun.h:94
dmatrix second_derivatives(const df1_one_matrix &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void deallocate(void)
Resets num_ind_var count to zero.
Definition: df11fun.cpp:565
df1_one_variable * v
Definition: df11fun.h:86
df1_one_variable & operator[](int i) const
Definition: df11fun.h:98
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
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_x(void) const
Definition: df11fun.h:54
double * get_u(void) const
Definition: df11fun.h:53
mat_shapex * shape
Definition: df11fun.h:117
static int num_ind_var
Definition: df11fun.h:52
Holds &quot;shape&quot; 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
init_df1_one_variable(const prevariable &)
Construct init_df1_one_variable with _var.
Definition: df11fun.cpp:575
df1_one_vector & operator[](int i) const
Definition: df11fun.h:127
df1_one_variable & operator-=(const df1_one_variable &v)
Definition: df11fun.cpp:237
void deallocate(void)
Deallocate df1_one_vector, then set to empty.
Definition: df11fun.cpp:51
d3_array operator/(const d3_array &m, const double d)
Author: David Fournier.
Definition: d3arr2b.cpp:14
dmatrix third_derivatives(const df1_one_matrix &v)
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
#define max(a, b)
Definition: cbivnorm.cpp:189
df1_one_vector(void)
Default constructor.
Definition: df11fun.cpp:94
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
void allocate(void)
Reinitialize df1_one_vector to empty.
Definition: df11fun.cpp:130
df1_one_vector * v
Definition: df11fun.h:118
d3_array pow(const d3_array &m, int e)
Description not yet available.
Definition: d3arr6.cpp:17
int indexmax(void) const
Definition: df11fun.h:89