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
00045 #if !defined(__DF12FUN__)
00046 # define __DF12FUN__
00047 #include <fvar.hpp>
00048
00049
00054 class df1_two_variable
00055 {
00056 double v[3];
00057 public:
00058 static prevariable * ind_var[];
00059 static int num_ind_var;
00060 double* get_u() const {return (double*) (&(v[0]));}
00061 double* get_u_x() const {return (double*) (&(v[1]));}
00062 double* get_u_y() const {return (double*) (&(v[2]));}
00063 df1_two_variable& operator = (const df1_two_variable& v);
00064 df1_two_variable& operator = (double v);
00065 df1_two_variable& operator += (const df1_two_variable& v);
00066 df1_two_variable& operator *= (double v);
00067 df1_two_variable& operator *= (const df1_two_variable& v);
00068 df1_two_variable& operator += (double v);
00069 df1_two_variable& operator -= (const df1_two_variable& v);
00070 df1_two_variable& operator -= (double v);
00071 df1_two_variable& operator /= (const df1_two_variable& v);
00072 df1_two_variable();
00073 df1_two_variable(const df1_two_variable& );
00074 };
00075
00076 inline double value(const df1_two_variable& x) { return double(*x.get_u()); }
00077
00082 class init_df1_two_variable : public df1_two_variable
00083 {
00084 public:
00085 ~init_df1_two_variable();
00086 void deallocate(void);
00087 init_df1_two_variable(const prevariable& );
00088 init_df1_two_variable(double );
00089 };
00090
00095 class df1_two_vector
00096 {
00097 int index_min;
00098 int index_max;
00099 vector_shapex * shape;
00100 df1_two_variable * v;
00101 public:
00102 int indexmin(void) const { return int(index_min); }
00103 int indexmax(void) const { return int(index_max); }
00104 df1_two_vector(int min,int max);
00105 df1_two_vector(void);
00106 void allocate(void);
00107 void allocate(int min,int max);
00108 df1_two_variable& operator () (int i) const
00109 {
00110 return (df1_two_variable&) (*(v+i));
00111 }
00112 df1_two_variable& operator [] (int i) const
00113 {
00114 return (df1_two_variable&) (*(v+i));
00115 }
00116 void initialize(void);
00117 void deallocate(void);
00118 ~df1_two_vector();
00119 df1_two_vector(const df1_two_vector& m2);
00120 };
00121
00122
00123
00124 dvector value(const df1_two_vector& v);
00125 dvector first_derivatives(const df1_two_vector& v);
00126
00131 class df1_two_matrix
00132 {
00133 int index_min;
00134 int index_max;
00135 mat_shapex * shape;
00136 df1_two_vector * v;
00137 public:
00138 int indexmin(void) const { return int(index_min); }
00139 int indexmax(void) const { return int(index_max); }
00140 df1_two_matrix(int rmin,int rmax,int cmin,int cmax);
00141 df1_two_vector& operator () (int i) const
00142 {
00143 return (df1_two_vector&) *(v+i);
00144 }
00145 df1_two_vector& operator [] (int i) const
00146 {
00147 return (df1_two_vector&) *(v+i);
00148 }
00149 df1_two_variable& operator () (int i,int j) const
00150 {
00151 return (df1_two_variable&) (*(v+i))(j);
00152 }
00153 void initialize(void);
00154
00155 void deallocate(void);
00156 ~df1_two_matrix();
00157 df1_two_matrix(const df1_two_matrix& m2);
00158 };
00159
00160 dmatrix value(const df1_two_matrix& v);
00161
00162 dmatrix first_derivatives(const df1_two_matrix& v);
00163 dmatrix second_derivatives(const df1_two_matrix& v);
00164 dmatrix third_derivatives(const df1_two_matrix& v);
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186 df1_two_variable sin(const df1_two_variable& x);
00187 df1_two_variable sqrt(const df1_two_variable& x);
00188 df1_two_variable fabs(const df1_two_variable& x);
00189 df1_two_variable atan(const df1_two_variable& x);
00190 df1_two_variable cos(const df1_two_variable& x);
00191 df1_two_variable tan(const df1_two_variable& x);
00192 df1_two_variable log(const df1_two_variable& x);
00193 df1_two_variable square(const df1_two_variable& x);
00194 df1_two_variable cube(const df1_two_variable& x);
00195 df1_two_variable pow(const df1_two_variable& x,
00196 const df1_two_variable& y);
00197 df1_two_variable pow(double x,const df1_two_variable& y);
00198
00199 df1_two_variable sqrt(const df1_two_variable& x);
00200 df1_two_variable exp(const df1_two_variable& x);
00201 df1_two_variable inv(const df1_two_variable& x);
00202 df1_two_variable operator * (const df1_two_variable& x,
00203 const df1_two_variable& y);
00204 df1_two_variable operator * (double x,
00205 const df1_two_variable& y);
00206 df1_two_variable operator * (const df1_two_variable& x,
00207 double y);
00208 df1_two_variable operator / (const df1_two_variable& x,
00209 const df1_two_variable& y);
00210
00211 df1_two_variable operator / (const double x,const df1_two_variable& y);
00212
00213 df1_two_variable operator / (const df1_two_variable& x,
00214 const double y);
00215
00216 df1_two_variable operator + (const double x,
00217 const df1_two_variable& y);
00218
00219 df1_two_variable operator + (const df1_two_variable& x,
00220 const double y);
00221
00222 df1_two_variable operator + (const df1_two_variable& x,
00223 const df1_two_variable& y);
00224 df1_two_variable operator - (double x,const df1_two_variable& y);
00225 df1_two_variable operator - (const df1_two_variable& x,double y);
00226
00227 df1_two_variable operator - (const df1_two_variable& x,
00228 const df1_two_variable& y);
00229 df1_two_variable operator - (const df1_two_variable& x,
00230 const df1_two_variable& y);
00231 df1_two_variable operator / (const df1_two_variable& x,
00232 const df1_two_variable& y);
00233 df1_two_variable operator * (const df1_two_variable& x,
00234 const df1_two_variable& y);
00235
00236 df1_two_variable operator - (const df1_two_variable& v);
00237 df1_two_matrix choleski_decomp(const df1_two_matrix& MM);
00238
00239 df1_two_variable cumd_gamma(const df1_two_variable& x,
00240 const df1_two_variable& a);
00241
00242 df1_two_variable gammln(const df1_two_variable& xx);
00243 #endif // __DF12FUN__