Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #if !defined(__DF11FUN__)
00043 # define __DF11FUN__
00044 #include <fvar.hpp>
00045
00046
00047 class df1_one_variable
00048 {
00049 double v[2];
00050 public:
00051 static prevariable * ind_var[];
00052 static int num_ind_var;
00053 double * get_u(void) const {return (double*) (&(v[0]));}
00054 double * get_u_x(void)const {return (double*) (&(v[1]));}
00055 double * get_udot(void)const {return (double*) (&(v[1]));}
00056 df1_one_variable& operator = (const df1_one_variable& v);
00057 df1_one_variable& operator = (double v);
00058 df1_one_variable& operator += (const df1_one_variable& v);
00059 df1_one_variable& operator *= (const df1_one_variable& v);
00060 df1_one_variable& operator += (double v);
00061 df1_one_variable& operator -= (const df1_one_variable& v);
00062 df1_one_variable& operator -= (double v);
00063 df1_one_variable& operator /= (const df1_one_variable& v);
00064 df1_one_variable(void);
00065 df1_one_variable(const df1_one_variable& );
00066 };
00067
00068 inline double value(const df1_one_variable& x) { return double(*x.get_u()); }
00069
00070 class init_df1_one_variable : public df1_one_variable
00071 {
00072 public:
00073 ~init_df1_one_variable();
00074 void deallocate(void);
00075 init_df1_one_variable(const prevariable& );
00076 init_df1_one_variable(double );
00077 };
00078
00079
00080
00081 class df1_one_vector
00082 {
00083 int index_min;
00084 int index_max;
00085 vector_shapex * shape;
00086 df1_one_variable * v;
00087 public:
00088 int indexmin(void) const { return int(index_min); }
00089 int indexmax(void) const { return int(index_max); }
00090 df1_one_vector(int min,int max);
00091 df1_one_vector(void);
00092 void allocate(void);
00093 void allocate(int min,int max);
00094 df1_one_variable& operator () (int i) const
00095 {
00096 return (df1_one_variable&) (*(v+i));
00097 }
00098 df1_one_variable& operator [] (int i) const
00099 {
00100 return (df1_one_variable&) (*(v+i));
00101 }
00102 void initialize(void);
00103 void deallocate(void);
00104 ~df1_one_vector();
00105 df1_one_vector(const df1_one_vector& m2);
00106 };
00107
00108
00109
00110 dvector value(const df1_one_vector& v);
00111 dvector first_derivatives(const df1_one_vector& v);
00112
00113 class df1_one_matrix
00114 {
00115 int index_min;
00116 int index_max;
00117 mat_shapex * shape;
00118 df1_one_vector * v;
00119 public:
00120 int indexmin(void) const { return int(index_min); }
00121 int indexmax(void) const { return int(index_max); }
00122 df1_one_matrix(int rmin,int rmax,int cmin,int cmax);
00123 df1_one_vector& operator () (int i) const
00124 {
00125 return (df1_one_vector&) *(v+i);
00126 }
00127 df1_one_vector& operator [] (int i) const
00128 {
00129 return (df1_one_vector&) *(v+i);
00130 }
00131 df1_one_variable& operator () (int i,int j) const
00132 {
00133 return (df1_one_variable&) (*(v+i))(j);
00134 }
00135 void initialize(void);
00136
00137 void deallocate(void);
00138 ~df1_one_matrix();
00139 df1_one_matrix(const df1_one_matrix& m2);
00140 };
00141
00142 dmatrix value(const df1_one_matrix& v);
00143
00144 dmatrix first_derivatives(const df1_one_matrix& v);
00145 dmatrix second_derivatives(const df1_one_matrix& v);
00146 dmatrix third_derivatives(const df1_one_matrix& v);
00147
00148
00149 df1_one_variable sin(const df1_one_variable& x);
00150 df1_one_variable sqrt(const df1_one_variable& x);
00151 df1_one_variable atan(const df1_one_variable& x);
00152 df1_one_variable cos(const df1_one_variable& x);
00153 df1_one_variable tan(const df1_one_variable& x);
00154 df1_one_variable log(const df1_one_variable& x);
00155 df1_one_variable square(const df1_one_variable& x);
00156 df1_one_variable cube(const df1_one_variable& x);
00157 df1_one_variable pow(const df1_one_variable& x,
00158 const df1_one_variable& y);
00159
00160 df1_one_variable sqrt(const df1_one_variable& x);
00161 df1_one_variable exp(const df1_one_variable& x);
00162 df1_one_variable inv(const df1_one_variable& x);
00163 df1_one_variable operator * (const df1_one_variable& x,
00164 const df1_one_variable& y);
00165 df1_one_variable operator * (double x,
00166 const df1_one_variable& y);
00167 df1_one_variable operator * (const df1_one_variable& x,
00168 double y);
00169 df1_one_variable operator / (const df1_one_variable& x,
00170 const df1_one_variable& y);
00171
00172 df1_one_variable operator / (const double x,const df1_one_variable& y);
00173
00174 df1_one_variable operator / (const df1_one_variable& x,
00175 const double y);
00176
00177 df1_one_variable operator + (const double x,
00178 const df1_one_variable& y);
00179
00180 df1_one_variable operator + (const df1_one_variable& x,
00181 const double y);
00182
00183 df1_one_variable operator + (const df1_one_variable& x,
00184 const df1_one_variable& y);
00185 df1_one_variable operator - (double x,const df1_one_variable& y);
00186 df1_one_variable operator - (const df1_one_variable& x,double y);
00187
00188 df1_one_variable operator - (const df1_one_variable& x,
00189 const df1_one_variable& y);
00190 df1_one_variable operator - (const df1_one_variable& x,
00191 const df1_one_variable& y);
00192 df1_one_variable operator / (const df1_one_variable& x,
00193 const df1_one_variable& y);
00194 df1_one_variable operator * (const df1_one_variable& x,
00195 const df1_one_variable& y);
00196
00197
00198 df1_one_variable operator - (const df1_one_variable& v);
00199 df1_one_matrix choleski_decomp(const df1_one_matrix& MM);
00200
00201 df1_one_variable cumd_gamma(const df1_one_variable& x,
00202 const df1_one_variable& a);
00203
00204
00205 df1_one_variable gammln(const df1_one_variable& xx);
00206 #endif // __DF11FUN__
00207